From: Craig Topper Date: Fri, 1 Sep 2017 21:27:29 +0000 (+0000) Subject: [InstCombine] When converting decomposeBitTestICmp's APInt return to ConstantInt... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35761d5d457fa51c974133617e3413cfeea9ca69;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312380 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 4b5e53cab10..4a6c46ddaab 100644 --- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -299,8 +299,8 @@ static bool decomposeBitTestICmp(Value *LHS, Value *RHS, CmpInst::Predicate &Pre 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; }