diff options
| author | Philip Reames <listmail@philipreames.com> | 2015-12-19 02:38:22 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2015-12-19 02:38:22 +0000 |
| commit | 5d54689bcaeeca8845c57418ab63d7cdd0a7e38c (patch) | |
| tree | e489d1e563a7772cab0d70b5fe3a8d6b31138149 /llvm/test/Transforms/RewriteStatepointsForGC/constants.ll | |
| parent | 45784a79fc700da169f42b6d88cfb1f3b87c64dc (diff) | |
| download | bcm5719-llvm-5d54689bcaeeca8845c57418ab63d7cdd0a7e38c.tar.gz bcm5719-llvm-5d54689bcaeeca8845c57418ab63d7cdd0a7e38c.zip | |
[RS4GC] Remove an overly strong assertion
As shown by the included test case, it's reasonable to end up with constant references during base pointer calculation. The code actually handled this case just fine, we only had the assert to help isolate problems under the belief that constant references shouldn't be present in IR generated by managed frontends. This turned out to be wrong on two fronts: 1) Manual Jacobs is working on a language with constant references, and b) we found a case where the optimizer does create them in practice.
llvm-svn: 256079
Diffstat (limited to 'llvm/test/Transforms/RewriteStatepointsForGC/constants.ll')
| -rw-r--r-- | llvm/test/Transforms/RewriteStatepointsForGC/constants.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll b/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll index a30fdd7034a..8453d85528f 100644 --- a/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll @@ -57,4 +57,39 @@ entry: ret i8 %res } +; Even for source languages without constant references, we can +; see constants can show up along paths where the value is dead. +; This is particular relevant when computing bases of PHIs. +define i8 addrspace(1)* @test4(i8 addrspace(1)* %p) gc "statepoint-example" { +; CHECK-LABEL: @test4 +entry: + %is_null = icmp eq i8 addrspace(1)* %p, null + br i1 %is_null, label %split, label %join + +split: + call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) + %arg_value_addr.i = getelementptr inbounds i8, i8 addrspace(1)* %p, i64 8 + %arg_value_addr_casted.i = bitcast i8 addrspace(1)* %arg_value_addr.i to i8 addrspace(1)* addrspace(1)* + br label %join + +join: +; CHECK-LABEL: join +; CHECK: %addr2.base = + %addr2 = phi i8 addrspace(1)* addrspace(1)* [ %arg_value_addr_casted.i, %split ], [ inttoptr (i64 8 to i8 addrspace(1)* addrspace(1)*), %entry ] + ;; NOTE: This particular example can be jump-threaded, but in general, + ;; we can't, and have to deal with the resulting IR. + br i1 %is_null, label %early-exit, label %use + +early-exit: + ret i8 addrspace(1)* null + +use: +; CHECK-LABEL: use: +; CHECK: gc.statepoint +; CHECK: gc.relocate + call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) + %res = load i8 addrspace(1)*, i8 addrspace(1)* addrspace(1)* %addr2, align 1 + ret i8 addrspace(1)* %res +} + |

