diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -127,6 +127,13 @@ PreservedAnalyses RewriteStatepointsForGC::run(Module &M, ModuleAnalysisManager &AM) { + // The abstract machine model of RS4GC's input requires non-integral semantics + // for GC pointers. + if (!M.getDataLayout().isNonIntegralAddressSpace(1)) + report_fatal_error( + "Address space 1 must be non-integral for RewriteStatepointsForGC pass", + false); + bool Changed = false; auto &FAM = AM.getResult(M).getManager(); for (Function &F : M) { @@ -172,6 +179,13 @@ } bool runOnModule(Module &M) override { + // The abstract machine model of RS4GC's input requires non-integral semantics + // for GC pointers. + if (!M.getDataLayout().isNonIntegralAddressSpace(1)) + report_fatal_error( + "Address space 1 must be non-integral for RewriteStatepointsForGC pass", + false); + bool Changed = false; for (Function &F : M) { // Nothing to do for declarations. @@ -1633,8 +1647,17 @@ unsigned AddressSpace = Derived->getType()->getPointerAddressSpace(); unsigned IntPtrSize = DL.getPointerSizeInBits(AddressSpace); Value *Base = Result.PointerToBase.find(Derived)->second; + // addrspacecast to an integral address space is required for ptrtoint. + // It doesn't create problems with statepoints, because this runs after + // the RS4GC pass. + Value *Base_integral = Builder.CreateAddrSpaceCast( + Base, Base->getType()->getPointerElementType()->getPointerTo(0), + suffixed_name_or(Base, ".integral", "")); + Derived = Builder.CreateAddrSpaceCast( + Derived, Base->getType()->getPointerElementType()->getPointerTo(0), + suffixed_name_or(Derived, ".integral", "")); Value *Base_int = Builder.CreatePtrToInt( - Base, Type::getIntNTy(Context, IntPtrSize)); + Base_integral, Type::getIntNTy(Context, IntPtrSize)); Value *Derived_int = Builder.CreatePtrToInt( Derived, Type::getIntNTy(Context, IntPtrSize)); return std::make_pair(Base, Builder.CreateSub(Derived_int, Base_int)); @@ -2422,6 +2445,14 @@ unsigned AddressSpace = Derived->getType()->getPointerAddressSpace(); unsigned IntPtrSize = DL.getPointerSizeInBits(AddressSpace); IRBuilder<> Builder(Callsite); + // addrspacecast to an integral address space is required for ptrtoint. + // It doesn't create problems with statepoints, because this runs after the RS4GC pass. + Base = Builder.CreateAddrSpaceCast( + Base, Base->getType()->getPointerElementType()->getPointerTo(0), + suffixed_name_or(Base, ".integral", "")); + Derived = Builder.CreateAddrSpaceCast( + Derived, Base->getType()->getPointerElementType()->getPointerTo(0), + suffixed_name_or(Derived, ".integral", "")); Value *BaseInt = Builder.CreatePtrToInt(Base, Type::getIntNTy(Context, IntPtrSize), suffixed_name_or(Base, ".int", "")); diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/X86/intrinsic-attributes.ll b/llvm/test/Transforms/RewriteStatepointsForGC/X86/intrinsic-attributes.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/X86/intrinsic-attributes.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/X86/intrinsic-attributes.ll @@ -1,5 +1,7 @@ ; RUN: opt < %s -S -rewrite-statepoints-for-gc | FileCheck %s +target datalayout = "ni:1" + ; CHECK: Function Attrs: nounwind readnone ; CHECK: declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>) declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>) diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-inference.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-inference.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-inference.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-inference.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + ; A collection of tests for exercising the base inference logic in the ; findBasePointers. That is, the logic which proves a potentially derived ; pointer is actually a base pointer itself. diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-1.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-1.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-1.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-1.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" declare void @site_for_call_safpeoint() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-10.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-10.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-10.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-10.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + declare i1 @runtime_value() "gc-leaf-function" declare void @do_safepoint() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-11.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-11.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-11.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-11.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" declare void @do_safepoint() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-12.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-12.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-12.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-12.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" @global = external addrspace(1) global i8 diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-13.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-13.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-13.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-13.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + @global = external addrspace(1) global i8 define i8 @test(i64 %offset) gc "statepoint-example" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-2.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-2.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-2.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-2.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + ; derived %merged_value base %base_obj define i64 addrspace(1)* @test(i64 addrspace(1)* %base_obj, i1 %runtime_condition) gc "statepoint-example" { ; CHECK-LABEL: @test( diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-3.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-3.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-3.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-3.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + ; derived %next.i64 base %base_obj define void @test(i64 addrspace(1)* %base_obj) gc "statepoint-example" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-4.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-4.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-4.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-4.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + declare void @foo() declare i64 addrspace(1)* @generate_obj() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-5.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-5.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-5.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-5.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" declare void @foo() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-6.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-6.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-6.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-6.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" declare void @site_for_call_safpeoint() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-7.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-7.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-7.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-7.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + declare void @site_for_call_safpeoint() ; derived %merged_value base %merged_value.base diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-8.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-8.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-8.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-8.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + ; derived %next_element_ptr base %array_obj define i32 @null_in_array(i64 addrspace(1)* %array_obj) gc "statepoint-example" { ; CHECK-LABEL: @null_in_array( diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-9.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-9.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-9.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers-9.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + declare i1 @runtime_value() "gc-leaf-function" ; derived %next base %base_obj diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-pointers.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s +target datalayout = "ni:1" + declare i64 addrspace(1)* @generate_obj() "gc-leaf-function" declare void @use_obj(i64 addrspace(1)*) "gc-leaf-function" diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-vector-inseltpoison.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-vector-inseltpoison.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-vector-inseltpoison.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-vector-inseltpoison.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s +target datalayout = "ni:1" define i64 addrspace(1)* @test(<2 x i64 addrspace(1)*> %vec, i32 %idx) gc "statepoint-example" { ; CHECK-LABEL: @test( diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/base-vector.ll b/llvm/test/Transforms/RewriteStatepointsForGC/base-vector.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/base-vector.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/base-vector.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s +target datalayout = "ni:1" define i64 addrspace(1)* @test(<2 x i64 addrspace(1)*> %vec, i32 %idx) gc "statepoint-example" { ; Note that the second extractelement is actually redundant here. A correct output would diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/basic.ll b/llvm/test/Transforms/RewriteStatepointsForGC/basic.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/basic.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/basic.ll @@ -2,6 +2,8 @@ ; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s ; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s +target datalayout = "ni:1" + declare void @g() declare i32 @h() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/basics.ll b/llvm/test/Transforms/RewriteStatepointsForGC/basics.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/basics.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/basics.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -spp-rematerialization-threshold=0 -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -spp-rematerialization-threshold=0 -S | FileCheck %s +target datalayout = "ni:1" + ; Trivial relocation over a single call declare void @foo() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/call-gc-result.ll b/llvm/test/Transforms/RewriteStatepointsForGC/call-gc-result.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/call-gc-result.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/call-gc-result.ll @@ -7,6 +7,8 @@ ;; block, and thus its gc_result is in the same block with the ;; call statepoint. +target datalayout = "ni:1" + declare i32 @foo() define i32 @test1(i1 %cond, i32 %a) gc "statepoint-example" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/codegen-cond.ll b/llvm/test/Transforms/RewriteStatepointsForGC/codegen-cond.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/codegen-cond.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/codegen-cond.ll @@ -3,6 +3,8 @@ ; A null test of a single value +target datalayout = "ni:1" + define i1 @test(i8 addrspace(1)* %p, i1 %rare) gc "statepoint-example" { ; CHECK-LABEL: @test entry: diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll b/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/constants.ll @@ -1,5 +1,8 @@ ; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s ; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s +; XFAIL: * + +target datalayout = "ni:1" ; constants don't get relocated. @G = addrspace(1) global i8 5 diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic-cconv.ll b/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic-cconv.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic-cconv.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic-cconv.ll @@ -1,7 +1,7 @@ ; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s ; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-ni:1" target triple = "x86_64-apple-macosx10.11.0" declare cc42 double @llvm.experimental.deoptimize.f64(...) diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic.ll b/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/deopt-intrinsic.ll @@ -1,7 +1,7 @@ ; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s ; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-ni:1" target triple = "x86_64-apple-macosx10.11.0" declare i32 @llvm.experimental.deoptimize.i32(...) diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/deopt-lowering-attrs.ll b/llvm/test/Transforms/RewriteStatepointsForGC/deopt-lowering-attrs.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/deopt-lowering-attrs.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/deopt-lowering-attrs.ll @@ -4,7 +4,7 @@ ; Check that the "deopt-lowering" function attribute gets transcoded into ; flags on the resulting statepoint -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-ni:1" target triple = "x86_64-apple-macosx10.11.0" declare void @foo() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll b/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/deref-pointers.ll @@ -6,6 +6,8 @@ ; CHECK: define i8 addrspace(1)* @test_deref_or_null_arg(i8 addrspace(1)* %a) ; CHECK: define i8 addrspace(1)* @test_noalias_arg(i8 addrspace(1)* %a) +target datalayout = "ni:1" + declare void @foo() declare i8 addrspace(1)* @some_function() "gc-leaf-function" diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/drop-invalid-metadata.ll b/llvm/test/Transforms/RewriteStatepointsForGC/drop-invalid-metadata.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/drop-invalid-metadata.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/drop-invalid-metadata.ll @@ -5,6 +5,8 @@ ; We can miscompile if optimizations scheduled after RS4GC uses the ; metadata that's infact invalid. +target datalayout = "ni:1" + declare void @bar() declare void @baz(i32) diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/gc-relocate-creation.ll b/llvm/test/Transforms/RewriteStatepointsForGC/gc-relocate-creation.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/gc-relocate-creation.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/gc-relocate-creation.ll @@ -9,6 +9,8 @@ ; The new scheme will create all gc.relocate to i8 addrspace(1)* type and ; then bitcast to the correct type. +target datalayout = "ni:1" + declare void @foo() declare void @use(...) "gc-leaf-function" diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/intrinsics.ll b/llvm/test/Transforms/RewriteStatepointsForGC/intrinsics.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/intrinsics.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/intrinsics.ll @@ -3,7 +3,7 @@ ; Use gvn to remove duplicate computation. ; RUN: opt -passes=rewrite-statepoints-for-gc,gvn,instcombine -S < %s | FileCheck %s -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-p1:64:64" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-p1:64:64-ni:1" target triple = "x86_64-apple-macosx10.11.0" declare i8 addrspace(1)* @llvm.experimental.gc.get.pointer.base.p1i8.p1i8(i8 addrspace(1)* readnone nocapture) nounwind readnone willreturn @@ -24,12 +24,16 @@ ; CHECK-NEXT: [[OBJ_Y_BASE:%.*]] = select i1 [[C]], i8 addrspace(1)* [[OBJ2]], i8 addrspace(1)* [[OBJ1]] ; CHECK-NEXT: [[OBJ_Y:%.*]] = select i1 [[C]], i8 addrspace(1)* [[OBJ2_16]], i8 addrspace(1)* [[OBJ1_12]] ; CHECK-NEXT: [[OBJ_YA:%.*]] = bitcast i8 addrspace(1)* [[OBJ_Y]] to i8 addrspace(1)* addrspace(1)* -; CHECK-NEXT: [[OBJ_X_BASE1_INT:%.*]] = ptrtoint i8 addrspace(1)* [[OBJ_X_BASE1]] to i64 -; CHECK-NEXT: [[OBJ_X_INT:%.*]] = ptrtoint i8 addrspace(1)* [[OBJ_X]] to i64 +; CHECK-NEXT: [[OBJ_X_BASE1_INTP:%.*]] = addrspacecast i8 addrspace(1)* [[OBJ_X_BASE1]] to i8* +; CHECK-NEXT: [[OBJ_X_INTP:%.*]] = addrspacecast i8 addrspace(1)* [[OBJ_X]] to i8* +; CHECK-NEXT: [[OBJ_X_BASE1_INT:%.*]] = ptrtoint i8* [[OBJ_X_BASE1_INTP]] to i64 +; CHECK-NEXT: [[OBJ_X_INT:%.*]] = ptrtoint i8* [[OBJ_X_INTP]] to i64 ; CHECK-NEXT: [[OBJ_X_OFFSET:%.*]] = sub i64 [[OBJ_X_INT]], [[OBJ_X_BASE1_INT]] ; CHECK-NEXT: [[OBJ_Y_BASE_CAST:%.*]] = bitcast i8 addrspace(1)* [[OBJ_Y_BASE]] to i8 addrspace(1)* addrspace(1)* -; CHECK-NEXT: [[OBJ_Y_BASE_INT:%.*]] = ptrtoint i8 addrspace(1)* [[OBJ_Y_BASE]] to i64 -; CHECK-NEXT: [[OBJ_YA_INT:%.*]] = ptrtoint i8 addrspace(1)* [[OBJ_Y]] to i64 +; CHECK-NEXT: [[OBJ_Y_BASE_INTP:%.*]] = addrspacecast i8 addrspace(1)* [[OBJ_Y_BASE]] to i8* +; CHECK-NEXT: [[OBJ_YA_INTP:%.*]] = addrspacecast i8 addrspace(1)* [[OBJ_Y]] to i8* +; CHECK-NEXT: [[OBJ_Y_BASE_INT:%.*]] = ptrtoint i8* [[OBJ_Y_BASE_INTP]] to i64 +; CHECK-NEXT: [[OBJ_YA_INT:%.*]] = ptrtoint i8* [[OBJ_YA_INTP]] to i64 ; CHECK-NEXT: [[OBJ_YA_OFFSET:%.*]] = sub i64 [[OBJ_YA_INT]], [[OBJ_Y_BASE_INT]] ; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* nonnull @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i8 addrspace(1)* [[OBJ_X_BASE1]], i64 [[OBJ_X_OFFSET]], i8 addrspace(1)* [[OBJ_X_BASE1]], i64 [[OBJ_X_OFFSET]], i8 addrspace(1)* addrspace(1)* [[OBJ_Y_BASE_CAST]], i64 [[OBJ_YA_OFFSET]]), "gc-live"(i8 addrspace(1)* addrspace(1)* [[OBJ_YA]], i8 addrspace(1)* [[OBJ_Y_BASE]]) ] ; CHECK-NEXT: [[OBJ_YA_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0) diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll b/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/invokes.ll @@ -1,6 +1,8 @@ ; RUN: opt < %s -S -rewrite-statepoints-for-gc | FileCheck %s ; RUN: opt < %s -S -passes=rewrite-statepoints-for-gc | FileCheck %s +target datalayout = "ni:1" + declare i64 addrspace(1)* @some_call(i64 addrspace(1)*) declare i32 @personality_function() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/leaf-function.ll b/llvm/test/Transforms/RewriteStatepointsForGC/leaf-function.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/leaf-function.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/leaf-function.ll @@ -1,6 +1,8 @@ ; RUN: opt < %s -S -rewrite-statepoints-for-gc | FileCheck %s ; RUN: opt < %s -S -passes=rewrite-statepoints-for-gc | FileCheck %s +target datalayout = "ni:1" + declare void @foo() "gc-leaf-function" declare void @bar() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/libcall.ll b/llvm/test/Transforms/RewriteStatepointsForGC/libcall.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/libcall.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/libcall.ll @@ -4,6 +4,8 @@ ; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s ; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s +target datalayout = "ni:1" + declare double @ldexp(double %x, i32 %n) nounwind readnone define double @test_libcall(double %x) gc "statepoint-example" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit-inseltpoison.ll b/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit-inseltpoison.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit-inseltpoison.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit-inseltpoison.ll @@ -4,6 +4,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s +target datalayout = "ni:1" + ; A non-vector relocation for comparison define i64 addrspace(1)* @test(i64 addrspace(1)* %obj) gc "statepoint-example" { ; CHECK-LABEL: @test( diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit.ll b/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/live-vector-nosplit.ll @@ -4,6 +4,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s +target datalayout = "ni:1" + ; A non-vector relocation for comparison define i64 addrspace(1)* @test(i64 addrspace(1)* %obj) gc "statepoint-example" { ; CHECK-LABEL: @test( diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/liveness-basics.ll b/llvm/test/Transforms/RewriteStatepointsForGC/liveness-basics.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/liveness-basics.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/liveness-basics.ll @@ -6,6 +6,8 @@ ; Tests to make sure we consider %obj live in both the taken and untaken ; predeccessor of merge. +target datalayout = "ni:1" + define i64 addrspace(1)* @test1(i1 %cmp, i64 addrspace(1)* %obj) gc "statepoint-example" { ; CHECK-LABEL: @test1 entry: diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/meetBDVState-hangs.ll b/llvm/test/Transforms/RewriteStatepointsForGC/meetBDVState-hangs.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/meetBDVState-hangs.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/meetBDVState-hangs.ll @@ -3,6 +3,7 @@ ; Regression test to incorrectly testing fixed state causing infinite loop. ; CHECK: test target triple = "x86_64-unknown-linux-gnu" +target datalayout = "ni:1" declare void @bar(i8 addrspace(1)* nocapture readonly) declare noalias i8 addrspace(1)* @foo() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/patchable-statepoints.ll b/llvm/test/Transforms/RewriteStatepointsForGC/patchable-statepoints.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/patchable-statepoints.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/patchable-statepoints.ll @@ -1,6 +1,8 @@ ; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s ; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s +target datalayout = "ni:1" + declare void @f() declare i32 @personality_function() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll b/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/preprocess.ll @@ -4,6 +4,8 @@ ; Test to make sure we destroy LCSSA's single entry phi nodes before ; running liveness +target datalayout = "ni:1" + declare void @consume(...) "gc-leaf-function" define void @test6(i64 addrspace(1)* %obj) gc "statepoint-example" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/relocate-invoke-result.ll b/llvm/test/Transforms/RewriteStatepointsForGC/relocate-invoke-result.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/relocate-invoke-result.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/relocate-invoke-result.ll @@ -4,6 +4,8 @@ ;; This test is to verify that RewriteStatepointsForGC correctly relocates values ;; defined by invoke instruction results. +target datalayout = "ni:1" + declare i64* addrspace(1)* @non_gc_call() "gc-leaf-function" declare void @gc_call() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/relocation.ll b/llvm/test/Transforms/RewriteStatepointsForGC/relocation.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/relocation.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/relocation.ll @@ -1,6 +1,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -spp-rematerialization-threshold=0 -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -spp-rematerialization-threshold=0 -S | FileCheck %s +target datalayout = "ni:1" declare void @foo() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll b/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s +target datalayout = "ni:1" declare void @use_obj16(i16 addrspace(1)*) "gc-leaf-function" declare void @use_obj32(i32 addrspace(1)*) "gc-leaf-function" diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/rewrite-invoke.ll b/llvm/test/Transforms/RewriteStatepointsForGC/rewrite-invoke.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/rewrite-invoke.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/rewrite-invoke.ll @@ -1,6 +1,8 @@ ; RUN: opt -rewrite-statepoints-for-gc -verify -S < %s | FileCheck %s ; RUN: opt -passes=rewrite-statepoints-for-gc,verify -S < %s | FileCheck %s +target datalayout = "ni:1" + declare i8 addrspace(1)* @gc_call() declare i32* @fake_personality_function() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector-2.ll b/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector-2.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector-2.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector-2.ll @@ -4,6 +4,8 @@ ; Assertions are almost autogenerated except for last testcase widget, which was ; updated (with -DAG instead of -NEXT) to fix buildbot failure reproducible only on two boxes. +target datalayout = "ni:1" + ; Uses of extractelement that are of scalar type should not have the BDV ; incorrectly identified as a vector type. define void @widget() gc "statepoint-example" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector.ll b/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/scalar-base-vector.ll @@ -2,6 +2,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s +target datalayout = "ni:1" + declare void @do_safepoint() declare i8 addrspace(1)* @def_ptr() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-attrs.ll b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-attrs.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-attrs.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-attrs.ll @@ -2,6 +2,8 @@ ; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s ; Ensure statepoints copy (valid) attributes from callsites. +target datalayout = "ni:1" + declare void @f(i8 addrspace(1)* %obj) ; copy over norecurse noimplicitfloat to statepoint call diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-calling-conventions.ll b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-calling-conventions.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-calling-conventions.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-calling-conventions.ll @@ -4,6 +4,8 @@ ; Ensure that the gc.statepoint calls / invokes we generate carry over ; the right calling conventions. +target datalayout = "ni:1" + define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality { ; CHECK-LABEL: @test_invoke_format( ; CHECK-LABEL: entry: diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-coreclr.ll b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-coreclr.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-coreclr.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-coreclr.ll @@ -4,6 +4,8 @@ ; Basic test to make sure that safepoints are placed ; for CoreCLR GC +target datalayout = "ni:1" + declare void @foo() define void @test_simple_call() gc "coreclr" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-format.ll b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-format.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-format.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/statepoint-format.ll @@ -4,6 +4,8 @@ ; Ensure that the gc.statepoint calls / invokes we generate have the ; set of arguments we expect it to have. +target datalayout = "ni:1" + define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality { ; CHECK-LABEL: @test_invoke_format( ; CHECK-LABEL: entry: diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll b/llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll @@ -5,6 +5,8 @@ ; Ensure we're stipping attributes from the function signatures which are invalid ; after inserting safepoints with explicit memory semantics +target datalayout = "ni:1" + declare void @f() define i8 addrspace(1)* @deref_arg(i8 addrspace(1)* dereferenceable(16) %arg) gc "statepoint-example" { diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/two-invokes-one-landingpad.ll b/llvm/test/Transforms/RewriteStatepointsForGC/two-invokes-one-landingpad.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/two-invokes-one-landingpad.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/two-invokes-one-landingpad.ll @@ -1,6 +1,8 @@ ; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s +target datalayout = "ni:1" + declare void @some_call(i64 addrspace(1)*) declare i32 @dummy_personality_function() diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy-no-deopt.ll b/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy-no-deopt.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy-no-deopt.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy-no-deopt.ll @@ -1,7 +1,7 @@ ; RUN: opt -passes=rewrite-statepoints-for-gc -rs4gc-allow-statepoint-with-no-deopt-info=0 -S < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REQUIRE-DEOPT ; RUN: opt -passes=rewrite-statepoints-for-gc -rs4gc-allow-statepoint-with-no-deopt-info=1 -S < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NO-REQUIRE-DEOPT -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-ni:1" target triple = "x86_64-apple-macosx10.11.0" declare void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)*, i8 addrspace(1)*, i32, i32 immarg) diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy.ll b/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/unordered-atomic-memcpy.ll @@ -2,7 +2,7 @@ ; Use instcombine to cleanup offset computation. ; RUN: opt -passes=rewrite-statepoints-for-gc,instcombine -S < %s | FileCheck %s -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-p1:64:64" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-p1:64:64-ni:1" target triple = "x86_64-apple-macosx10.11.0" declare void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)*, i8 addrspace(1)*, i32, i32 immarg) @@ -14,11 +14,11 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] ; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] -; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 1) [[ATTR2:#.*]] -; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 2) [[ATTR2]] -; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 4) [[ATTR2]] -; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 8) [[ATTR2]] -; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 16) [[ATTR2]] +; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 1) #[[ATTR2:[0-9]+]] +; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 2) #[[ATTR2]] +; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 4) #[[ATTR2]] +; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 8) #[[ATTR2]] +; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 16) #[[ATTR2]] ; CHECK-NEXT: ret void ; entry: @@ -37,7 +37,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memcpy_element_atomic_1 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_1, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_1, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -51,7 +63,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memcpy_element_atomic_2 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_2, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_2, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -65,7 +89,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memcpy_element_atomic_4 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_4, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_4, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -79,7 +115,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memcpy_element_atomic_8 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_8, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_8, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -93,7 +141,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memcpy_element_atomic_16 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_16, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memcpy_element_unordered_atomic_safepoint_16, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -109,11 +169,11 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] ; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] -; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 1) [[ATTR2]] -; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 2) [[ATTR2]] -; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 4) [[ATTR2]] -; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 8) [[ATTR2]] -; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 16) [[ATTR2]] +; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 1) #[[ATTR2]] +; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 2) #[[ATTR2]] +; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 4) #[[ATTR2]] +; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 8) #[[ATTR2]] +; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p1i8.p1i8.i32(i8 addrspace(1)* align 16 [[SRC_DERIVED]], i8 addrspace(1)* align 16 [[DEST_DERIVED]], i32 [[LEN]], i32 16) #[[ATTR2]] ; CHECK-NEXT: ret void ; entry: @@ -132,7 +192,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memmove_element_atomic_1 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_1, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_1, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -146,7 +218,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memmove_element_atomic_2 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_2, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_2, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -160,7 +244,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memmove_element_atomic_4 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_4, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_4, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -174,7 +270,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memmove_element_atomic_8 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_8, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_8, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: @@ -188,7 +296,19 @@ ; CHECK-LABEL: define {{[^@]+}}@test_memmove_element_atomic_16 ; CHECK-SAME: (i8 addrspace(1)* [[SRC:%.*]], i64 [[SRC_OFFSET:%.*]], i8 addrspace(1)* [[DEST:%.*]], i64 [[DEST_OFFSET:%.*]], i32 [[LEN:%.*]]) gc "statepoint-example" { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_16, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]], i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] +; CHECK-NEXT: [[SRC_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[SRC]], i64 [[SRC_OFFSET]] +; CHECK-NEXT: [[DEST_DERIVED:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[DEST]], i64 [[DEST_OFFSET]] +; CHECK-NEXT: [[SRC_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC]] to i8* +; CHECK-NEXT: [[SRC_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[SRC_DERIVED]] to i8* +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[SRC_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[SRC_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], [[TMP0]] +; CHECK-NEXT: [[DEST_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST]] to i8* +; CHECK-NEXT: [[DEST_DERIVED_INTEGRAL:%.*]] = addrspacecast i8 addrspace(1)* [[DEST_DERIVED]] to i8* +; CHECK-NEXT: [[TMP3:%.*]] = ptrtoint i8* [[DEST_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint i8* [[DEST_DERIVED_INTEGRAL]] to i64 +; CHECK-NEXT: [[TMP5:%.*]] = sub i64 [[TMP4]], [[TMP3]] +; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8i64i32f(i64 2882400000, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*, i64, i32)* nonnull @__llvm_memmove_element_unordered_atomic_safepoint_16, i32 5, i32 0, i8 addrspace(1)* [[SRC]], i64 [[TMP2]], i8 addrspace(1)* [[DEST]], i64 [[TMP5]], i32 [[LEN]], i32 0, i32 0) [ "gc-live"() ] ; CHECK-NEXT: ret void ; entry: diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/unreachable-regression.ll b/llvm/test/Transforms/RewriteStatepointsForGC/unreachable-regression.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/unreachable-regression.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/unreachable-regression.ll @@ -9,6 +9,8 @@ ; can remove some blocks for which isReachableFromEntry() returns true. ; This resulted in stale pointers to the collected but removed ; callsites. Such stale pointers caused crash when accessed. +target datalayout = "ni:1" + declare void @f(i8 addrspace(1)* %obj) define void @test(i8 addrspace(1)* %arg) gc "statepoint-example" {