diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -559,6 +559,9 @@ CmdArgs.push_back( Args.MakeArgString("-plugin-opt=jobs=" + Twine(Parallelism))); + if (!CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL) + CmdArgs.push_back(Args.MakeArgString("-plugin-opt=no-opaque-pointers")); + // If an explicit debugger tuning argument appeared, pass it along. if (Arg *A = Args.getLastArg(options::OPT_gTune_Group, options::OPT_ggdbN_Group)) { diff --git a/clang/test/CodeGen/thinlto-inline-asm2.c b/clang/test/CodeGen/thinlto-inline-asm2.c --- a/clang/test/CodeGen/thinlto-inline-asm2.c +++ b/clang/test/CodeGen/thinlto-inline-asm2.c @@ -5,7 +5,7 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -flto=thin -emit-llvm-bc %t/b.c -o %t/b.bc // RUN: llvm-nm %t/a.bc | FileCheck %s --check-prefix=NM -// RUN: llvm-lto2 run %t/a.bc %t/b.bc -o %t/out -save-temps -r=%t/a.bc,ref,plx -r=%t/b.bc,ff_h264_cabac_tables,pl +// RUN: llvm-lto2 run -lto-opaque-pointers %t/a.bc %t/b.bc -o %t/out -save-temps -r=%t/a.bc,ref,plx -r=%t/b.bc,ff_h264_cabac_tables,pl // RUN: llvm-dis < %t/out.2.2.internalize.bc | FileCheck %s //--- a.c diff --git a/clang/test/Driver/arm-float-abi-lto.c b/clang/test/Driver/arm-float-abi-lto.c --- a/clang/test/Driver/arm-float-abi-lto.c +++ b/clang/test/Driver/arm-float-abi-lto.c @@ -2,9 +2,9 @@ // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -S -o - -emit-llvm -DCALL_LIB -DDEFINE_LIB | FileCheck %s -// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -flto=full -c -o %t.call_full.bc -DCALL_LIB -// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -flto=full -c -o %t.define_full.bc -DDEFINE_LIB -// RUN: llvm-lto2 run -o %t.lto_full -save-temps %t.call_full.bc %t.define_full.bc \ +// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=full -c -o %t.call_full.bc -DCALL_LIB +// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=full -c -o %t.define_full.bc -DDEFINE_LIB +// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.lto_full -save-temps %t.call_full.bc %t.define_full.bc \ // RUN: -r %t.call_full.bc,fn,px \ // RUN: -r %t.call_full.bc,fwrite,l \ // RUN: -r %t.call_full.bc,putchar,l \ @@ -14,9 +14,9 @@ // RUN: -r %t.define_full.bc,otherfn,px // RUN: llvm-dis %t.lto_full.0.4.opt.bc -o - | FileCheck %s -// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -flto=thin -c -o %t.call_thin.bc -DCALL_LIB -// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -flto=thin -c -o %t.define_thin.bc -DDEFINE_LIB -// RUN: llvm-lto2 run -o %t.lto_thin -save-temps %t.call_thin.bc %t.define_thin.bc \ +// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=thin -c -o %t.call_thin.bc -DCALL_LIB +// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=thin -c -o %t.define_thin.bc -DDEFINE_LIB +// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.lto_thin -save-temps %t.call_thin.bc %t.define_thin.bc \ // RUN: -r %t.call_thin.bc,fn,px \ // RUN: -r %t.call_thin.bc,fwrite,l \ // RUN: -r %t.call_thin.bc,putchar,l \ diff --git a/clang/test/Driver/lto-no-opaque-pointers.c b/clang/test/Driver/lto-no-opaque-pointers.c new file mode 100644 --- /dev/null +++ b/clang/test/Driver/lto-no-opaque-pointers.c @@ -0,0 +1,5 @@ +// UNSUPPORTED: enable-opaque-pointers +// RUN: %clang --target=x86_64-unknown-linux -### %s -flto 2> %t +// RUN: FileCheck %s < %t + +// CHECK: -plugin-opt=no-opaque-pointers diff --git a/clang/test/Driver/lto-opaque-pointers.c b/clang/test/Driver/lto-opaque-pointers.c new file mode 100644 --- /dev/null +++ b/clang/test/Driver/lto-opaque-pointers.c @@ -0,0 +1,5 @@ +// REQUIRES: enable-opaque-pointers +// RUN: %clang --target=x86_64-unknown-linux -### %s -flto 2> %t +// RUN: FileCheck %s < %t + +// CHECK-NOT: -plugin-opt=no-opaque-pointers diff --git a/clang/test/Driver/memtag_lto.c b/clang/test/Driver/memtag_lto.c --- a/clang/test/Driver/memtag_lto.c +++ b/clang/test/Driver/memtag_lto.c @@ -8,9 +8,9 @@ // RUN: %clang -O1 -target aarch64-unknown-linux -mllvm -stack-safety-print %s -S -o - 2>&1 | FileCheck %s // Full LTO -// RUN: %clang -O1 -target aarch64-unknown-linux -c %s -flto=full -o %t.ltonewpm1.bc -// RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -flto=full -o %t.ltonewpm2.bc -// RUN: llvm-lto2 run -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: %clang -O1 -target aarch64-unknown-linux -c %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm1.bc +// RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm2.bc +// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.ltonewpm1.bc,fn,plx \ // RUN: -r %t.ltonewpm1.bc,use,lx \ // RUN: -r %t.ltonewpm1.bc,use_local,plx \ @@ -19,9 +19,9 @@ // RUN: -r %t.ltonewpm2.bc,z, 2>&1 | FileCheck %s --allow-empty // Thin LTO, new PM -// RUN: %clang -O1 -target aarch64-unknown-linux -c %s -flto=thin -o %t.thinltonewpm1.bc -// RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -flto=thin -o %t.thinltonewpm2.bc -// RUN: llvm-lto2 run -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: %clang -O1 -target aarch64-unknown-linux -c %s -Xclang -opaque-pointers -flto=thin -o %t.thinltonewpm1.bc +// RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -Xclang -opaque-pointers -flto=thin -o %t.thinltonewpm2.bc +// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.thinltonewpm1.bc,fn,plx \ // RUN: -r %t.thinltonewpm1.bc,use,lx \ // RUN: -r %t.thinltonewpm1.bc,use_local,plx \ @@ -39,9 +39,9 @@ // RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -mllvm -stack-safety-print %s -S -o /dev/null 2>&1 | FileCheck %s -check-prefixes=SSI,XUNSAFE,YSAFE // Full LTO: both are safe. -// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c %s -flto=full -o %t.ltonewpm1.bc -// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c -DBUILD2 %s -flto=full -o %t.ltonewpm2.bc -// RUN: llvm-lto2 run -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm1.bc +// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c -DBUILD2 %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm2.bc +// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.ltonewpm1.bc,fn,plx \ // RUN: -r %t.ltonewpm1.bc,use,lx \ // RUN: -r %t.ltonewpm1.bc,use_local,plx \ @@ -50,9 +50,9 @@ // RUN: -r %t.ltonewpm2.bc,z, 2>&1 | FileCheck %s -check-prefixes=SSI,XSAFE,YSAFE // Thin LTO: both are safe. -// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c %s -flto=thin -o %t.thinltonewpm1.bc -// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c -DBUILD2 %s -flto=thin -o %t.thinltonewpm2.bc -// RUN: llvm-lto2 run -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c %s -Xclang -opaque-pointers -flto=thin -o %t.thinltonewpm1.bc +// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c -DBUILD2 %s -Xclang -opaque-pointers -flto=thin -o %t.thinltonewpm2.bc +// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.thinltonewpm1.bc,fn,plx \ // RUN: -r %t.thinltonewpm1.bc,use,lx \ // RUN: -r %t.thinltonewpm1.bc,use_local,plx \ diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -198,6 +198,7 @@ bool nostdlib; bool oFormatBinary; bool omagic; + bool opaquePointers; bool optEB = false; bool optEL = false; bool optimizeBBJumps; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1126,6 +1126,8 @@ config->nostdlib = args.hasArg(OPT_nostdlib); config->oFormatBinary = isOutputFormatBinary(args); config->omagic = args.hasFlag(OPT_omagic, OPT_no_omagic, false); + config->opaquePointers = args.hasFlag( + OPT_plugin_opt_opaque_pointers, OPT_plugin_opt_no_opaque_pointers, true); config->optRemarksFilename = args.getLastArgValue(OPT_opt_remarks_filename); config->optStatsFilename = args.getLastArgValue(OPT_plugin_opt_stats_file); diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -164,6 +164,8 @@ c.RunCSIRInstr = config->ltoCSProfileGenerate; c.PGOWarnMismatch = config->ltoPGOWarnMismatch; + c.OpaquePointers = config->opaquePointers; + if (config->emitLLVM) { c.PostInternalizeModuleHook = [](size_t task, const Module &m) { if (std::unique_ptr os = diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -626,6 +626,10 @@ def: J<"plugin-opt=obj-path=">, Alias, HelpText<"Alias for --lto-obj-path=">; +def plugin_opt_opaque_pointers: F<"plugin-opt=opaque-pointers">, + HelpText<"Use opaque pointers in IR during LTO (default)">; +def plugin_opt_no_opaque_pointers: F<"plugin-opt=no-opaque-pointers">, + HelpText<"Use typed pointers in IR during LTO">; def: J<"plugin-opt=opt-remarks-filename=">, Alias, HelpText<"Alias for --opt-remarks-filename">; diff --git a/lld/test/ELF/lto/discard-value-names.ll b/lld/test/ELF/lto/discard-value-names.ll --- a/lld/test/ELF/lto/discard-value-names.ll +++ b/lld/test/ELF/lto/discard-value-names.ll @@ -7,7 +7,7 @@ ; CHECK: @GlobalValueName ; CHECK: @foo(i32 %in) ; CHECK: somelabel: -; CHECK: %GV = load i32, i32* @GlobalValueName +; CHECK: %GV = load i32, ptr @GlobalValueName ; CHECK: %add = add i32 %in, %GV ; CHECK: ret i32 %add diff --git a/lld/test/ELF/lto/ltopasses-basic.ll b/lld/test/ELF/lto/ltopasses-basic.ll --- a/lld/test/ELF/lto/ltopasses-basic.ll +++ b/lld/test/ELF/lto/ltopasses-basic.ll @@ -12,6 +12,6 @@ } ; `@ctor` doesn't do anything and so the optimizer should kill it, leaving no ctors -; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer +; CHECK: @llvm.global_ctors = appending global [0 x { i32, ptr, ptr }] zeroinitializer ; MLLVM: Pass Arguments: diff --git a/lld/test/ELF/lto/type-merge.ll b/lld/test/ELF/lto/type-merge.ll --- a/lld/test/ELF/lto/type-merge.ll +++ b/lld/test/ELF/lto/type-merge.ll @@ -14,13 +14,13 @@ declare void @bar(i8*) ; CHECK: define void @foo() { -; CHECK-NEXT: call void @bar(i8* null) +; CHECK-NEXT: call void @bar(ptr null) ; CHECK-NEXT: ret void ; CHECK-NEXT: } -; CHECK: declare void @bar(i8*) +; CHECK: declare void @bar(ptr) ; CHECK: define void @zed() { -; CHECK-NEXT: call void bitcast (void (i8*)* @bar to void ()*)() +; CHECK-NEXT: call void @bar() ; CHECK-NEXT: ret void ; CHECK-NEXT: } diff --git a/lld/test/ELF/lto/type-merge2.ll b/lld/test/ELF/lto/type-merge2.ll --- a/lld/test/ELF/lto/type-merge2.ll +++ b/lld/test/ELF/lto/type-merge2.ll @@ -14,15 +14,12 @@ } declare void @bar(%zed*) -; CHECK: %zed = type { i8 } -; CHECK-NEXT: %zed.0 = type { i16 } - ; CHECK: define void @foo() { -; CHECK-NEXT: call void bitcast (void (%zed.0*)* @bar to void (%zed*)*)(%zed* null) +; CHECK-NEXT: call void @bar(ptr null) ; CHECK-NEXT: ret void ; CHECK-NEXT: } -; CHECK: define void @bar(%zed.0* %this) { -; CHECK-NEXT: store %zed.0* %this, %zed.0** null +; CHECK: define void @bar(ptr %this) { +; CHECK-NEXT: store ptr %this, ptr null ; CHECK-NEXT: ret void ; CHECK-NEXT: } diff --git a/lld/test/ELF/lto/wrap-unreferenced-before-codegen.test b/lld/test/ELF/lto/wrap-unreferenced-before-codegen.test --- a/lld/test/ELF/lto/wrap-unreferenced-before-codegen.test +++ b/lld/test/ELF/lto/wrap-unreferenced-before-codegen.test @@ -28,8 +28,9 @@ # RUN: llvm-mc -triple x86_64-elf -filetype=obj -o %t/malloc.o %t/malloc.s # RUN: ld.lld -shared -o %t/libmalloc.so -soname libmalloc.so %t/malloc.o # RUN: llvm-mc -triple x86_64-elf -filetype=obj -o %t/emutls.o %t/emutls.s -# RUN: llvm-as -o %t/usetls.bc %t/usetls.ll -# RUN: ld.lld -shared -o %t/libusetls.so %t/usetls.bc %t/libmalloc.so \ +# RUN: llvm-as -opaque-pointers=1 -o %t/usetls.bc %t/usetls.ll +# RUN: ld.lld --plugin-opt=opaque-pointers -shared -o %t/libusetls.so \ +# RUN: %t/usetls.bc %t/libmalloc.so \ # RUN: --start-lib %t/emutls.o -mllvm -emulated-tls --wrap malloc # RUN: llvm-objdump --dynamic-reloc --disassemble %t/libusetls.so | \ # RUN: FileCheck --check-prefix=USETLS-DISASM %s diff --git a/llvm/docs/OpaquePointers.rst b/llvm/docs/OpaquePointers.rst --- a/llvm/docs/OpaquePointers.rst +++ b/llvm/docs/OpaquePointers.rst @@ -205,6 +205,9 @@ Note that the ``CLANG_ENABLE_OPAQUE_POINTERS`` cmake option has no effect on the cc1 interface. +Usage for LTO can be disabled by passing ``-Wl,-plugin-opt=no-opaque-pointers`` +to the clang driver. + The next steps for the opaque pointer migration are: * Migrate Clang/LLVM tests to use opaque pointers. diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -177,6 +177,10 @@ /// Add FSAFDO discriminators. bool AddFSDiscriminator = false; + /// Use opaque pointer types. Used to call LLVMContext::setOpaquePointers + /// unless already set by the `-opaque-pointers` commandline option. + bool OpaquePointers = true; + /// If this field is set, LTO will write input file paths and symbol /// resolutions here in llvm-lto2 command line flag format. This can be /// used for testing and for running the LTO pipeline outside of the linker @@ -288,6 +292,8 @@ enableDebugTypeODRUniquing(); setDiagnosticHandler( std::make_unique(&DiagHandler), true); + if (!hasSetOpaquePointersValue()) + setOpaquePointers(C.OpaquePointers); } DiagnosticHandlerFunction DiagHandler; }; diff --git a/llvm/test/Analysis/StackSafetyAnalysis/ipa-alias.ll b/llvm/test/Analysis/StackSafetyAnalysis/ipa-alias.ll --- a/llvm/test/Analysis/StackSafetyAnalysis/ipa-alias.ll +++ b/llvm/test/Analysis/StackSafetyAnalysis/ipa-alias.ll @@ -33,7 +33,7 @@ ; RUN: -r %t.summ1.bc,PreemptableAliasWrite1,px \ ; RUN: -r %t.summ1.bc,Write1,px -; RUN: llvm-lto2 run %t.summ0.bc %t.summ1.bc -o %t.lto -stack-safety-print -stack-safety-run -save-temps -thinlto-threads 1 -O0 \ +; RUN: llvm-lto2 run -opaque-pointers=0 %t.summ0.bc %t.summ1.bc -o %t.lto -stack-safety-print -stack-safety-run -save-temps -thinlto-threads 1 -O0 \ ; RUN: $(cat %t.res.txt) \ ; RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK,GLOBAL,LTO diff --git a/llvm/test/Analysis/StackSafetyAnalysis/ipa.ll b/llvm/test/Analysis/StackSafetyAnalysis/ipa.ll --- a/llvm/test/Analysis/StackSafetyAnalysis/ipa.ll +++ b/llvm/test/Analysis/StackSafetyAnalysis/ipa.ll @@ -83,7 +83,7 @@ ; RUN: -r %t.summ1.bc,Write8,px \ ; RUN: -r %t.summ1.bc,WriteAndReturn8,px -; RUN: llvm-lto2 run %t.summ0.bc %t.summ1.bc -o %t.lto -stack-safety-print -stack-safety-run -save-temps -thinlto-threads 1 -O0 \ +; RUN: llvm-lto2 run -opaque-pointers=0 %t.summ0.bc %t.summ1.bc -o %t.lto -stack-safety-print -stack-safety-run -save-temps -thinlto-threads 1 -O0 \ ; RUN: $(cat %t.res.txt) \ ; RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK,GLOBAL,LTO diff --git a/llvm/test/LTO/Resolution/X86/alias-alias.ll b/llvm/test/LTO/Resolution/X86/alias-alias.ll --- a/llvm/test/LTO/Resolution/X86/alias-alias.ll +++ b/llvm/test/LTO/Resolution/X86/alias-alias.ll @@ -6,10 +6,10 @@ ; CHECK-NOT: alias ; CHECK: @c = global i32 1 -; CHECK-NEXT: @d = global i32* @a +; CHECK-NEXT: @d = global ptr @a ; CHECK-EMPTY: -; CHECK-NEXT: @a = weak alias i32, i32* @b -; CHECK-NEXT: @b = internal alias i32, i32* @c +; CHECK-NEXT: @a = weak alias i32, ptr @b +; CHECK-NEXT: @b = internal alias i32, ptr @c ; RES: 1.o{{$}} ; RES-NEXT: {{^}}-r={{.*}}1.o,c,p{{$}} diff --git a/llvm/test/LTO/Resolution/X86/comdat.ll b/llvm/test/LTO/Resolution/X86/comdat.ll --- a/llvm/test/LTO/Resolution/X86/comdat.ll +++ b/llvm/test/LTO/Resolution/X86/comdat.ll @@ -50,36 +50,36 @@ ; CHECK-DAG: @v1 = weak_odr global i32 42, comdat($c1) -; CHECK-DAG: @r11 = global i32* @v1{{$}} -; CHECK-DAG: @r12 = global i32 (i8*)* @f1{{$}} +; CHECK-DAG: @r11 = global ptr @v1{{$}} +; CHECK-DAG: @r12 = global ptr @f1{{$}} -; CHECK-DAG: @r21 = global i32* @v1{{$}} -; CHECK-DAG: @r22 = global i32 (i8*)* @f1{{$}} +; CHECK-DAG: @r21 = global ptr @v1{{$}} +; CHECK-DAG: @r22 = global ptr @f1{{$}} ; CHECK-DAG: @v1.1 = internal global i32 41, comdat($c2) -; CHECK-DAG: @a11 = alias i32, i32* @v1{{$}} -; CHECK-DAG: @a12 = alias i16, bitcast (i32* @v1 to i16*) +; CHECK-DAG: @a11 = alias i32, ptr @v1{{$}} +; CHECK-DAG: @a12 = alias i16, ptr @v1{{$}} -; CHECK-DAG: @a13 = alias i32 (i8*), i32 (i8*)* @f1{{$}} -; CHECK-DAG: @a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*) +; CHECK-DAG: @a13 = alias i32 (ptr), ptr @f1{{$}} +; CHECK-DAG: @a14 = alias i16, ptr @f1{{$}} -; CHECK-DAG: @a21 = alias i32, i32* @v1.1{{$}} -; CHECK-DAG: @a22 = alias i16, bitcast (i32* @v1.1 to i16*) +; CHECK-DAG: @a21 = alias i32, ptr @v1.1{{$}} +; CHECK-DAG: @a22 = alias i16, ptr @v1.1{{$}} -; CHECK-DAG: @a23 = alias i32 (i8*), i32 (i8*)* @f1.2{{$}} -; CHECK-DAG: @a24 = alias i16, bitcast (i32 (i8*)* @f1.2 to i16*) +; CHECK-DAG: @a23 = alias i32 (ptr), ptr @f1.2{{$}} +; CHECK-DAG: @a24 = alias i16, ptr @f1.2{{$}} -; CHECK: define weak_odr dso_local i32 @f1(i8* %0) comdat($c1) { +; CHECK: define weak_odr dso_local i32 @f1(ptr %0) comdat($c1) { ; CHECK-NEXT: bb10: ; CHECK-NEXT: br label %bb11{{$}} ; CHECK: bb11: ; CHECK-NEXT: ret i32 42 ; CHECK-NEXT: } -; CHECK: define internal i32 @f1.2(i8* %this) comdat($c2) { +; CHECK: define internal i32 @f1.2(ptr %this) comdat($c2) { ; CHECK-NEXT: bb20: -; CHECK-NEXT: store i8* %this, i8** null +; CHECK-NEXT: store ptr %this, ptr null ; CHECK-NEXT: br label %bb21 ; CHECK: bb21: ; CHECK-NEXT: ret i32 41 diff --git a/llvm/test/LTO/Resolution/X86/ifunc2.ll b/llvm/test/LTO/Resolution/X86/ifunc2.ll --- a/llvm/test/LTO/Resolution/X86/ifunc2.ll +++ b/llvm/test/LTO/Resolution/X86/ifunc2.ll @@ -6,14 +6,14 @@ target datalayout = "e-p:64:64" target triple = "x86_64-unknown-linux-gnu" -; CHECK: @foo = ifunc i32 (), i32 ()* ()* @foo_resolver.2 +; CHECK: @foo = ifunc i32 (), ptr @foo_resolver.2 @foo = ifunc i32 (), i32 ()* ()* @foo_resolver -; CHECK: define internal i32 ()* @foo_resolver.2() { -; CHECK-NEXT: ret i32 ()* inttoptr (i32 1 to i32 ()*) +; CHECK: define internal ptr @foo_resolver.2() { +; CHECK-NEXT: ret ptr inttoptr (i32 1 to ptr) define weak i32 ()* @foo_resolver() { ret i32 ()* inttoptr (i32 1 to i32 ()*) } -; CHECK: define i32 ()* @foo_resolver() { -; CHECK-NEXT: ret i32 ()* inttoptr (i32 2 to i32 ()*) +; CHECK: define ptr @foo_resolver() { +; CHECK-NEXT: ret ptr inttoptr (i32 2 to ptr) diff --git a/llvm/test/LTO/Resolution/X86/local-def-dllimport.ll b/llvm/test/LTO/Resolution/X86/local-def-dllimport.ll --- a/llvm/test/LTO/Resolution/X86/local-def-dllimport.ll +++ b/llvm/test/LTO/Resolution/X86/local-def-dllimport.ll @@ -13,7 +13,7 @@ $g = comdat any @g = global i8 42, comdat, !type !0 -; CHECK: define available_externally dllimport i8* @f() +; CHECK: define available_externally dllimport ptr @f() define available_externally dllimport i8* @f() { ret i8* @g } diff --git a/llvm/test/LTO/X86/Inputs/opaque-pointers.ll b/llvm/test/LTO/X86/Inputs/opaque-pointers.ll new file mode 100644 --- /dev/null +++ b/llvm/test/LTO/X86/Inputs/opaque-pointers.ll @@ -0,0 +1,7 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define i64 @foo(ptr %p) { + %t = load i64, ptr %p + ret i64 %t +} diff --git a/llvm/test/LTO/X86/cfi_jt_aliases.ll b/llvm/test/LTO/X86/cfi_jt_aliases.ll --- a/llvm/test/LTO/X86/cfi_jt_aliases.ll +++ b/llvm/test/LTO/X86/cfi_jt_aliases.ll @@ -46,7 +46,7 @@ ; CHECK-THIN-OD: jmp {{.*}}