Mercurial > hg > CbC > CbC_llvm
diff llvm/lib/Target/Hexagon/RDFDeadCode.cpp @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | 79ff65ed7e25 |
children |
line wrap: on
line diff
--- a/llvm/lib/Target/Hexagon/RDFDeadCode.cpp Wed Nov 09 17:47:54 2022 +0900 +++ b/llvm/lib/Target/Hexagon/RDFDeadCode.cpp Fri Aug 18 09:04:13 2023 +0900 @@ -55,7 +55,8 @@ // overly conservative (i.e. return "true" for all instructions), but it // is not safe to return "false" for an instruction that should not be // considered removable. -bool DeadCodeElimination::isLiveInstr(const MachineInstr *MI) const { +bool DeadCodeElimination::isLiveInstr(NodeAddr<StmtNode *> S) const { + const MachineInstr *MI = S.Addr->getCode(); if (MI->mayStore() || MI->isBranch() || MI->isCall() || MI->isReturn()) return true; if (MI->hasOrderedMemoryRef() || MI->hasUnmodeledSideEffects() || @@ -83,7 +84,7 @@ SetQueue<NodeId> &WorkQ) { if (!DFG.IsCode<NodeAttrs::Stmt>(IA)) return; - if (!isLiveInstr(NodeAddr<StmtNode*>(IA).Addr->getCode())) + if (!isLiveInstr(IA)) return; for (NodeAddr<RefNode*> RA : IA.Addr->members(DFG)) { if (!LiveNodes.count(RA.Id)) @@ -160,7 +161,7 @@ if (!LiveNodes.count(RA.Id)) DeadNodes.insert(RA.Id); if (DFG.IsCode<NodeAttrs::Stmt>(IA)) - if (isLiveInstr(NodeAddr<StmtNode*>(IA).Addr->getCode())) + if (isLiveInstr(IA) || DFG.hasUntrackedRef(IA)) continue; if (IsDead(IA)) { DeadInstrs.insert(IA.Id);