diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-11-30 03:42:12 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-11-30 03:42:12 +0000 |
commit | e1196d6d3efabfc58103acc9076ad946d3574a04 (patch) | |
tree | cf179d0e8850608a3ca59d46b4729c512df0d6cf /test/Transforms/InstCombine/apint-sub.ll | |
parent | 4a69bade2385022ca776edc22150f3b750cdf23c (diff) | |
download | llvm-e1196d6d3efabfc58103acc9076ad946d3574a04.tar.gz llvm-e1196d6d3efabfc58103acc9076ad946d3574a04.tar.bz2 llvm-e1196d6d3efabfc58103acc9076ad946d3574a04.tar.xz |
Instcombine was illegally transforming -X/C into X/-C when either X or C
overflowed on negation. This commit checks to make sure that neithe C nor X
overflows. This requires that the RHS of X (a subtract instruction) be a
constant integer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60275 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/apint-sub.ll')
-rw-r--r-- | test/Transforms/InstCombine/apint-sub.ll | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/Transforms/InstCombine/apint-sub.ll b/test/Transforms/InstCombine/apint-sub.ll index 12f366de7f..2ff763c9f5 100644 --- a/test/Transforms/InstCombine/apint-sub.ll +++ b/test/Transforms/InstCombine/apint-sub.ll @@ -3,7 +3,7 @@ ; ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: grep -v {sub i19 %Cok, %Bok} | not grep sub +; RUN: grep -v {sub i19 %Cok, %Bok} | grep -v {sub i25 0, %Aok} | not grep sub ; END. define i23 @test1(i23 %A) { @@ -107,8 +107,10 @@ define i51 @test16(i51 %A) { ret i51 %Y } -define i25 @test17(i25 %A) { - %B = sub i25 0, %A ; <i25> [#uses=1] +; Can't fold subtract here because negation it might oveflow. +; PR3142 +define i25 @test17(i25 %Aok) { + %B = sub i25 0, %Aok ; <i25> [#uses=1] %C = sdiv i25 %B, 1234 ; <i25> [#uses=1] ret i25 %C } |