summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-02-13 04:19:26 +0000
committerJuergen Ributzka <juergen@apple.com>2014-02-13 04:19:26 +0000
commit525637575cedf7d760e64af6ab0deaf846ca3d11 (patch)
tree7f03f99827b77dc84e7f819fb12dd8a1dd89b36e /test/CodeGen
parentf79b906492f1be5e3846cebd34316431991d9762 (diff)
downloadllvm-525637575cedf7d760e64af6ab0deaf846ca3d11.tar.gz
llvm-525637575cedf7d760e64af6ab0deaf846ca3d11.tar.bz2
llvm-525637575cedf7d760e64af6ab0deaf846ca3d11.tar.xz
[DAG] Fix the recognition of opaque constants in the SelectionDAGBuilder.
This fix checks the original LLVM IR node to identify opaque constants by looking for the bitcast-constant pattern. Originally we looked at the generated SDNode, but this might lead to incorrect results. The SDNode could have been generated by an constant expression that was folded to a constant. This fixes <rdar://problem/16050719> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/X86/opaque-constant-asm.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGen/X86/opaque-constant-asm.ll b/test/CodeGen/X86/opaque-constant-asm.ll
new file mode 100644
index 0000000000..ab3d4e8b16
--- /dev/null
+++ b/test/CodeGen/X86/opaque-constant-asm.ll
@@ -0,0 +1,13 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
+; This tests makes sure that we not mistake the bitcast inside the asm statement
+; as an opaque constant. If we do, then the compilation will simply fail.
+
+%struct2 = type <{ i32, i32, i32, i32 }>
+%union.anon = type { [2 x i64], [4 x i32] }
+%struct1 = type { i32, %union.anon }
+
+define void @test() {
+; CHECK: #ASM $16
+ call void asm sideeffect "#ASM $0", "n"(i32 ptrtoint (i32* getelementptr inbounds (%struct2* bitcast (%union.anon* getelementptr inbounds (%struct1* null, i32 0, i32 1) to %struct2*), i32 0, i32 2) to i32))
+ ret void
+}