summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/NaryReassociate
diff options
context:
space:
mode:
authorJingyue Wu <jingyue@google.com>2015-12-18 21:36:30 +0000
committerJingyue Wu <jingyue@google.com>2015-12-18 21:36:30 +0000
commitba3ca76ed2f1a636d1502fa645f35f5a89d90b59 (patch)
treed1ee2758de17df845565983de1165d52910cf774 /llvm/test/Transforms/NaryReassociate
parent828eb2173bc57a0f44c15191e09f0fdf33c73044 (diff)
downloadbcm5719-llvm-ba3ca76ed2f1a636d1502fa645f35f5a89d90b59.tar.gz
bcm5719-llvm-ba3ca76ed2f1a636d1502fa645f35f5a89d90b59.zip
[NaryReassociate] allow candidate to have a different type
Summary: If Candiadte may have a different type from GEP, we should bitcast or pointer cast it to GEP's type so that the later RAUW doesn't complain. Added a test in nary-gep.ll Reviewers: tra, meheff Subscribers: mcrosier, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D15618 llvm-svn: 256035
Diffstat (limited to 'llvm/test/Transforms/NaryReassociate')
-rw-r--r--llvm/test/Transforms/NaryReassociate/NVPTX/nary-gep.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/Transforms/NaryReassociate/NVPTX/nary-gep.ll b/llvm/test/Transforms/NaryReassociate/NVPTX/nary-gep.ll
index 92fbd20d298..be219404d5b 100644
--- a/llvm/test/Transforms/NaryReassociate/NVPTX/nary-gep.ll
+++ b/llvm/test/Transforms/NaryReassociate/NVPTX/nary-gep.ll
@@ -123,4 +123,21 @@ define void @reassociate_gep_128(float* %a, i128 %i, i128 %j) {
ret void
}
+%struct.complex = type { float, float }
+
+declare void @bar(%struct.complex*)
+
+define void @different_types(%struct.complex* %input, i64 %i) {
+; CHECK-LABEL: @different_types(
+ %t1 = getelementptr %struct.complex, %struct.complex* %input, i64 %i
+ call void @bar(%struct.complex* %t1)
+ %j = add i64 %i, 5
+ %t2 = getelementptr %struct.complex, %struct.complex* %input, i64 %j, i32 0
+; CHECK: [[cast:[^ ]+]] = bitcast %struct.complex* %t1 to float*
+; CHECK-NEXT: %t2 = getelementptr float, float* [[cast]], i64 10
+; CHECK-NEXT: call void @foo(float* %t2)
+ call void @foo(float* %t2)
+ ret void
+}
+
declare void @llvm.assume(i1)
OpenPOWER on IntegriCloud