[llvm] r312380 - [InstCombine] When converting decomposeBitTestICmp's APInt return to ConstantInt, make sure we use the type from the Value* that was also returned from decomposeBitTestICmp.

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


Author: ctopper
Date: Fri Sep  1 14:27:29 2017
New Revision: 312380

URL: http://llvm.org/viewvc/llvm-project?rev=312380&view=rev
Log:
[InstCombine] When converting decomposeBitTestICmp's APInt return to ConstantInt, make sure we use the type from the Value* that was also returned from decomposeBitTestICmp.

Previously we used the type from the LHS of the compare, but a future patch will change decomposeBitTestICmp to look through truncates so it will return a pretruncated Value* and the type needs to match that.

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=312380&r1=312379&r2=312380&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Fri Sep  1 14:27:29 2017
@@ -299,8 +299,8 @@ static bool decomposeBitTestICmp(Value *
   if (!llvm::decomposeBitTestICmp(LHS, RHS, Pred, X, Mask))
     return false;
 
-  Y = ConstantInt::get(LHS->getType(), Mask);
-  Z = ConstantInt::get(RHS->getType(), 0);
+  Y = ConstantInt::get(X->getType(), Mask);
+  Z = ConstantInt::get(X->getType(), 0);
   return true;
 }
 




More information about the llvm-commits mailing list