The type of shirt-right (logical or arithemetic) should remain unchanged
when transforming "X << C1 >> C2" into "X << (C1-C2)"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169209
91177308-0d34-0410-b5e6-
96231b3b80d8
New->setHasNoUnsignedWrap(Orig->hasNoUnsignedWrap());
} else {
Constant *Amt = ConstantInt::get(VarX->getType(), ShrAmt - ShlAmt);
New->setHasNoUnsignedWrap(Orig->hasNoUnsignedWrap());
} else {
Constant *Amt = ConstantInt::get(VarX->getType(), ShrAmt - ShlAmt);
- New = BinaryOperator::CreateLShr(VarX, Amt);
+ New = isLshr ? BinaryOperator::CreateLShr(VarX, Amt) :
+ BinaryOperator::CreateAShr(VarX, Amt);
}
return InsertNewInstWith(New, *Shl);
}
return InsertNewInstWith(New, *Shl);
%or = or i32 %shl, 1
ret i32 %or
; CHECK: @test60
%or = or i32 %shl, 1
ret i32 %or
; CHECK: @test60