summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2016-12-07 19:29:18 +0000
committerMichael Kuperstein <mkuper@google.com>2016-12-07 19:29:18 +0000
commit18092cf2c30efe6f4021b6ab29a581e172fa898d (patch)
tree05dc939fc6bc553ec0704724ac0de6603dfb0a77 /llvm/test/CodeGen
parentbfff254a10f7eb708a2eb6f8e61d67b404c6beb3 (diff)
downloadbcm5719-llvm-18092cf2c30efe6f4021b6ab29a581e172fa898d.tar.gz
bcm5719-llvm-18092cf2c30efe6f4021b6ab29a581e172fa898d.zip
[X86] Do not assume "ri" instructions always have an immediate operand
The second operand of an "ri" instruction may be an immediate, but it may also be a globalvariable, so we should make any assumptions. This fixes PR31271. Differential Revision: https://reviews.llvm.org/D27481 llvm-svn: 288964
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/pr31271.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/pr31271.ll b/llvm/test/CodeGen/X86/pr31271.ll
new file mode 100644
index 00000000000..e38e176b476
--- /dev/null
+++ b/llvm/test/CodeGen/X86/pr31271.ll
@@ -0,0 +1,20 @@
+; RUN: llc -mtriple=i386-unknown-linux-gnu < %s | FileCheck %s
+
+@c = external global [1 x i32], align 4
+
+; CHECK-LABEL: fn1
+; CHECK: leal c(%eax), %ecx
+define void @fn1(i32 %k) {
+ %g = getelementptr inbounds [1 x i32], [1 x i32]* @c, i32 0, i32 %k
+ %cmp = icmp ne i32* undef, %g
+ %z = zext i1 %cmp to i32
+ store i32 %z, i32* undef, align 4
+ %cmp2 = icmp eq i32* %g, null
+ br i1 %cmp2, label %u, label %r
+
+u:
+ unreachable
+
+r:
+ ret void
+}
OpenPOWER on IntegriCloud