diff options
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index d2d8c93b5f..8a3c0d47e9 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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 |