OSDN Git Service

[InstCombine] Don't require the compare types to be the same in getMaskedTypeForICmpPair.
authorCraig Topper <craig.topper@intel.com>
Fri, 1 Sep 2017 21:27:31 +0000 (21:27 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 1 Sep 2017 21:27:31 +0000 (21:27 +0000)
A future patch will make the code look through truncates feeding the compare. So the compares might be different types but the pretruncated types might be the same.

This should be safe because we still require the same Value* to be used truncated or not in both compares. So that serves to ensure the types are the same.

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

lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

index 4a6c46d..36bb4d0 100644 (file)
@@ -312,10 +312,9 @@ static unsigned getMaskedTypeForICmpPair(Value *&A, Value *&B, Value *&C,
                                          ICmpInst *RHS,
                                          ICmpInst::Predicate &PredL,
                                          ICmpInst::Predicate &PredR) {
-  if (LHS->getOperand(0)->getType() != RHS->getOperand(0)->getType())
-    return 0;
   // vectors are not (yet?) supported. Don't support pointers either.
-  if (!LHS->getOperand(0)->getType()->isIntegerTy())
+  if (!LHS->getOperand(0)->getType()->isIntegerTy() ||
+      !RHS->getOperand(0)->getType()->isIntegerTy())
     return 0;
 
   // Here comes the tricky part: