[PATCH] D21741: Add test for D21736 + D21737.
This revision was automatically updated to reflect the committed changes. Closed by commit rL287689: Add test for D21736. (authored by koriakin). Changed prior to commit: https://reviews.llvm.org/D21741?vs=61922=78918#toc Repository: rL LLVM https://reviews.llvm.org/D21741 Files: cfe/trunk/test/Profile/c-indirect-call.c cfe/trunk/test/Profile/cxx-indirect-call.cpp Index: cfe/trunk/test/Profile/cxx-indirect-call.cpp === --- cfe/trunk/test/Profile/cxx-indirect-call.cpp +++ cfe/trunk/test/Profile/cxx-indirect-call.cpp @@ -1,6 +1,6 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck %s +// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple x86_64-apple-macosx10.9 | FileCheck %s void (*foo) (void); Index: cfe/trunk/test/Profile/c-indirect-call.c === --- cfe/trunk/test/Profile/c-indirect-call.c +++ cfe/trunk/test/Profile/c-indirect-call.c @@ -1,16 +1,22 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=NOEXT %s +// RUN: %clang_cc1 -triple s390x-ibm-linux -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=EXT %s void (*foo)(void); int main(void) { -// CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 -// CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 -// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0) -// CHECK-NEXT: call void [[REG1]]() +// NOEXT: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 +// NOEXT-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 +// NOEXT-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0) +// NOEXT-NEXT: call void [[REG1]]() +// EXT: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 +// EXT-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 +// EXT-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 zeroext 0) +// EXT-NEXT: call void [[REG1]]() foo(); return 0; } -// CHECK: declare void @__llvm_profile_instrument_target(i64, i8*, i32) +// NOEXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32) +// EXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 zeroext) Index: cfe/trunk/test/Profile/cxx-indirect-call.cpp === --- cfe/trunk/test/Profile/cxx-indirect-call.cpp +++ cfe/trunk/test/Profile/cxx-indirect-call.cpp @@ -1,6 +1,6 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck %s +// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple x86_64-apple-macosx10.9 | FileCheck %s void (*foo) (void); Index: cfe/trunk/test/Profile/c-indirect-call.c === --- cfe/trunk/test/Profile/c-indirect-call.c +++ cfe/trunk/test/Profile/c-indirect-call.c @@ -1,16 +1,22 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=NOEXT %s +// RUN: %clang_cc1 -triple s390x-ibm-linux -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=EXT %s void (*foo)(void); int main(void) { -// CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 -// CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 -// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0) -//
[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
This revision was automatically updated to reflect the committed changes. Closed by commit rL287688: [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else. (authored by koriakin). Changed prior to commit: https://reviews.llvm.org/D21737?vs=75550=78917#toc Repository: rL LLVM https://reviews.llvm.org/D21737 Files: cfe/trunk/lib/CodeGen/BackendUtil.cpp Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp === --- cfe/trunk/lib/CodeGen/BackendUtil.cpp +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp @@ -298,9 +298,13 @@ PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts); - // Figure out TargetLibraryInfo. + // Figure out TargetLibraryInfo. This needs to be added to MPM and FPM + // manually (and not via PMBuilder), since some passes (eg. InstrProfiling) + // are inserted before PMBuilder ones - they'd get the default-constructed + // TLI with an unknown target otherwise. Triple TargetTriple(TheModule->getTargetTriple()); - PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts); + std::unique_ptr TLII( + createTLII(TargetTriple, CodeGenOpts)); switch (Inlining) { case CodeGenOptions::NoInlining: @@ -333,6 +337,8 @@ PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; + MPM.add(new TargetLibraryInfoWrapperPass(*TLII)); + // Add target-specific passes that need to run as early as possible. if (TM) PMBuilder.addExtension( @@ -416,6 +422,7 @@ } // Set up the per-function pass manager. + FPM.add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) FPM.add(createVerifierPass()); Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp === --- cfe/trunk/lib/CodeGen/BackendUtil.cpp +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp @@ -298,9 +298,13 @@ PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts); - // Figure out TargetLibraryInfo. + // Figure out TargetLibraryInfo. This needs to be added to MPM and FPM + // manually (and not via PMBuilder), since some passes (eg. InstrProfiling) + // are inserted before PMBuilder ones - they'd get the default-constructed + // TLI with an unknown target otherwise. Triple TargetTriple(TheModule->getTargetTriple()); - PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts); + std::unique_ptr TLII( + createTLII(TargetTriple, CodeGenOpts)); switch (Inlining) { case CodeGenOptions::NoInlining: @@ -333,6 +337,8 @@ PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; + MPM.add(new TargetLibraryInfoWrapperPass(*TLII)); + // Add target-specific passes that need to run as early as possible. if (TM) PMBuilder.addExtension( @@ -416,6 +422,7 @@ } // Set up the per-function pass manager. + FPM.add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) FPM.add(createVerifierPass()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
koriakin added inline comments. Comment at: lib/CodeGen/BackendUtil.cpp:422 // Set up the per-function pass manager. + FPM.add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) mehdi_amini wrote: > This seems unnecessary? This ensures FPM passes get the right TLI as well - since I'm removing the PMBuilder.LIbraryInfo assignment, they would otherwise get the default-constructed ones. Or should I keep the assignment instead, and only special-case MPM? Repository: rL LLVM https://reviews.llvm.org/D21737 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
koriakin updated this revision to Diff 75550. koriakin added a comment. Added a comment explaining the reason. Repository: rL LLVM https://reviews.llvm.org/D21737 Files: lib/CodeGen/BackendUtil.cpp Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -295,9 +295,13 @@ PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts); - // Figure out TargetLibraryInfo. + // Figure out TargetLibraryInfo. This needs to be added to MPM and FPM + // manually (and not via PMBuilder), since some passes (eg. InstrProfiling) + // are inserted before PMBuilder ones - they'd get the default-constructed + // TLI with an unknown target otherwise. Triple TargetTriple(TheModule->getTargetTriple()); - PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts); + std::unique_ptr TLII( + createTLII(TargetTriple, CodeGenOpts)); switch (Inlining) { case CodeGenOptions::NoInlining: @@ -330,6 +334,8 @@ PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; + MPM.add(new TargetLibraryInfoWrapperPass(*TLII)); + // Add target-specific passes that need to run as early as possible. if (TM) PMBuilder.addExtension( @@ -413,6 +419,7 @@ } // Set up the per-function pass manager. + FPM.add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) FPM.add(createVerifierPass()); Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -295,9 +295,13 @@ PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts); - // Figure out TargetLibraryInfo. + // Figure out TargetLibraryInfo. This needs to be added to MPM and FPM + // manually (and not via PMBuilder), since some passes (eg. InstrProfiling) + // are inserted before PMBuilder ones - they'd get the default-constructed + // TLI with an unknown target otherwise. Triple TargetTriple(TheModule->getTargetTriple()); - PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts); + std::unique_ptr TLII( + createTLII(TargetTriple, CodeGenOpts)); switch (Inlining) { case CodeGenOptions::NoInlining: @@ -330,6 +334,8 @@ PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; + MPM.add(new TargetLibraryInfoWrapperPass(*TLII)); + // Add target-specific passes that need to run as early as possible. if (TM) PMBuilder.addExtension( @@ -413,6 +419,7 @@ } // Set up the per-function pass manager. + FPM.add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) FPM.add(createVerifierPass()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
koriakin added a comment. In https://reviews.llvm.org/D21737#468861, @mehdi_amini wrote: > Missing test. This is tested by https://reviews.llvm.org/D21741 (along with https://reviews.llvm.org/D21736). Repository: rL LLVM https://reviews.llvm.org/D21737 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21741: Add test for D21736 and D21737.
koriakin created this revision. koriakin added reviewers: vsk, betulb. koriakin added a subscriber: cfe-commits. koriakin set the repository for this revision to rL LLVM. Repository: rL LLVM http://reviews.llvm.org/D21741 Files: test/Profile/c-indirect-call.c test/Profile/cxx-indirect-call.cpp Index: test/Profile/cxx-indirect-call.cpp === --- test/Profile/cxx-indirect-call.cpp +++ test/Profile/cxx-indirect-call.cpp @@ -1,6 +1,6 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck %s +// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple x86_64-apple-macosx10.9 | FileCheck %s void (*foo) (void); Index: test/Profile/c-indirect-call.c === --- test/Profile/c-indirect-call.c +++ test/Profile/c-indirect-call.c @@ -1,16 +1,22 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=NOEXT %s +// RUN: %clang_cc1 -triple s390x-ibm-linux -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=EXT %s void (*foo)(void); int main(void) { -// CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 -// CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 -// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0) -// CHECK-NEXT: call void [[REG1]]() +// NOEXT: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 +// NOEXT-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 +// NOEXT-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0) +// NOEXT-NEXT: call void [[REG1]]() +// EXT: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 +// EXT-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 +// EXT-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 zeroext 0) +// EXT-NEXT: call void [[REG1]]() foo(); return 0; } -// CHECK: declare void @__llvm_profile_instrument_target(i64, i8*, i32) +// NOEXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32) +// EXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 zeroext) Index: test/Profile/cxx-indirect-call.cpp === --- test/Profile/cxx-indirect-call.cpp +++ test/Profile/cxx-indirect-call.cpp @@ -1,6 +1,6 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple %itanium_abi_triple | FileCheck %s +// RUN: %clang_cc1 %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling -fexceptions -fcxx-exceptions -triple x86_64-apple-macosx10.9 | FileCheck %s void (*foo) (void); Index: test/Profile/c-indirect-call.c === --- test/Profile/c-indirect-call.c +++ test/Profile/c-indirect-call.c @@ -1,16 +1,22 @@ // Check the value profiling instrinsics emitted by instrumentation. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=NOEXT %s +// RUN: %clang_cc1 -triple s390x-ibm-linux -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck --check-prefix=EXT %s void (*foo)(void); int main(void) { -// CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 -// CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 -// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0) -// CHECK-NEXT: call void [[REG1]]() +// NOEXT: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 +// NOEXT-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 +// NOEXT-NEXT: call void
[PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
koriakin created this revision. koriakin added a reviewer: asl. koriakin added a subscriber: cfe-commits. koriakin set the repository for this revision to rL LLVM. Currently, TargetLibraryInfoWrapperPass is inserted by PMBuilder. However, some passes are inserted manually before the PMBuilder ones - if any of them happens to use TargetLibraryInfoWrapperPass, it'll get a default-constructed one, with an unknown target triple. This happens to InstrProfiling in D21736, breaking it. Repository: rL LLVM http://reviews.llvm.org/D21737 Files: lib/CodeGen/BackendUtil.cpp Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -329,7 +329,8 @@ // Figure out TargetLibraryInfo. Triple TargetTriple(TheModule->getTargetTriple()); - PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts); + std::unique_ptr TLII( + createTLII(TargetTriple, CodeGenOpts)); switch (Inlining) { case CodeGenOptions::NoInlining: @@ -364,6 +365,7 @@ PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; legacy::PassManager *MPM = getPerModulePasses(); + MPM->add(new TargetLibraryInfoWrapperPass(*TLII)); // If we are performing a ThinLTO importing compile, invoke the LTO // pipeline and pass down the in-memory module summary index. @@ -454,6 +456,7 @@ // Set up the per-function pass manager. legacy::FunctionPassManager *FPM = getPerFunctionPasses(); + FPM->add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) FPM->add(createVerifierPass()); Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -329,7 +329,8 @@ // Figure out TargetLibraryInfo. Triple TargetTriple(TheModule->getTargetTriple()); - PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts); + std::unique_ptr TLII( + createTLII(TargetTriple, CodeGenOpts)); switch (Inlining) { case CodeGenOptions::NoInlining: @@ -364,6 +365,7 @@ PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; legacy::PassManager *MPM = getPerModulePasses(); + MPM->add(new TargetLibraryInfoWrapperPass(*TLII)); // If we are performing a ThinLTO importing compile, invoke the LTO // pipeline and pass down the in-memory module summary index. @@ -454,6 +456,7 @@ // Set up the per-function pass manager. legacy::FunctionPassManager *FPM = getPerFunctionPasses(); + FPM->add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) FPM->add(createVerifierPass()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19589: [clang] [Builtin] Make __builtin_thread_pointer target-independent.
This revision was automatically updated to reflect the committed changes. Closed by commit rL272893: [Builtin] Make __builtin_thread_pointer target-independent. (authored by koriakin). Changed prior to commit: http://reviews.llvm.org/D19589?vs=55216=60966#toc Repository: rL LLVM http://reviews.llvm.org/D19589 Files: cfe/trunk/include/clang/Basic/Builtins.def cfe/trunk/include/clang/Basic/BuiltinsAArch64.def cfe/trunk/include/clang/Basic/BuiltinsARM.def cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/builtins-arm64.c Index: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def === --- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def +++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def @@ -60,6 +60,5 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") -BUILTIN(__builtin_thread_pointer, "v*", "nc") #undef BUILTIN Index: cfe/trunk/include/clang/Basic/BuiltinsARM.def === --- cfe/trunk/include/clang/Basic/BuiltinsARM.def +++ cfe/trunk/include/clang/Basic/BuiltinsARM.def @@ -20,7 +20,6 @@ // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") -BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") Index: cfe/trunk/include/clang/Basic/Builtins.def === --- cfe/trunk/include/clang/Basic/Builtins.def +++ cfe/trunk/include/clang/Basic/Builtins.def @@ -467,6 +467,7 @@ BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") +BUILTIN(__builtin_thread_pointer, "v*", "nc") // GCC exception builtins BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! Index: cfe/trunk/test/CodeGen/builtins-arm64.c === --- cfe/trunk/test/CodeGen/builtins-arm64.c +++ cfe/trunk/test/CodeGen/builtins-arm64.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s +// RUN: %clang_cc1 -triple arm64-unknown-linux -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s void f0(void *a, void *b) { __clear_cache(a,b); Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp === --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp @@ -2158,6 +2158,13 @@ case Builtin::BI__builtin_canonicalizef: case Builtin::BI__builtin_canonicalizel: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::canonicalize)); + + case Builtin::BI__builtin_thread_pointer: { +if (!getContext().getTargetInfo().isTLSSupported()) + CGM.ErrorUnsupported(E, "__builtin_thread_pointer"); +// Fall through - it's already mapped to the intrinsic by GCCBuiltin. +break; + } } // If this is an alias for a lib function (e.g. __builtin_sin), emit Index: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def === --- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def +++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def @@ -60,6 +60,5 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") -BUILTIN(__builtin_thread_pointer, "v*", "nc") #undef BUILTIN Index: cfe/trunk/include/clang/Basic/BuiltinsARM.def === --- cfe/trunk/include/clang/Basic/BuiltinsARM.def +++ cfe/trunk/include/clang/Basic/BuiltinsARM.def @@ -20,7 +20,6 @@ // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") -BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") Index: cfe/trunk/include/clang/Basic/Builtins.def === --- cfe/trunk/include/clang/Basic/Builtins.def +++ cfe/trunk/include/clang/Basic/Builtins.def @@ -467,6 +467,7 @@ BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") +BUILTIN(__builtin_thread_pointer, "v*", "nc") // GCC exception builtins BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! Index: cfe/trunk/test/CodeGen/builtins-arm64.c === --- cfe/trunk/test/CodeGen/builtins-arm64.c +++ cfe/trunk/test/CodeGen/builtins-arm64.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s +// RUN: %clang_cc1 -triple arm64-unknown-linux -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s void f0(void *a, void *b)
Re: [PATCH] D19891: [clang] [SystemZ] Add -mbackchain option.
This revision was automatically updated to reflect the committed changes. Closed by commit rL268575: [SystemZ] Add -mbackchain option. (authored by koriakin). Changed prior to commit: http://reviews.llvm.org/D19891?vs=56072=56223#toc Repository: rL LLVM http://reviews.llvm.org/D19891 Files: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Frontend/CodeGenOptions.def cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/CodeGen/mbackchain-2.c cfe/trunk/test/CodeGen/mbackchain-3.c cfe/trunk/test/CodeGen/mbackchain.c Index: cfe/trunk/lib/CodeGen/CGCall.cpp === --- cfe/trunk/lib/CodeGen/CGCall.cpp +++ cfe/trunk/lib/CodeGen/CGCall.cpp @@ -1714,6 +1714,8 @@ if (CodeGenOpts.StackRealignment) FuncAttrs.addAttribute("stackrealign"); +if (CodeGenOpts.Backchain) + FuncAttrs.addAttribute("backchain"); // Add target-cpu and target-features attributes to functions. If // we have a decl for the function and it has a target attribute then Index: cfe/trunk/lib/Driver/Tools.cpp === --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -1655,6 +1655,12 @@ } } +void Clang::AddSystemZTargetArgs(const ArgList , + ArgStringList ) const { + if (Args.hasFlag(options::OPT_mbackchain, options::OPT_mno_backchain, false)) +CmdArgs.push_back("-mbackchain"); +} + static const char *getSystemZTargetCPU(const ArgList ) { if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) return A->getValue(); @@ -4241,6 +4247,10 @@ AddSparcTargetArgs(Args, CmdArgs); break; + case llvm::Triple::systemz: +AddSystemZTargetArgs(Args, CmdArgs); +break; + case llvm::Triple::x86: case llvm::Triple::x86_64: AddX86TargetArgs(Args, CmdArgs); Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp === --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp @@ -782,6 +782,8 @@ Opts.CudaGpuBinaryFileNames = Args.getAllArgValues(OPT_fcuda_include_gpubinary); + Opts.Backchain = Args.hasArg(OPT_mbackchain); + return Success; } Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.def === --- cfe/trunk/include/clang/Frontend/CodeGenOptions.def +++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def @@ -34,6 +34,7 @@ CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe. +CODEGENOPT(Backchain , 1, 0) ///< -mbackchain CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum for functions in GCNO files. CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function names in GCDA files. CODEGENOPT(CoverageExitBlockBeforeBody, 1, 0) ///< Whether to emit the exit block before the body blocks in GCNO files. Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1524,6 +1524,10 @@ def mzvector : Flag<["-"], "mzvector">, Alias; def mno_zvector : Flag<["-"], "mno-zvector">, Alias; +def mbackchain : Flag<["-"], "mbackchain">, Group, Flags<[DriverOption,CC1Option]>, + HelpText<"Link stack frames through backchain on System Z">; +def mno_backchain : Flag<["-"], "mno-backchain">, Group, Flags<[DriverOption,CC1Option]>; + def mno_warn_nonportable_cfstrings : Flag<["-"], "mno-warn-nonportable-cfstrings">, Group; def mno_omit_leaf_frame_pointer : Flag<["-"], "mno-omit-leaf-frame-pointer">, Group; def momit_leaf_frame_pointer : Flag<["-"], "momit-leaf-frame-pointer">, Group, Index: cfe/trunk/test/CodeGen/mbackchain-3.c === --- cfe/trunk/test/CodeGen/mbackchain-3.c +++ cfe/trunk/test/CodeGen/mbackchain-3.c @@ -0,0 +1,7 @@ +// RUN: %clang -mno-backchain --target=s390x-linux -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define void @foo() [[NUW:#[0-9]+]] +void foo(void) { +} + +// CHECK-NOT: "backchain" Index: cfe/trunk/test/CodeGen/mbackchain.c === --- cfe/trunk/test/CodeGen/mbackchain.c +++ cfe/trunk/test/CodeGen/mbackchain.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -mbackchain -triple s390x-linux -emit-llvm -o - %s | FileCheck %s + +// CHECK: define void @foo() [[NUW:#[0-9]+]] +void foo(void) { +} + +// CHECK: attributes [[NUW]] = { {{.*}} "backchain" {{.*}} } Index: cfe/trunk/test/CodeGen/mbackchain-2.c
[PATCH] D19891: [clang] [SystemZ] Add -mbackchain option.
koriakin created this revision. koriakin added reviewers: uweigand, rjmccall. koriakin added a subscriber: cfe-commits. koriakin set the repository for this revision to rL LLVM. koriakin added a dependency: D19889: [SystemZ] Implement backchain attribute.. This option, like the corresponding gcc option, is SystemZ-specific and enables storing frame backchain links, as specified in the ABI. Depends on D19889. Repository: rL LLVM http://reviews.llvm.org/D19891 Files: include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/CGCall.cpp lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/mbackchain-2.c test/CodeGen/mbackchain-3.c test/CodeGen/mbackchain.c Index: test/CodeGen/mbackchain.c === --- /dev/null +++ test/CodeGen/mbackchain.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -mbackchain -triple s390x-linux -emit-llvm -o - %s | FileCheck %s + +// CHECK: define void @foo() [[NUW:#[0-9]+]] +void foo(void) { +} + +// CHECK: attributes [[NUW]] = { {{.*}} "backchain" {{.*}} } Index: test/CodeGen/mbackchain-3.c === --- /dev/null +++ test/CodeGen/mbackchain-3.c @@ -0,0 +1,7 @@ +// RUN: %clang -mno-backchain --target=s390x-linux -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define void @foo() [[NUW:#[0-9]+]] +void foo(void) { +} + +// CHECK-NOT: "backchain" Index: test/CodeGen/mbackchain-2.c === --- /dev/null +++ test/CodeGen/mbackchain-2.c @@ -0,0 +1,7 @@ +// RUN: %clang -mbackchain --target=s390x-linux -S -emit-llvm -o - %s | FileCheck %s + +// CHECK: define void @foo() [[NUW:#[0-9]+]] +void foo(void) { +} + +// CHECK: attributes [[NUW]] = { {{.*}} "backchain" {{.*}} } Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -782,6 +782,8 @@ Opts.CudaGpuBinaryFileNames = Args.getAllArgValues(OPT_fcuda_include_gpubinary); + Opts.Backchain = Args.hasArg(OPT_mbackchain); + return Success; } Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -1655,6 +1655,12 @@ } } +void Clang::AddSystemZTargetArgs(const ArgList , + ArgStringList ) const { + if (Args.hasFlag(options::OPT_mbackchain, options::OPT_mno_backchain, false)) +CmdArgs.push_back("-mbackchain"); +} + static const char *getSystemZTargetCPU(const ArgList ) { if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) return A->getValue(); @@ -4241,6 +4247,10 @@ AddSparcTargetArgs(Args, CmdArgs); break; + case llvm::Triple::systemz: +AddSystemZTargetArgs(Args, CmdArgs); +break; + case llvm::Triple::x86: case llvm::Triple::x86_64: AddX86TargetArgs(Args, CmdArgs); Index: lib/CodeGen/CGCall.cpp === --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1714,6 +1714,8 @@ if (CodeGenOpts.StackRealignment) FuncAttrs.addAttribute("stackrealign"); +if (CodeGenOpts.Backchain) + FuncAttrs.addAttribute("backchain"); // Add target-cpu and target-features attributes to functions. If // we have a decl for the function and it has a target attribute then Index: include/clang/Frontend/CodeGenOptions.def === --- include/clang/Frontend/CodeGenOptions.def +++ include/clang/Frontend/CodeGenOptions.def @@ -34,6 +34,7 @@ CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe. +CODEGENOPT(Backchain , 1, 0) ///< -mbackchain CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum for functions in GCNO files. CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function names in GCDA files. CODEGENOPT(CoverageExitBlockBeforeBody, 1, 0) ///< Whether to emit the exit block before the body blocks in GCNO files. Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1519,6 +1519,10 @@ def mzvector : Flag<["-"], "mzvector">, Alias; def mno_zvector : Flag<["-"], "mno-zvector">, Alias; +def mbackchain : Flag<["-"], "mbackchain">, Group, Flags<[DriverOption,CC1Option]>, + HelpText<"Link stack frames through backchain on System Z">; +def mno_backchain : Flag<["-"], "mno-backchain">, Group, Flags<[DriverOption,CC1Option]>; + def mno_warn_nonportable_cfstrings : Flag<["-"],
Re: [PATCH] D19589: [clang] [Builtin] Make __builtin_thread_pointer target-independent.
koriakin added a comment. In http://reviews.llvm.org/D19589#413924, @rjmccall wrote: > Why the random triple change on the test? > > Otherwise LGTM. See the comment above - arm64-apple-ios doesn't support TLS, so __builtin_thread_pointer is meaningless (it compiled before, but would result in an error now due to the isTLSSupported check). Repository: rL LLVM http://reviews.llvm.org/D19589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19589: [clang] [Builtin] Make __builtin_thread_pointer target-independent.
koriakin updated this revision to Diff 55216. koriakin added a comment. Updated version: changed triple in a test to linux - ios doesn't support TLS, so __builtin_thread_pointer now rightly fails. Repository: rL LLVM http://reviews.llvm.org/D19589 Files: include/clang/Basic/Builtins.def include/clang/Basic/BuiltinsAArch64.def include/clang/Basic/BuiltinsARM.def lib/CodeGen/CGBuiltin.cpp test/CodeGen/builtins-arm64.c Index: test/CodeGen/builtins-arm64.c === --- test/CodeGen/builtins-arm64.c +++ test/CodeGen/builtins-arm64.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s +// RUN: %clang_cc1 -triple arm64-unknown-linux -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s void f0(void *a, void *b) { __clear_cache(a,b); Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -2132,6 +2132,13 @@ case Builtin::BI__builtin_canonicalizef: case Builtin::BI__builtin_canonicalizel: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::canonicalize)); + + case Builtin::BI__builtin_thread_pointer: { +if (!getContext().getTargetInfo().isTLSSupported()) + CGM.ErrorUnsupported(E, "__builtin_thread_pointer"); +// Fall through - it's already mapped to the intrinsic by GCCBuiltin. +break; + } } // If this is an alias for a lib function (e.g. __builtin_sin), emit Index: include/clang/Basic/BuiltinsARM.def === --- include/clang/Basic/BuiltinsARM.def +++ include/clang/Basic/BuiltinsARM.def @@ -20,7 +20,6 @@ // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") -BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") Index: include/clang/Basic/BuiltinsAArch64.def === --- include/clang/Basic/BuiltinsAArch64.def +++ include/clang/Basic/BuiltinsAArch64.def @@ -60,6 +60,5 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") -BUILTIN(__builtin_thread_pointer, "v*", "nc") #undef BUILTIN Index: include/clang/Basic/Builtins.def === --- include/clang/Basic/Builtins.def +++ include/clang/Basic/Builtins.def @@ -466,6 +466,7 @@ BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") +BUILTIN(__builtin_thread_pointer, "v*", "nc") // GCC exception builtins BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! Index: test/CodeGen/builtins-arm64.c === --- test/CodeGen/builtins-arm64.c +++ test/CodeGen/builtins-arm64.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s +// RUN: %clang_cc1 -triple arm64-unknown-linux -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s void f0(void *a, void *b) { __clear_cache(a,b); Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -2132,6 +2132,13 @@ case Builtin::BI__builtin_canonicalizef: case Builtin::BI__builtin_canonicalizel: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::canonicalize)); + + case Builtin::BI__builtin_thread_pointer: { +if (!getContext().getTargetInfo().isTLSSupported()) + CGM.ErrorUnsupported(E, "__builtin_thread_pointer"); +// Fall through - it's already mapped to the intrinsic by GCCBuiltin. +break; + } } // If this is an alias for a lib function (e.g. __builtin_sin), emit Index: include/clang/Basic/BuiltinsARM.def === --- include/clang/Basic/BuiltinsARM.def +++ include/clang/Basic/BuiltinsARM.def @@ -20,7 +20,6 @@ // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") -BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") Index: include/clang/Basic/BuiltinsAArch64.def === --- include/clang/Basic/BuiltinsAArch64.def +++ include/clang/Basic/BuiltinsAArch64.def @@ -60,6 +60,5 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") -BUILTIN(__builtin_thread_pointer, "v*", "nc") #undef BUILTIN Index: include/clang/Basic/Builtins.def === --- include/clang/Basic/Builtins.def +++ include/clang/Basic/Builtins.def @@
[PATCH] D19589: [clang] [Builtin] Make __builtin_thread_pointer target-independent.
koriakin created this revision. koriakin added reviewers: asl, rjmccall. koriakin added a subscriber: cfe-commits. koriakin set the repository for this revision to rL LLVM. Herald added subscribers: jyknight, aemerson. This is now supported for ARM, AArch64, PowerPC, SystemZ, SPARC. Patches for X86 and Mips are in review. Repository: rL LLVM http://reviews.llvm.org/D19589 Files: include/clang/Basic/Builtins.def include/clang/Basic/BuiltinsAArch64.def include/clang/Basic/BuiltinsARM.def lib/CodeGen/CGBuiltin.cpp Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -2132,6 +2132,13 @@ case Builtin::BI__builtin_canonicalizef: case Builtin::BI__builtin_canonicalizel: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::canonicalize)); + + case Builtin::BI__builtin_thread_pointer: { +if (!getContext().getTargetInfo().isTLSSupported()) + CGM.ErrorUnsupported(E, "__builtin_thread_pointer"); +// Fall through - it's already mapped to the intrinsic by GCCBuiltin. +break; + } } // If this is an alias for a lib function (e.g. __builtin_sin), emit Index: include/clang/Basic/BuiltinsARM.def === --- include/clang/Basic/BuiltinsARM.def +++ include/clang/Basic/BuiltinsARM.def @@ -20,7 +20,6 @@ // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") -BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") Index: include/clang/Basic/BuiltinsAArch64.def === --- include/clang/Basic/BuiltinsAArch64.def +++ include/clang/Basic/BuiltinsAArch64.def @@ -60,6 +60,5 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") -BUILTIN(__builtin_thread_pointer, "v*", "nc") #undef BUILTIN Index: include/clang/Basic/Builtins.def === --- include/clang/Basic/Builtins.def +++ include/clang/Basic/Builtins.def @@ -466,6 +466,7 @@ BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") +BUILTIN(__builtin_thread_pointer, "v*", "nc") // GCC exception builtins BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -2132,6 +2132,13 @@ case Builtin::BI__builtin_canonicalizef: case Builtin::BI__builtin_canonicalizel: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::canonicalize)); + + case Builtin::BI__builtin_thread_pointer: { +if (!getContext().getTargetInfo().isTLSSupported()) + CGM.ErrorUnsupported(E, "__builtin_thread_pointer"); +// Fall through - it's already mapped to the intrinsic by GCCBuiltin. +break; + } } // If this is an alias for a lib function (e.g. __builtin_sin), emit Index: include/clang/Basic/BuiltinsARM.def === --- include/clang/Basic/BuiltinsARM.def +++ include/clang/Basic/BuiltinsARM.def @@ -20,7 +20,6 @@ // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") -BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") Index: include/clang/Basic/BuiltinsAArch64.def === --- include/clang/Basic/BuiltinsAArch64.def +++ include/clang/Basic/BuiltinsAArch64.def @@ -60,6 +60,5 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") -BUILTIN(__builtin_thread_pointer, "v*", "nc") #undef BUILTIN Index: include/clang/Basic/Builtins.def === --- include/clang/Basic/Builtins.def +++ include/clang/Basic/Builtins.def @@ -466,6 +466,7 @@ BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") +BUILTIN(__builtin_thread_pointer, "v*", "nc") // GCC exception builtins BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19099: [clang] [AArch64] Fix D19098 fallout.
This revision was automatically updated to reflect the committed changes. Closed by commit rL266817: [AArch64] Fix D19098 fallout. (authored by koriakin). Changed prior to commit: http://reviews.llvm.org/D19099?vs=53667=54254#toc Repository: rL LLVM http://reviews.llvm.org/D19099 Files: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/builtins-arm64.c Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp === --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp @@ -4647,11 +4647,6 @@ return Builder.CreateCall(F); } - if (BuiltinID == AArch64::BI__builtin_thread_pointer) { -Function *F = CGM.getIntrinsic(Intrinsic::aarch64_thread_pointer); -return Builder.CreateCall(F); - } - // CRC32 Intrinsic::ID CRCIntrinsicID = Intrinsic::not_intrinsic; switch (BuiltinID) { Index: cfe/trunk/test/CodeGen/builtins-arm64.c === --- cfe/trunk/test/CodeGen/builtins-arm64.c +++ cfe/trunk/test/CodeGen/builtins-arm64.c @@ -7,7 +7,7 @@ void *tp (void) { return __builtin_thread_pointer (); -// CHECK: call {{.*}} @llvm.aarch64.thread.pointer() +// CHECK: call {{.*}} @llvm.thread.pointer() } // CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a) Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp === --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp @@ -4647,11 +4647,6 @@ return Builder.CreateCall(F); } - if (BuiltinID == AArch64::BI__builtin_thread_pointer) { -Function *F = CGM.getIntrinsic(Intrinsic::aarch64_thread_pointer); -return Builder.CreateCall(F); - } - // CRC32 Intrinsic::ID CRCIntrinsicID = Intrinsic::not_intrinsic; switch (BuiltinID) { Index: cfe/trunk/test/CodeGen/builtins-arm64.c === --- cfe/trunk/test/CodeGen/builtins-arm64.c +++ cfe/trunk/test/CodeGen/builtins-arm64.c @@ -7,7 +7,7 @@ void *tp (void) { return __builtin_thread_pointer (); -// CHECK: call {{.*}} @llvm.aarch64.thread.pointer() +// CHECK: call {{.*}} @llvm.thread.pointer() } // CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits