From 36146afb9676a81866acff882f76661891af3f3b Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Fri, 1 Feb 2013 07:59:33 +0000 Subject: [PATCH] Revert r174152. The shift amount may overflow and in that case this transformation is illegal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174156 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../InstCombine/InstCombineShifts.cpp | 6 ------ test/Transforms/InstCombine/shift.ll | 20 ------------------- 2 files changed, 26 deletions(-) diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp index f9e94f225f2..8cf76e5e8a9 100644 --- a/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -709,12 +709,6 @@ Instruction *InstCombiner::visitShl(BinaryOperator &I) { match(I.getOperand(1), m_Constant(C2))) return BinaryOperator::CreateShl(ConstantExpr::getShl(C1, C2), A); - // shl (c1 , add(y , c2)) -> (shl (shl(c1, c2)), y) - if (match(I.getOperand(0), m_Constant(C1)) && - match(I.getOperand(1), m_Add(m_Value(A), m_Constant(C2)))) { - return BinaryOperator::CreateShl(ConstantExpr::getShl(C1, C2), A); - } - return 0; } diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index 117a9060b4a..41f8aa9ee81 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -745,23 +745,3 @@ define i32 @test62(i32 %x) { ; CHECK: @test62 ; CHECK: ashr exact i32 %x, 3 } - -; CHECK: @test63 -; CHECK: shl <4 x i32> , %B -define <4 x i32> @test63(i32 %n) { -entry: - %K = insertelement <4 x i32> undef, i32 %n, i32 0 - %B = shufflevector <4 x i32> %K, <4 x i32> undef, <4 x i32> zeroinitializer - %A = add <4 x i32> %B, - %T = shl <4 x i32> , %A - ret <4 x i32> %T -} - -; CHECK: @test64 -; CHECK: shl i32 524288, %n -define i32 @test64(i32 %n) { -entry: - %A = add i32 %n, 19 - %T = shl i32 1 , %A - ret i32 %T -} -- 2.34.1