summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow.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-SDivOverflow.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-SDivOverflow.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll b/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll
new file mode 100644
index 00000000000..cd61a10c5b8
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i.* 0} | count 2
+; PR2048
+
+define i32 @i(i32 %a) {
+ %tmp1 = sdiv i32 %a, -1431655765
+ %tmp2 = sdiv i32 %tmp1, 3
+ ret i32 %tmp2
+}
+
+define i8 @j(i8 %a) {
+ %tmp1 = sdiv i8 %a, 64
+ %tmp2 = sdiv i8 %tmp1, 3
+ ret i8 %tmp2
+}
OpenPOWER on IntegriCloud