summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/GVN.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVN.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index a963b2f50ed..944e06d4391 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -2056,21 +2056,12 @@ bool GVN::processInstruction(Instruction *I) {
// "%z = and i32 %x, %y" becomes "%z = and i32 %x, %x" which we now simplify.
const DataLayout &DL = I->getModule()->getDataLayout();
if (Value *V = SimplifyInstruction(I, DL, TLI, DT, AC)) {
- bool Changed = false;
- if (!I->use_empty()) {
- I->replaceAllUsesWith(V);
- Changed = true;
- }
- if (isInstructionTriviallyDead(I, TLI)) {
- markInstructionForDeletion(I);
- Changed = true;
- }
- if (Changed) {
- if (MD && V->getType()->getScalarType()->isPointerTy())
- MD->invalidateCachedPointerInfo(V);
- ++NumGVNSimpl;
- return true;
- }
+ I->replaceAllUsesWith(V);
+ if (MD && V->getType()->getScalarType()->isPointerTy())
+ MD->invalidateCachedPointerInfo(V);
+ markInstructionForDeletion(I);
+ ++NumGVNSimpl;
+ return true;
}
if (IntrinsicInst *IntrinsicI = dyn_cast<IntrinsicInst>(I))
OpenPOWER on IntegriCloud