From 3ccd17ea2a6c5e68993657a0cbe80f5f00e1aaed Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 13 Aug 2003 05:38:46 +0000 Subject: [PATCH] Implement InstCombine/2003-08-12-AllocaNonNull.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7807 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index d2d8c93b5f7..8a3c0d47e97 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 , 0 - Global value addresses are never null! - if (isa(Op0) && isa(Op1)) + // setcc , 0 - Global/Stack value addresses are never null! + if (isa(Op1) && + (isa(Op0) || isa(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 -- 2.34.1