OSDN Git Service

[InstSimplify] Use the getTrue/getFalse helpers and make sure we use the computed...
authorCraig Topper <craig.topper@gmail.com>
Tue, 6 Jun 2017 07:13:13 +0000 (07:13 +0000)
committerCraig Topper <craig.topper@gmail.com>
Tue, 6 Jun 2017 07:13:13 +0000 (07:13 +0000)
Currently, isKnownNonEqual punts on vectors so the hardcoding to i1 doesn't matter. But I plan to fix that in a future patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304773 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/InstructionSimplify.cpp

index d5b93ca..55ced96 100644 (file)
@@ -3310,9 +3310,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
   // icmp eq|ne X, Y -> false|true if X != Y
   if (ICmpInst::isEquality(Pred) &&
       isKnownNonEqual(LHS, RHS, Q.DL, Q.AC, Q.CxtI, Q.DT)) {
-    LLVMContext &Ctx = LHS->getType()->getContext();
-    return Pred == ICmpInst::ICMP_NE ?
-      ConstantInt::getTrue(Ctx) : ConstantInt::getFalse(Ctx);
+    return Pred == ICmpInst::ICMP_NE ? getTrue(ITy) : getFalse(ITy);
   }
 
   if (Value *V = simplifyICmpWithBinOp(Pred, LHS, RHS, Q, MaxRecurse))