summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-01-13 10:43:08 +0000
committerDuncan Sands <baldrick@free.fr>2011-01-13 10:43:08 +0000
commitad000d8f16b5ca8ff2460dd60d657bfa55425855 (patch)
tree401ad8e5930b434cc44fdc40044ac0c0f8075c67 /llvm/lib/Analysis
parent8d25a7c3a01639636bde0ff17f2d8962010cfd29 (diff)
downloadbcm5719-llvm-ad000d8f16b5ca8ff2460dd60d657bfa55425855.tar.gz
bcm5719-llvm-ad000d8f16b5ca8ff2460dd60d657bfa55425855.zip
Remove some wrong code which fortunately was never executed (as explained in
the comment I added): an extern weak global may have a null address. llvm-svn: 123373
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index b3a3acab614..d4b89cebd59 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1024,12 +1024,15 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
}
}
- // icmp <global/alloca*/null>, <global/alloca*/null> - Global/Stack value
- // addresses never equal each other! We already know that Op0 != Op1.
- if ((isa<GlobalValue>(LHS) || isa<AllocaInst>(LHS) ||
- isa<ConstantPointerNull>(LHS)) &&
- (isa<GlobalValue>(RHS) || isa<AllocaInst>(RHS) ||
- isa<ConstantPointerNull>(RHS)))
+ // icmp <alloca*>, <global/alloca*/null> - Different stack variables have
+ // different addresses, and what's more the address of a stack variable is
+ // never null or equal to the address of a global. Note that generalizing
+ // to the case where LHS is a global variable address or null is pointless,
+ // since if both LHS and RHS are constants then we already constant folded
+ // the compare, and if only one of them is then we moved it to RHS already.
+ if (isa<AllocaInst>(LHS) && (isa<GlobalValue>(RHS) || isa<AllocaInst>(RHS) ||
+ isa<ConstantPointerNull>(RHS)))
+ // We already know that LHS != LHS.
return ConstantInt::get(ITy, CmpInst::isFalseWhenEqual(Pred));
// If the comparison is with the result of a select instruction, check whether
OpenPOWER on IntegriCloud