diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 4d76aae2971..4f8935dd971 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -456,23 +456,14 @@ simplifyAndDCEInstruction(Instruction *I, if (Value *SimpleV = SimplifyInstruction(I, DL)) { // Add the users to the worklist. CAREFUL: an instruction can use itself, // in the case of a phi node. - for (User *U : I->users()) { - if (U != I) { + for (User *U : I->users()) + if (U != I) WorkList.insert(cast<Instruction>(U)); - } - } // Replace the instruction with its simplified value. - bool Changed = false; - if (!I->use_empty()) { - I->replaceAllUsesWith(SimpleV); - Changed = true; - } - if (isInstructionTriviallyDead(I, TLI)) { - I->eraseFromParent(); - Changed = true; - } - return Changed; + I->replaceAllUsesWith(SimpleV); + I->eraseFromParent(); + return true; } return false; } |