summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-13 05:38:46 +0000
committerChris Lattner <sabre@nondot.org>2003-08-13 05:38:46 +0000
commitd07283a2adeb4f86dd3f63e8ce01adedd096991c (patch)
treeb95484b9900197c748333a2dc80a39654714860f /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parentc992add9fe7cfde2cdb5cc1bd8addfa8adc123e2 (diff)
downloadbcm5719-llvm-d07283a2adeb4f86dd3f63e8ce01adedd096991c.tar.gz
bcm5719-llvm-d07283a2adeb4f86dd3f63e8ce01adedd096991c.zip
Implement InstCombine/2003-08-12-AllocaNonNull.ll
llvm-svn: 7807
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index d2d8c93b5f7..8a3c0d47e97 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -768,10 +768,12 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) {
if (Op0 == Op1)
return ReplaceInstUsesWith(I, ConstantBool::get(isTrueWhenEqual(I)));
- // setcc <global*>, 0 - Global value addresses are never null!
- if (isa<GlobalValue>(Op0) && isa<ConstantPointerNull>(Op1))
+ // setcc <global/alloca*>, 0 - Global/Stack value addresses are never null!
+ if (isa<ConstantPointerNull>(Op1) &&
+ (isa<GlobalValue>(Op0) || isa<AllocaInst>(Op0)))
return ReplaceInstUsesWith(I, ConstantBool::get(!isTrueWhenEqual(I)));
+
// setcc's with boolean values can always be turned into bitwise operations
if (Ty == Type::BoolTy) {
// If this is <, >, or !=, we can change this into a simple xor instruction
OpenPOWER on IntegriCloud