diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2014-07-02 06:42:13 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2014-07-02 06:42:13 +0000 |
| commit | f28e2a4282c586ab41f39c177ca9bebc9244c53f (patch) | |
| tree | 1a69867fb73c64ada122852a375d355c7705e60d /llvm/test/Transforms | |
| parent | c1bedac3bdeadec448266cf372c2437e8e3692b8 (diff) | |
| download | bcm5719-llvm-f28e2a4282c586ab41f39c177ca9bebc9244c53f.tar.gz bcm5719-llvm-f28e2a4282c586ab41f39c177ca9bebc9244c53f.zip | |
InstCombine: Optimize x/INT_MIN to x==INT_MIN
The result of x/INT_MIN is either 0 or 1, we can just use an icmp
instead.
llvm-svn: 212167
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/sub.ll | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/test/Transforms/InstCombine/sub.ll b/llvm/test/Transforms/InstCombine/sub.ll index 5ff0ed5b40c..67b7c4996b0 100644 --- a/llvm/test/Transforms/InstCombine/sub.ll +++ b/llvm/test/Transforms/InstCombine/sub.ll @@ -450,9 +450,9 @@ define <2 x i32> @test37(<2 x i32> %A) { %sub = sub nsw <2 x i32> zeroinitializer, %div ret <2 x i32> %sub ; CHECK-LABEL: @test37( -; CHECK-NEXT: [[DIV:%.*]] = sdiv <2 x i32> %A, <i32 -2147483648, i32 -2147483648> -; CHECK-NEXT: [[SUB:%.*]] = sub nsw <2 x i32> zeroinitializer, %div -; CHECK-NEXT: ret <2 x i32> [[SUB]] +; CHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> %A, <i32 -2147483648, i32 -2147483648> +; CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[ICMP]] to <2 x i32> +; CHECK-NEXT: ret <2 x i32> [[SEXT]] } define i32 @test38(i32 %A) { @@ -460,7 +460,7 @@ define i32 @test38(i32 %A) { %sub = sub nsw i32 0, %div ret i32 %sub ; CHECK-LABEL: @test38( -; CHECK-NEXT: [[DIV:%.*]] = sdiv i32 %A, -2147483648 -; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 0, [[DIV]] -; CHECK-NEXT: ret i32 [[SUB]] +; CHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 %A, -2147483648 +; CHECK-NEXT: [[SEXT:%.*]] = sext i1 [[ICMP]] to i32 +; CHECK-NEXT: ret i32 [[SEXT]] } |

