diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-04-29 22:23:16 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-04-29 22:23:16 +0000 |
| commit | 107aefc2fc7c93d76c0c0eb35b1b36ff9fb92333 (patch) | |
| tree | 3999dac796935052415babd52b8cdd3a5fce2c81 /llvm/lib/Transforms/Scalar | |
| parent | aa8dfe9fb311682e52aded7146c6ef16ae6d645e (diff) | |
| download | bcm5719-llvm-107aefc2fc7c93d76c0c0eb35b1b36ff9fb92333.tar.gz bcm5719-llvm-107aefc2fc7c93d76c0c0eb35b1b36ff9fb92333.zip | |
Mark guards on true as "trivially dead"
This moves some logic added to EarlyCSE in rL268120 into
`llvm::isInstructionTriviallyDead`. Adds a test case for DCE to
demonstrate that passes other than EarlyCSE can now pick up on the new
information.
llvm-svn: 268126
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index c453c843bfc..2e00d676f15 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -555,15 +555,8 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { } if (match(Inst, m_Intrinsic<Intrinsic::experimental_guard>())) { - Value *Cond = cast<CallInst>(Inst)->getArgOperand(0); - - if (match(Cond, m_One())) { - // Elide guards on true, since operationally they're no-ops. In the - // future we can consider more sophisticated tradeoffs here with - // consideration to potential for check widening, but for now we keep - // things simple. - Inst->eraseFromParent(); - } else if (auto *CondI = dyn_cast<Instruction>(Cond)) { + if (auto *CondI = + dyn_cast<Instruction>(cast<CallInst>(Inst)->getArgOperand(0))) { // The condition we're on guarding here is true for all dominated // locations. if (SimpleValue::canHandle(CondI)) |

