Index: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp =================================================================== --- lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -371,26 +371,10 @@ // An incoming argument to the function is a base pointer return BaseDefiningValueResult(I, true); - // We shouldn't see the address of a global as a vector value? - assert(!isa(I) && - "unexpected global variable found in base of vector"); - - // inlining could possibly introduce phi node that contains - // undef if callee has multiple returns - if (isa(I)) - // utterly meaningless, but useful for dealing with partially optimized - // code. + if (isa(I)) + // Constant vectors consist only of constant pointers. return BaseDefiningValueResult(I, true); - // Due to inheritance, this must be _after_ the global variable and undef - // checks - if (Constant *Con = dyn_cast(I)) { - assert(!isa(I) && !isa(I) && - "order of checks wrong!"); - assert(Con->isNullValue() && "null is the only case which makes sense"); - return BaseDefiningValueResult(Con, true); - } - if (isa(I)) return BaseDefiningValueResult(I, true); Index: test/Transforms/RewriteStatepointsForGC/constants.ll =================================================================== --- test/Transforms/RewriteStatepointsForGC/constants.ll +++ test/Transforms/RewriteStatepointsForGC/constants.ll @@ -92,4 +92,13 @@ ret i8 addrspace(1)* %res } - +; Globals don't move and thus don't get relocated +define i8 addrspace(1)* @test5(i1 %always_true) gc "statepoint-example" { +; CHECK-LABEL: @test5 +; CHECK: gc.statepoint +; CHECK-NEXT: %res = extractelement <2 x i8 addrspace(1)*> , i32 0 +entry: + call token (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 = extractelement <2 x i8 addrspace(1)*> , i32 0 + ret i8 addrspace(1)* %res +}