1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

rdar://12329730 (2nd part, revised)

The type of shirt-right (logical or arithemetic) should remain unchanged 
when transforming  "X << C1 >> C2" into "X << (C1-C2)"

llvm-svn: 169209
This commit is contained in:
Shuxin Yang 2012-12-04 03:28:32 +00:00
parent 684c7e3c6b
commit ac685f44b0
2 changed files with 3 additions and 2 deletions

View File

@ -876,7 +876,8 @@ Value *InstCombiner::SimplifyShrShlDemandedBits(Instruction *Shr,
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);

View File

@ -723,7 +723,7 @@ define i32 @test60(i32 %x) {
%or = or i32 %shl, 1
ret i32 %or
; CHECK: @test60
; CHECK: lshr i32 %x, 3
; CHECK: ashr i32 %x, 3
}