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 module 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 module 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. 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/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 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) 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" {