Skip to content

[LTO][Pipelines][Coro] Handle coroutines in LTO pipeline #126168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

vitalybuka
Copy link
Collaborator

ThinLTO delays handling of coroutines to ThinLTO backend.
However it's usually possible to use ThinLTO prelink object for FullLTO.

In this case we have left-over coroutines which crash in codegen.

Issue #104525.

Created using spr 1.3.4
@llvmbot llvmbot added the LTO Link time optimization (regular/full LTO or ThinLTO) label Feb 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 7, 2025

@llvm/pr-subscribers-lto

Author: Vitaly Buka (vitalybuka)

Changes

ThinLTO delays handling of coroutines to ThinLTO backend.
However it's usually possible to use ThinLTO prelink object for FullLTO.

In this case we have left-over coroutines which crash in codegen.

Issue #104525.


Full diff: https://github.com/llvm/llvm-project/pull/126168.diff

4 Files Affected:

  • (modified) llvm/lib/Passes/PassBuilderPipelines.cpp (+17-16)
  • (modified) llvm/test/Other/new-pm-O0-defaults.ll (+2)
  • (modified) llvm/test/Other/new-pm-lto-defaults.ll (+4)
  • (added) llvm/test/ThinLTO/X86/coro.ll (+21)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index c6cf6cdbe9390f8..e631e03c8384080 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -14,6 +14,7 @@
 ///
 //===----------------------------------------------------------------------===//
 
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/BasicAliasAnalysis.h"
@@ -1816,6 +1817,17 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
   // in the current module.
   MPM.addPass(CrossDSOCFIPass());
 
+  MPM.addPass(CoroEarlyPass());
+
+  auto Exit = llvm::make_scope_exit([&]() {
+    MPM.addPass(CoroCleanupPass());
+
+    invokeFullLinkTimeOptimizationLastEPCallbacks(MPM, Level);
+
+    // Emit annotation remarks.
+    addAnnotationRemarksPass(MPM);
+  });
+
   if (Level == OptimizationLevel::O0) {
     // The WPD and LowerTypeTest passes need to run at -O0 to lower type
     // metadata and intrinsics.
@@ -1826,11 +1838,6 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
     MPM.addPass(LowerTypeTestsPass(nullptr, nullptr,
                                    lowertypetests::DropTestKind::Assume));
 
-    invokeFullLinkTimeOptimizationLastEPCallbacks(MPM, Level);
-
-    // Emit annotation remarks.
-    addAnnotationRemarksPass(MPM);
-
     return MPM;
   }
 
@@ -1910,11 +1917,6 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
     MPM.addPass(LowerTypeTestsPass(nullptr, nullptr,
                                    lowertypetests::DropTestKind::Assume));
 
-    invokeFullLinkTimeOptimizationLastEPCallbacks(MPM, Level);
-
-    // Emit annotation remarks.
-    addAnnotationRemarksPass(MPM);
-
     return MPM;
   }
 
@@ -1983,7 +1985,11 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
 
   // If we didn't decide to inline a function, check to see if we can
   // transform it to pass arguments by value instead of by reference.
-  MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(ArgumentPromotionPass()));
+  CGSCCPassManager CGPM;
+  CGPM.addPass(ArgumentPromotionPass());
+  CGPM.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
+  CGPM.addPass(CoroAnnotationElidePass());
+  MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
 
   FunctionPassManager FPM;
   // The IPO Passes may leave cruft around. Clean up after them.
@@ -2135,11 +2141,6 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
   if (PTO.CallGraphProfile)
     MPM.addPass(CGProfilePass(/*InLTOPostLink=*/true));
 
-  invokeFullLinkTimeOptimizationLastEPCallbacks(MPM, Level);
-
-  // Emit annotation remarks.
-  addAnnotationRemarksPass(MPM);
-
   return MPM;
 }
 
diff --git a/llvm/test/Other/new-pm-O0-defaults.ll b/llvm/test/Other/new-pm-O0-defaults.ll
index e8131ac7fab45ac..db450269414e3ef 100644
--- a/llvm/test/Other/new-pm-O0-defaults.ll
+++ b/llvm/test/Other/new-pm-O0-defaults.ll
@@ -47,12 +47,14 @@
 ; CHECK-THINLTO-NEXT: Running pass: EliminateAvailableExternallyPass
 ; CHECK-THINLTO-NEXT: Running pass: GlobalDCEPass
 ; CHECK-LTO: Running pass: CrossDSOCFIPass on [module]
+; CHECK-LTO-NEXT: CoroEarlyPass
 ; CHECK-LTO-NEXT: Running pass: WholeProgramDevirtPass
 ; CHECK-LTO-NEXT: Running analysis: InnerAnalysisManagerProxy
 ; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
 ; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
 ; CHECK-CORO-NEXT: Running pass: AnnotationRemarksPass
 ; CHECK-CORO-NEXT: Running analysis: TargetLibraryAnalysis
+; CHECK-LTO-NEXT: CoroCleanupPass
 ; CHECK-LTO-NEXT: Running pass: AnnotationRemarksPass
 ; CHECK-LTO-NEXT: Running analysis: TargetLibraryAnalysis
 ; CHECK-NEXT: Running pass: PrintModulePass
diff --git a/llvm/test/Other/new-pm-lto-defaults.ll b/llvm/test/Other/new-pm-lto-defaults.ll
index 86480c5115748d5..d6e88bd7b5c50a5 100644
--- a/llvm/test/Other/new-pm-lto-defaults.ll
+++ b/llvm/test/Other/new-pm-lto-defaults.ll
@@ -35,6 +35,7 @@
 
 ; CHECK-EP: Running pass: NoOpModulePass
 ; CHECK-O: Running pass: CrossDSOCFIPass
+; CHECK-O-NEXT: CoroEarlyPass
 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
 ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
@@ -86,6 +87,8 @@
 ; CHECK-O23SZ-NEXT: Running pass: OpenMPOptPass
 ; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
 ; CHECK-O23SZ-NEXT: Running pass: ArgumentPromotionPass
+; CHECK-O23SZ-NEXT: CoroSplitPass on (foo)
+; CHECK-O23SZ-NEXT: CoroAnnotationElidePass on (foo)
 ; CHECK-O23SZ-NEXT: Running pass: InstCombinePass
 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
 ; CHECK-O23SZ-NEXT: Running pass: ConstraintEliminationPass
@@ -156,6 +159,7 @@
 ; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
 ; CHECK-O23SZ-NEXT: Running pass: RelLookupTableConverterPass
 ; CHECK-O23SZ-NEXT: Running pass: CGProfilePass
+; CHECK-O-NEXT: CoroCleanupPass
 ; CHECK-EP-NEXT: Running pass: NoOpModulePass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
 ; CHECK-O-NEXT: Running pass: PrintModulePass
diff --git a/llvm/test/ThinLTO/X86/coro.ll b/llvm/test/ThinLTO/X86/coro.ll
new file mode 100644
index 000000000000000..9094062b2fe275f
--- /dev/null
+++ b/llvm/test/ThinLTO/X86/coro.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as %s -o %t1.bc
+; RUN: llvm-lto2 run %t1.bc -o %t2.o -r=%t1.bc,test,plx -r=%t1.bc,extern_func,plx -save-temps
+; RUN: llvm-dis %t2.o.0.5.precodegen.bc -o - | FileCheck %s --implicit-check-not=llvm.coro
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-fuchsia"
+
+declare void @extern_func()
+
+; CHECK:      define {{.*}} void @test(
+define void @test(ptr %hdl) {
+  call void @llvm.coro.resume(ptr %hdl)
+  call void @llvm.coro.destroy(ptr %hdl)
+  call i1 @llvm.coro.done(ptr %hdl)
+  ret void
+}
+
+declare void @llvm.coro.resume(ptr)
+declare void @llvm.coro.destroy(ptr)
+declare i1 @llvm.coro.done(ptr)
+

Created using spr 1.3.4
@vitalybuka vitalybuka marked this pull request as draft February 7, 2025 07:03
Created using spr 1.3.4
Created using spr 1.3.4
Created using spr 1.3.4
Created using spr 1.3.4
Created using spr 1.3.4
@nikic
Copy link
Contributor

nikic commented Feb 7, 2025

@vitalybuka vitalybuka marked this pull request as ready for review February 7, 2025 17:21
@vitalybuka vitalybuka requested a review from nikic February 7, 2025 17:21
Created using spr 1.3.4
Copy link
Contributor

@teresajohnson teresajohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with the caveat that I don't know the correct relative ordering of the Coro passes.

Copy link
Contributor

@aeubanks aeubanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be consistent between Full and ThinLTO and also skip coroutine passes in prelink FullLTO so we don't run coroutine passes twice with FullLTO

@vitalybuka
Copy link
Collaborator Author

we should be consistent between Full and ThinLTO and also skip coroutine passes in prelink FullLTO so we don't run coroutine passes twice with FullLTO

Good idea.
However, the patch as-is should not regress anyone, because they must crash already if reach this cases. I don't have good understanding what is good order of those passes. Probably we can just follow thinlto case.

Still to avoid regressions, I propose to land this patch as-is. It's essentially NFC for all who don't see the crash.
And address your suggestion in followup patch, so if it causes regression, we can easily revert it without reintroducing this crash.

@vitalybuka vitalybuka requested a review from aeubanks February 10, 2025 18:41
Copy link
Contributor

@aeubanks aeubanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this patch is a regression in the sense that now we run coroutine passes twice in FullLTO, but I think the coroutine passes are all idempotent so that should be ok, so I think landing this separately should be fine

Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
vitalybuka added a commit that referenced this pull request Feb 12, 2025
Helper for #126168.

`Phase` will be used in followup patches.
Created using spr 1.3.4
@vitalybuka
Copy link
Collaborator Author

@vogelsgesang I'd like to merge it if no other feedback?

Copy link
Member

@vogelsgesang vogelsgesang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vitalybuka vitalybuka merged commit 1032df6 into main Feb 13, 2025
8 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/ltopipelinescoro-handle-coroutines-in-lto-pipeline branch February 13, 2025 05:39
@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 13, 2025

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-a-1 while building llvm at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/12542

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
[220/2789] Copying CXX header __algorithm/find_segment_if.h
[221/2789] Copying CXX header __algorithm/comp_ref_type.h
[222/2789] Copying CXX module std.compat/cstdlib.inc
[223/2789] Copying CXX module std.compat/cuchar.inc
[224/2789] Copying CXX header __algorithm/generate.h
[225/2789] Copying CXX header __algorithm/generate_n.h
[226/2789] Generating header features.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/features.yaml
[227/2789] Generating header float.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/float.yaml
[228/2789] Generating header limits.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/limits.yaml
[229/2789] Building CXX object libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj
FAILED: libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj 
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-wmt6oqss/bin/clang++ --target=armv8.1m.main-none-eabi -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -I/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc -isystem /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-wmt6oqss/include/armv8.1m.main-unknown-none-eabi --target=armv8.1m.main-none-eabi -Wno-atomic-alignment "-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" -D_LIBCPP_PRINT=1 -mthumb -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-wmt6oqss/runtimes/runtimes-armv8.1m.main-none-eabi-bins=../../../../llvm-project -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/= -no-canonical-prefixes -Os -DNDEBUG -std=gnu++17 --target=armv8.1m.main-none-eabi -DLIBC_QSORT_IMPL=LIBC_QSORT_HEAP_SORT -DLIBC_TYPES_TIME_T_IS_32_BIT -DLIBC_ADD_NULL_CHECKS "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES)" -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj -MF libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj.d -o libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj -c /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:16:8: error: unknown type name 'uintptr_t'
   16 | extern uintptr_t __preinit_array_start[];
      |        ^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:17:8: error: unknown type name 'uintptr_t'
   17 | extern uintptr_t __preinit_array_end[];
      |        ^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:18:8: error: unknown type name 'uintptr_t'
   18 | extern uintptr_t __init_array_start[];
      |        ^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:19:8: error: unknown type name 'uintptr_t'
   19 | extern uintptr_t __init_array_end[];
      |        ^
4 errors generated.
[230/2789] Copying CXX header __algorithm/half_positive.h
[231/2789] Copying CXX header __algorithm/any_of.h
[232/2789] Copying CXX header __algorithm/fill.h
[233/2789] Copying CXX header __algorithm/fill_n.h
[234/2789] Copying CXX header __algorithm/copy.h
[235/2789] Copying CXX header __algorithm/is_heap.h
[236/2789] Copying CXX header __algorithm/is_heap_until.h
[237/2789] Copying CXX header __algorithm/is_partitioned.h
[238/2789] Copying CXX module std.compat/cctype.inc
[239/2789] Copying CXX module std.compat/clocale.inc
[240/2789] Copying CXX module std.compat/cassert.inc
[241/2789] Copying CXX header __algorithm/inplace_merge.h
[242/2789] Copying CXX module std.compat/cinttypes.inc
[243/2789] Building CXX object libc/src/stdlib/baremetal/CMakeFiles/libc.src.stdlib.baremetal.abort.dir/abort.cpp.obj
[244/2789] Copying CXX module std.compat/cfloat.inc
[245/2789] Copying CXX header __algorithm/is_permutation.h
[246/2789] Copying CXX header __algorithm/is_sorted.h
[247/2789] Copying CXX header __algorithm/iter_swap.h
[248/2789] Copying CXX header __algorithm/is_sorted_until.h
[249/2789] Generating header stdint.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/stdint.yaml
[250/2789] Copying CXX header __algorithm/iterator_operations.h
[251/2789] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strcoll.dir/strcoll.cpp.obj
[252/2789] Building CXX object libc/src/stdio/baremetal/CMakeFiles/libc.src.stdio.baremetal.putchar.dir/putchar.cpp.obj
[253/2789] Copying CXX header __algorithm/lexicographical_compare.h
Step 6 (build) failure: build (failure)
...
[220/2789] Copying CXX header __algorithm/find_segment_if.h
[221/2789] Copying CXX header __algorithm/comp_ref_type.h
[222/2789] Copying CXX module std.compat/cstdlib.inc
[223/2789] Copying CXX module std.compat/cuchar.inc
[224/2789] Copying CXX header __algorithm/generate.h
[225/2789] Copying CXX header __algorithm/generate_n.h
[226/2789] Generating header features.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/features.yaml
[227/2789] Generating header float.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/float.yaml
[228/2789] Generating header limits.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/limits.yaml
[229/2789] Building CXX object libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj
FAILED: libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj 
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-wmt6oqss/bin/clang++ --target=armv8.1m.main-none-eabi -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -I/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc -isystem /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-wmt6oqss/include/armv8.1m.main-unknown-none-eabi --target=armv8.1m.main-none-eabi -Wno-atomic-alignment "-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" -D_LIBCPP_PRINT=1 -mthumb -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-wmt6oqss/runtimes/runtimes-armv8.1m.main-none-eabi-bins=../../../../llvm-project -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/= -no-canonical-prefixes -Os -DNDEBUG -std=gnu++17 --target=armv8.1m.main-none-eabi -DLIBC_QSORT_IMPL=LIBC_QSORT_HEAP_SORT -DLIBC_TYPES_TIME_T_IS_32_BIT -DLIBC_ADD_NULL_CHECKS "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES)" -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj -MF libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj.d -o libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj -c /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:16:8: error: unknown type name 'uintptr_t'
   16 | extern uintptr_t __preinit_array_start[];
      |        ^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:17:8: error: unknown type name 'uintptr_t'
   17 | extern uintptr_t __preinit_array_end[];
      |        ^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:18:8: error: unknown type name 'uintptr_t'
   18 | extern uintptr_t __init_array_start[];
      |        ^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/init.cpp:19:8: error: unknown type name 'uintptr_t'
   19 | extern uintptr_t __init_array_end[];
      |        ^
4 errors generated.
[230/2789] Copying CXX header __algorithm/half_positive.h
[231/2789] Copying CXX header __algorithm/any_of.h
[232/2789] Copying CXX header __algorithm/fill.h
[233/2789] Copying CXX header __algorithm/fill_n.h
[234/2789] Copying CXX header __algorithm/copy.h
[235/2789] Copying CXX header __algorithm/is_heap.h
[236/2789] Copying CXX header __algorithm/is_heap_until.h
[237/2789] Copying CXX header __algorithm/is_partitioned.h
[238/2789] Copying CXX module std.compat/cctype.inc
[239/2789] Copying CXX module std.compat/clocale.inc
[240/2789] Copying CXX module std.compat/cassert.inc
[241/2789] Copying CXX header __algorithm/inplace_merge.h
[242/2789] Copying CXX module std.compat/cinttypes.inc
[243/2789] Building CXX object libc/src/stdlib/baremetal/CMakeFiles/libc.src.stdlib.baremetal.abort.dir/abort.cpp.obj
[244/2789] Copying CXX module std.compat/cfloat.inc
[245/2789] Copying CXX header __algorithm/is_permutation.h
[246/2789] Copying CXX header __algorithm/is_sorted.h
[247/2789] Copying CXX header __algorithm/iter_swap.h
[248/2789] Copying CXX header __algorithm/is_sorted_until.h
[249/2789] Generating header stdint.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/stdint.yaml
[250/2789] Copying CXX header __algorithm/iterator_operations.h
[251/2789] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strcoll.dir/strcoll.cpp.obj
[252/2789] Building CXX object libc/src/stdio/baremetal/CMakeFiles/libc.src.stdio.baremetal.putchar.dir/putchar.cpp.obj
[253/2789] Copying CXX header __algorithm/lexicographical_compare.h

flovent pushed a commit to flovent/llvm-project that referenced this pull request Feb 13, 2025
Helper for llvm#126168.

`Phase` will be used in followup patches.
flovent pushed a commit to flovent/llvm-project that referenced this pull request Feb 13, 2025
ThinLTO delays handling of coroutines to ThinLTO backend.
However it's usually possible to use ThinLTO prelink objects for FullLTO.

In this case we have left-over coroutines which crash in codegen.

Issue llvm#104525.
joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
Helper for llvm#126168.

`Phase` will be used in followup patches.
joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
ThinLTO delays handling of coroutines to ThinLTO backend.
However it's usually possible to use ThinLTO prelink objects for FullLTO.

In this case we have left-over coroutines which crash in codegen.

Issue llvm#104525.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Helper for llvm#126168.

`Phase` will be used in followup patches.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
ThinLTO delays handling of coroutines to ThinLTO backend.
However it's usually possible to use ThinLTO prelink objects for FullLTO.

In this case we have left-over coroutines which crash in codegen.

Issue llvm#104525.
vitalybuka added a commit that referenced this pull request Feb 26, 2025
```
if (!isLTOPostLink(Phase))
    CoroPM.addPass(CoroEarlyPass());
if (!isLTOPreLink(Phase))
    // Other Coro passes
```

Followup to #126168.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants