summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-02-18 22:48:05 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-02-18 22:48:05 +0000
commitfefd0202c9e5f5a3b12d713d321fe9844ab79b7c (patch)
tree70f7edc63f331a91d84cc9694c1379e68cdd53c3 /llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll
parentdec89733a77205f7d2c69ce12ea30e4aa3acfcee (diff)
downloadbcm5719-llvm-fefd0202c9e5f5a3b12d713d321fe9844ab79b7c.tar.gz
bcm5719-llvm-fefd0202c9e5f5a3b12d713d321fe9844ab79b7c.zip
Correctly fold divide-by-constant, even when faced with overflow.
llvm-svn: 47287
Diffstat (limited to 'llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll b/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll
new file mode 100644
index 00000000000..0e260c465e3
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {sdiv i8 \%a, 9}
+; PR2048
+
+define i8 @i(i8 %a) {
+ %tmp1 = sdiv i8 %a, -3
+ %tmp2 = sdiv i8 %tmp1, -3
+ ret i8 %tmp2
+}
+
OpenPOWER on IntegriCloud