summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-28 21:43:51 +0000
committerJustin Lebar <jlebar@google.com>2016-10-28 21:43:51 +0000
commit468bf732096c813a76fbad0ab204b0cf7269f82a (patch)
treed549b65bdbaa974473d3b84f05ac2edba0b902b1 /llvm/test
parentd66d37cbd96f3e69d4b764fd02c3d7d4e66ee7c3 (diff)
downloadbcm5719-llvm-468bf732096c813a76fbad0ab204b0cf7269f82a.tar.gz
bcm5719-llvm-468bf732096c813a76fbad0ab204b0cf7269f82a.zip
Don't claim the udiv created in BypassSlowDivision is exact.
Summary: In BypassSlowDivision's short-dividend path, we would create e.g. udiv exact i32 %a, %b "exact" here means that we are asserting that %a is a multiple of %b. But we have no reason to believe this must be true -- this is just a bug, as far as I can tell. Reviewers: tra Subscribers: jholewinski, llvm-commits Differential Revision: https://reviews.llvm.org/D26097 llvm-svn: 285459
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-not-exact.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-not-exact.ll b/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-not-exact.ll
new file mode 100644
index 00000000000..9db23d639a4
--- /dev/null
+++ b/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-not-exact.ll
@@ -0,0 +1,16 @@
+; RUN: opt -S -codegenprepare < %s | FileCheck %s
+
+target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
+target triple = "nvptx64-nvidia-cuda"
+
+; Check that the smaller-width division that the BypassSlowDivision pass
+; creates is not marked as "exact" (that is, it doesn't claim that the
+; numerator is a multiple of the denominator).
+;
+; CHECK-LABEL: @test
+define void @test(i64 %a, i64 %b, i64* %retptr) {
+ ; CHECK: udiv i32
+ %d = sdiv i64 %a, %b
+ store i64 %d, i64* %retptr
+ ret void
+}
OpenPOWER on IntegriCloud