summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Generic
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2017-03-19 16:50:25 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2017-03-19 16:50:25 +0000
commit8424df7dea5a9eb26a10f3a664c5b60f8dea622b (patch)
tree0030c8eb6c567ac6a7e10927e2d67806f8a36180 /llvm/test/CodeGen/Generic
parent5fa1b9a12f32caeff3b0d22a0cc6f389e371dbf9 (diff)
downloadbcm5719-llvm-8424df7dea5a9eb26a10f3a664c5b60f8dea622b.tar.gz
bcm5719-llvm-8424df7dea5a9eb26a10f3a664c5b60f8dea622b.zip
Fix constant folding of fp2int to large integers
We make the assumption in most of our constant folding code that a fp2int will target an integer of 128-bits or less, calling the APFloat::convertToInteger with only uint64_t[2] of raw bits for the result. Fuzz testing (PR24662) showed that we don't handle other cases at all, resulting in stack overflows and all sorts of crashes. This patch uses the APSInt version of APFloat::convertToInteger instead to better handle such cases. Differential Revision: https://reviews.llvm.org/D31074 llvm-svn: 298226
Diffstat (limited to 'llvm/test/CodeGen/Generic')
-rw-r--r--llvm/test/CodeGen/Generic/pr24662.ll12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Generic/pr24662.ll b/llvm/test/CodeGen/Generic/pr24662.ll
new file mode 100644
index 00000000000..5a10b9cb0ac
--- /dev/null
+++ b/llvm/test/CodeGen/Generic/pr24662.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -fast-isel
+; RUN: llc < %s
+
+define i60 @PR24662a() {
+ ret i60 trunc (i670010 fptoui(float 0x400D9999A0000000 to i670010) to i60)
+}
+
+define i60 @PR24662b() {
+ %1 = fptoui float 0x400D9999A0000000 to i670010
+ %2 = trunc i670010 %1 to i60
+ ret i60 %2
+}
OpenPOWER on IntegriCloud