[llvm] r312381 - [InstCombine] Don't require the compare types to be the same in getMaskedTypeForICmpPair.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 14:27:31 PDT 2017


Author: ctopper
Date: Fri Sep  1 14:27:31 2017
New Revision: 312381

URL: http://llvm.org/viewvc/llvm-project?rev=312381&view=rev
Log:
[InstCombine] Don't require the compare types to be the same in getMaskedTypeForICmpPair.

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.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=312381&r1=312380&r2=312381&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Fri Sep  1 14:27:31 2017
@@ -312,10 +312,9 @@ static unsigned getMaskedTypeForICmpPair
                                          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:




More information about the llvm-commits mailing list