aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2016-06-24 22:52:39 +0000
committerNico Weber <nicolasweber@gmx.de>2016-06-24 22:52:39 +0000
commitae2ef4ccd4b904461009c4444e1ae9006a666c0e (patch)
tree5e15cef9fa969476d81a31a2f81bd5f1c3371177 /llvm/lib/Transforms/Utils/Local.cpp
parentbabc13a3e25636bd6b9ee64baf42bca1a8e497cf (diff)
downloadllvm-ae2ef4ccd4b904461009c4444e1ae9006a666c0e.zip
llvm-ae2ef4ccd4b904461009c4444e1ae9006a666c0e.tar.gz
llvm-ae2ef4ccd4b904461009c4444e1ae9006a666c0e.tar.bz2
Revert r273711, it caused PR28298.
llvm-svn: 273743
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 4d76aae..4f8935d 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;
}