diff options
| author | Jingyue Wu <jingyue@google.com> | 2015-12-18 21:36:30 +0000 |
|---|---|---|
| committer | Jingyue Wu <jingyue@google.com> | 2015-12-18 21:36:30 +0000 |
| commit | ba3ca76ed2f1a636d1502fa645f35f5a89d90b59 (patch) | |
| tree | d1ee2758de17df845565983de1165d52910cf774 /llvm/test/Transforms/NaryReassociate | |
| parent | 828eb2173bc57a0f44c15191e09f0fdf33c73044 (diff) | |
| download | bcm5719-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.ll | 17 |
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) |

