[llvm] r335258 - [InstCombine] simplify binops before trying other folds
Mikhail Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 12 14:52:07 PDT 2018
Hi Sanjay,
Our fuzzer-bot detected a failure after this change. Here is a reproducer:
$ cat fuzz.ll
source_filename = "M"
target triple = "x86_64-apple-darwin17.6.0"
define void @f() {
BB:
%A8 = alloca i16
%L7 = load i16, i16* %A8
%G21 = getelementptr i16, i16* %A8, i8 -1
%B11 = udiv i16 %L7, -1
%G4 = getelementptr i16, i16* %A8, i16 %B11
%L2 = load i16, i16* %G4
%L = load i16, i16* %G4
%B23 = mul i16 %B11, %B11
%L4 = load i16, i16* %A8
%B21 = sdiv i16 %L7, %L4
%B7 = sub i16 0, %B21
%B18 = mul i16 %B23, %B7
%C10 = icmp ugt i16 %L, %B11
%B20 = and i16 %L7, %L2
%B1 = mul i1 %C10, true
%C5 = icmp sle i16 %B21, %L
%C11 = icmp ule i16 %B21, %L
%C7 = icmp slt i16 %B20, 0
%B29 = srem i16 %L4, %B18
%B15 = add i1 %C7, %C10
%B19 = add i1 %C11, %B15
%C6 = icmp sge i1 %C11, %B19
%B33 = or i16 %B29, %L4
%C13 = icmp uge i1 %C5, %B1
%C3 = icmp ult i1 %C13, %C6
store i16 undef, i16* %G21
%C18 = icmp ule i1 %C10, %C7
%G26 = getelementptr i1, i1* null, i1 %C3
store i16 %B33, i16* undef
store i1 %C18, i1* undef
store i1* %G26, i1** undef
ret void
}
$ bin/opt -instcombine fuzz.ll -disable-output
Unknown integer condition code!
UNREACHABLE executed at /Users/mvzolotu/devel/mono/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1034!
I took a look at the code of foldAndOfICmps, and indeed we don’t have a code to handle %I1=%X < 0, %I2=%X < 1, %I3 = %I1 && %I2.
What would be the best way to handle it (and why didn’t we hit it before)?
Thanks,
Michael
> On Jun 21, 2018, at 10:06 AM, Sanjay Patel via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: spatel
> Date: Thu Jun 21 10:06:36 2018
> New Revision: 335258
>
> URL: http://llvm.org/viewvc/llvm-project?rev=335258&view=rev
> Log:
> [InstCombine] simplify binops before trying other folds
>
> This is outwardly NFC from what I can tell, but it should be more efficient
> to simplify first (despite the name, SimplifyAssociativeOrCommutative does
> not actually simplify as InstSimplify does - it creates/morphs instructions).
>
> This should make it easier to refactor duplicated code that runs for all binops.
>
> Modified:
> llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=335258&r1=335257&r2=335258&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Thu Jun 21 10:06:36 2018
> @@ -1121,13 +1121,12 @@ static Instruction *canonicalizeLowbitMa
> }
>
> Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
> - bool Changed = SimplifyAssociativeOrCommutative(I);
> - Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
> - if (Value *V =
> - SimplifyAddInst(LHS, RHS, I.hasNoSignedWrap(), I.hasNoUnsignedWrap(),
> - SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyAddInst(I.getOperand(0), I.getOperand(1),
> + I.hasNoSignedWrap(), I.hasNoUnsignedWrap(),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> + bool Changed = SimplifyAssociativeOrCommutative(I);
> if (Instruction *X = foldShuffledBinop(I))
> return X;
>
> @@ -1140,6 +1139,7 @@ Instruction *InstCombiner::visitAdd(Bina
>
> // FIXME: This should be moved into the above helper function to allow these
> // transforms for general constant or constant splat vectors.
> + Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
> Type *Ty = I.getType();
> if (ConstantInt *CI = dyn_cast<ConstantInt>(RHS)) {
> Value *XorLHS = nullptr; ConstantInt *XorRHS = nullptr;
> @@ -1378,18 +1378,19 @@ Instruction *InstCombiner::visitAdd(Bina
> }
>
> Instruction *InstCombiner::visitFAdd(BinaryOperator &I) {
> - bool Changed = SimplifyAssociativeOrCommutative(I);
> - Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
> - if (Value *V = SimplifyFAddInst(LHS, RHS, I.getFastMathFlags(),
> + if (Value *V = SimplifyFAddInst(I.getOperand(0), I.getOperand(1),
> + I.getFastMathFlags(),
> SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> + bool Changed = SimplifyAssociativeOrCommutative(I);
> if (Instruction *X = foldShuffledBinop(I))
> return X;
>
> if (Instruction *FoldedFAdd = foldBinOpIntoSelectOrPhi(I))
> return FoldedFAdd;
>
> + Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
> Value *X;
> // (-X) + Y --> Y - X
> if (match(LHS, m_FNeg(m_Value(X))))
> @@ -1555,10 +1556,9 @@ Value *InstCombiner::OptimizePointerDiff
> }
>
> Instruction *InstCombiner::visitSub(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V =
> - SimplifySubInst(Op0, Op1, I.hasNoSignedWrap(), I.hasNoUnsignedWrap(),
> - SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifySubInst(I.getOperand(0), I.getOperand(1),
> + I.hasNoSignedWrap(), I.hasNoUnsignedWrap(),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -1569,6 +1569,7 @@ Instruction *InstCombiner::visitSub(Bina
> return replaceInstUsesWith(I, V);
>
> // If this is a 'B = x-(-A)', change to B = x+A.
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> if (Value *V = dyn_castNegVal(Op1)) {
> BinaryOperator *Res = BinaryOperator::CreateAdd(Op0, V);
>
> @@ -1808,8 +1809,8 @@ Instruction *InstCombiner::visitSub(Bina
> }
>
> Instruction *InstCombiner::visitFSub(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyFSubInst(Op0, Op1, I.getFastMathFlags(),
> + if (Value *V = SimplifyFSubInst(I.getOperand(0), I.getOperand(1),
> + I.getFastMathFlags(),
> SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> @@ -1818,6 +1819,7 @@ Instruction *InstCombiner::visitFSub(Bin
>
> // Subtraction from -0.0 is the canonical form of fneg.
> // fsub nsz 0, X ==> fsub nsz -0.0, X
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> if (I.hasNoSignedZeros() && match(Op0, m_PosZeroFP()))
> return BinaryOperator::CreateFNegFMF(Op1, &I);
>
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=335258&r1=335257&r2=335258&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Thu Jun 21 10:06:36 2018
> @@ -1401,11 +1401,11 @@ Instruction *InstCombiner::narrowMaskedB
> // here. We should standardize that construct where it is needed or choose some
> // other way to ensure that commutated variants of patterns are not missed.
> Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
> - bool Changed = SimplifyAssociativeOrCommutative(I);
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyAndInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyAndInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> + bool Changed = SimplifyAssociativeOrCommutative(I);
> if (Instruction *X = foldShuffledBinop(I))
> return X;
>
> @@ -1425,6 +1425,7 @@ Instruction *InstCombiner::visitAnd(Bina
> if (Value *V = SimplifyBSwap(I, Builder))
> return replaceInstUsesWith(I, V);
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> const APInt *C;
> if (match(Op1, m_APInt(C))) {
> Value *X, *Y;
> @@ -2015,11 +2016,11 @@ Value *InstCombiner::foldOrOfICmps(ICmpI
> // here. We should standardize that construct where it is needed or choose some
> // other way to ensure that commutated variants of patterns are not missed.
> Instruction *InstCombiner::visitOr(BinaryOperator &I) {
> - bool Changed = SimplifyAssociativeOrCommutative(I);
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyOrInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyOrInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> + bool Changed = SimplifyAssociativeOrCommutative(I);
> if (Instruction *X = foldShuffledBinop(I))
> return X;
>
> @@ -2046,6 +2047,7 @@ Instruction *InstCombiner::visitOr(Binar
> if (Instruction *BSwap = MatchBSwap(I))
> return BSwap;
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> {
> Value *A;
> const APInt *C;
> @@ -2468,11 +2470,11 @@ static Instruction *visitMaskedMerge(Bin
> // here. We should standardize that construct where it is needed or choose some
> // other way to ensure that commutated variants of patterns are not missed.
> Instruction *InstCombiner::visitXor(BinaryOperator &I) {
> - bool Changed = SimplifyAssociativeOrCommutative(I);
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyXorInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyXorInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> + bool Changed = SimplifyAssociativeOrCommutative(I);
> if (Instruction *X = foldShuffledBinop(I))
> return X;
>
> @@ -2492,6 +2494,7 @@ Instruction *InstCombiner::visitXor(Bina
> return replaceInstUsesWith(I, V);
>
> // A^B --> A|B iff A and B have no bits set in common.
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> if (haveNoCommonBitsSet(Op0, Op1, DL, &AC, &I, &DT))
> return BinaryOperator::CreateOr(Op0, Op1);
>
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp?rev=335258&r1=335257&r2=335258&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp Thu Jun 21 10:06:36 2018
> @@ -126,11 +126,11 @@ static Constant *getLogBase2(Type *Ty, C
> }
>
> Instruction *InstCombiner::visitMul(BinaryOperator &I) {
> - bool Changed = SimplifyAssociativeOrCommutative(I);
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyMulInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyMulInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> + bool Changed = SimplifyAssociativeOrCommutative(I);
> if (Instruction *X = foldShuffledBinop(I))
> return X;
>
> @@ -138,6 +138,7 @@ Instruction *InstCombiner::visitMul(Bina
> return replaceInstUsesWith(I, V);
>
> // X * -1 == 0 - X
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> if (match(Op1, m_AllOnes())) {
> BinaryOperator *BO = BinaryOperator::CreateNeg(Op0, I.getName());
> if (I.hasNoSignedWrap())
> @@ -406,12 +407,12 @@ Instruction *InstCombiner::visitMul(Bina
> }
>
> Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
> - bool Changed = SimplifyAssociativeOrCommutative(I);
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyFMulInst(Op0, Op1, I.getFastMathFlags(),
> + if (Value *V = SimplifyFMulInst(I.getOperand(0), I.getOperand(1),
> + I.getFastMathFlags(),
> SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> + bool Changed = SimplifyAssociativeOrCommutative(I);
> if (Instruction *X = foldShuffledBinop(I))
> return X;
>
> @@ -419,6 +420,7 @@ Instruction *InstCombiner::visitFMul(Bin
> return FoldedMul;
>
> // X * -1.0 --> -X
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> if (match(Op1, m_SpecificFP(-1.0)))
> return BinaryOperator::CreateFNegFMF(Op0, &I);
>
> @@ -936,8 +938,8 @@ static Instruction *narrowUDivURem(Binar
> }
>
> Instruction *InstCombiner::visitUDiv(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyUDivInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyUDivInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -948,6 +950,7 @@ Instruction *InstCombiner::visitUDiv(Bin
> return Common;
>
> // (x lshr C1) udiv C2 --> x udiv (C2 << C1)
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> {
> Value *X;
> const APInt *C1, *C2;
> @@ -1004,8 +1007,8 @@ Instruction *InstCombiner::visitUDiv(Bin
> }
>
> Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifySDivInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifySDivInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -1015,6 +1018,7 @@ Instruction *InstCombiner::visitSDiv(Bin
> if (Instruction *Common = commonIDivTransforms(I))
> return Common;
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> const APInt *Op1C;
> if (match(Op1, m_APInt(Op1C))) {
> // sdiv X, -1 == -X
> @@ -1147,8 +1151,8 @@ static Instruction *foldFDivConstantDivi
> }
>
> Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyFDivInst(Op0, Op1, I.getFastMathFlags(),
> + if (Value *V = SimplifyFDivInst(I.getOperand(0), I.getOperand(1),
> + I.getFastMathFlags(),
> SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> @@ -1161,6 +1165,7 @@ Instruction *InstCombiner::visitFDiv(Bin
> if (Instruction *R = foldFDivConstantDividend(I))
> return R;
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> if (isa<Constant>(Op0))
> if (SelectInst *SI = dyn_cast<SelectInst>(Op1))
> if (Instruction *R = FoldOpIntoSelect(I, SI))
> @@ -1276,8 +1281,8 @@ Instruction *InstCombiner::commonIRemTra
> }
>
> Instruction *InstCombiner::visitURem(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyURemInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyURemInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -1290,6 +1295,7 @@ Instruction *InstCombiner::visitURem(Bin
> return NarrowRem;
>
> // X urem Y -> X and Y-1, where Y is a power of 2,
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> if (isKnownToBeAPowerOfTwo(Op1, /*OrZero*/ true, 0, &I)) {
> Constant *N1 = Constant::getAllOnesValue(I.getType());
> Value *Add = Builder.CreateAdd(Op1, N1);
> @@ -1314,8 +1320,8 @@ Instruction *InstCombiner::visitURem(Bin
> }
>
> Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifySRemInst(Op0, Op1, SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifySRemInst(I.getOperand(0), I.getOperand(1),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -1325,6 +1331,7 @@ Instruction *InstCombiner::visitSRem(Bin
> if (Instruction *Common = commonIRemTransforms(I))
> return Common;
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> {
> const APInt *Y;
> // X % -Y -> X % Y
> @@ -1386,8 +1393,8 @@ Instruction *InstCombiner::visitSRem(Bin
> }
>
> Instruction *InstCombiner::visitFRem(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V = SimplifyFRemInst(Op0, Op1, I.getFastMathFlags(),
> + if (Value *V = SimplifyFRemInst(I.getOperand(0), I.getOperand(1),
> + I.getFastMathFlags(),
> SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp?rev=335258&r1=335257&r2=335258&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp Thu Jun 21 10:06:36 2018
> @@ -588,10 +588,9 @@ Instruction *InstCombiner::FoldShiftByCo
> }
>
> Instruction *InstCombiner::visitShl(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V =
> - SimplifyShlInst(Op0, Op1, I.hasNoSignedWrap(), I.hasNoUnsignedWrap(),
> - SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyShlInst(I.getOperand(0), I.getOperand(1),
> + I.hasNoSignedWrap(), I.hasNoUnsignedWrap(),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -600,11 +599,12 @@ Instruction *InstCombiner::visitShl(Bina
> if (Instruction *V = commonShiftTransforms(I))
> return V;
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> Type *Ty = I.getType();
> const APInt *ShAmtAPInt;
> if (match(Op1, m_APInt(ShAmtAPInt))) {
> unsigned ShAmt = ShAmtAPInt->getZExtValue();
> - unsigned BitWidth = I.getType()->getScalarSizeInBits();
> + unsigned BitWidth = Ty->getScalarSizeInBits();
>
> // shl (zext X), ShAmt --> zext (shl X, ShAmt)
> // This is only valid if X would have zeros shifted out.
> @@ -693,9 +693,8 @@ Instruction *InstCombiner::visitShl(Bina
> }
>
> Instruction *InstCombiner::visitLShr(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V =
> - SimplifyLShrInst(Op0, Op1, I.isExact(), SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyLShrInst(I.getOperand(0), I.getOperand(1), I.isExact(),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -704,6 +703,7 @@ Instruction *InstCombiner::visitLShr(Bin
> if (Instruction *R = commonShiftTransforms(I))
> return R;
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> Type *Ty = I.getType();
> const APInt *ShAmtAPInt;
> if (match(Op1, m_APInt(ShAmtAPInt))) {
> @@ -821,9 +821,8 @@ Instruction *InstCombiner::visitLShr(Bin
> }
>
> Instruction *InstCombiner::visitAShr(BinaryOperator &I) {
> - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> - if (Value *V =
> - SimplifyAShrInst(Op0, Op1, I.isExact(), SQ.getWithInstruction(&I)))
> + if (Value *V = SimplifyAShrInst(I.getOperand(0), I.getOperand(1), I.isExact(),
> + SQ.getWithInstruction(&I)))
> return replaceInstUsesWith(I, V);
>
> if (Instruction *X = foldShuffledBinop(I))
> @@ -832,6 +831,7 @@ Instruction *InstCombiner::visitAShr(Bin
> if (Instruction *R = commonShiftTransforms(I))
> return R;
>
> + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
> Type *Ty = I.getType();
> unsigned BitWidth = Ty->getScalarSizeInBits();
> const APInt *ShAmtAPInt;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180712/2e161a41/attachment.html>
More information about the llvm-commits
mailing list