Skip to content

[llvm][AArch64] Ensure stack alignment in non-sibcall tail calls with FPDiff - #217156

Merged
jroelofs merged 2 commits into
llvm:mainfrom
jroelofs:jroelofs/rdar184474075
Sep 1, 2026
Merged

jroelofs merged 2 commits into
llvm:mainfrom
jroelofs:jroelofs/rdar184474075

Conversation

@jroelofs

Copy link
Copy Markdown
Contributor

When a caller has a non-multiple of the minimum stack alignment more argument stack space than the callee it is tail calling, we need to ensure that the resulting FPDiff's magnitude has been rounded up to a multiple of the platform's minimum stack alignment.

rdar://184474075

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-backend-aarch64

Author: Jon Roelofs (jroelofs)

Changes

When a caller has a non-multiple of the minimum stack alignment more argument stack space than the callee it is tail calling, we need to ensure that the resulting FPDiff's magnitude has been rounded up to a multiple of the platform's minimum stack alignment.

rdar://184474075


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

2 Files Affected:

  • (modified) llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (+25-8)
  • (added) llvm/test/CodeGen/AArch64/sme-za-tailcall-fpdiff-align.ll (+72)
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 5957d51005386..c6bbc950a3082 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -9680,13 +9680,15 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
   unsigned StackArgSize = CCInfo.getStackSize();
   bool TailCallOpt = MF.getTarget().Options.GuaranteedTailCallOpt;
   if (DoesCalleeRestoreStack(CallConv, TailCallOpt)) {
+    const Align StackAlign = Subtarget->getFrameLowering()->getStackAlign();
+
     // This is a non-standard ABI so by fiat I say we're allowed to make full
-    // use of the stack area to be popped, which must be aligned to 16 bytes in
-    // any case:
-    StackArgSize = alignTo(StackArgSize, 16);
+    // use of the stack area to be popped, which must be aligned to the stack
+    // alignment in any case:
+    StackArgSize = alignTo(StackArgSize, StackAlign);
 
     // If we're expected to restore the stack (e.g. fastcc) then we'll be adding
-    // a multiple of 16.
+    // a multiple of the stack alignment.
     FuncInfo->setArgumentStackToRestore(StackArgSize);
 
     // This realignment carries over to the available bytes below. Our own
@@ -10519,19 +10521,33 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
   // caller will deallocate the entire stack and the callee still expects its
   // arguments to begin at SP+0. Completely unused for non-tail calls.
   int FPDiff = 0;
+  const Align StackAlign = Subtarget->getFrameLowering()->getStackAlign();
 
   if (IsTailCall && !IsSibCall) {
     unsigned NumReusableBytes = FuncInfo->getBytesInStackArgArea();
 
     // Since callee will pop argument stack as a tail call, we must keep the
-    // popped size 16-byte aligned.
-    NumBytes = alignTo(NumBytes, 16);
+    // popped size aligned to the stack alignment.
+    NumBytes = alignTo(NumBytes, StackAlign);
 
     // FPDiff will be negative if this tail call requires more space than we
     // would automatically have in our incoming argument space. Positive if we
     // can actually shrink the stack.
     FPDiff = NumReusableBytes - NumBytes;
 
+    // Round FPDiff away from zero to a multiple of the minimum stack alignment.
+    // While NumBytes was already aligned above, NumReusableBytes (which
+    // represents the incoming argument area, only guaranteed to be aligned in
+    // caller pops conventions e.g. fastcc/swifttailcc) may not be. We round
+    // FPDiff's magnitude to the next multiple of the minimum stack alignment so
+    // the delta applied for the tail call satisfies the same constraint. A
+    // positive FPDiff at most claims a few more bytes of the caller's own
+    // incoming argument area (which is already suitably aligned), and a
+    // negative FPDiff at most grows the reserved tail-call stack slightly.
+    FPDiff = FPDiff < 0 ? -alignTo(-FPDiff, StackAlign)
+                        : alignTo(FPDiff, StackAlign);
+
+
     // Update the required reserved area if this is the tail call requiring the
     // most argument stack space.
     if (FPDiff < 0 && FuncInfo->getTailCallReservedStack() < (unsigned)-FPDiff)
@@ -11089,8 +11105,9 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
       MF.getFunction().getParent()->getModuleFlag("import-call-optimization"))
     DAG.addCalledGlobal(Chain.getNode(), CalledGlobal, OpFlags);
 
-  uint64_t CalleePopBytes =
-      DoesCalleeRestoreStack(CallConv, TailCallOpt) ? alignTo(NumBytes, 16) : 0;
+  uint64_t CalleePopBytes = DoesCalleeRestoreStack(CallConv, TailCallOpt)
+                                ? alignTo(NumBytes, StackAlign)
+                                : 0;
 
   Chain = DAG.getCALLSEQ_END(Chain, NumBytes, CalleePopBytes, InGlue, DL);
   InGlue = Chain.getValue(1);
diff --git a/llvm/test/CodeGen/AArch64/sme-za-tailcall-fpdiff-align.ll b/llvm/test/CodeGen/AArch64/sme-za-tailcall-fpdiff-align.ll
new file mode 100644
index 0000000000000..82a6d5a0617fb
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/sme-za-tailcall-fpdiff-align.ll
@@ -0,0 +1,72 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc < %s -mtriple=arm64-apple-ios -mattr=+sme -o - | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-apple-ios -mattr=+sme -global-isel-abort=2 -o - 2>&1 | FileCheck %s --check-prefix=CHECK,GISEL
+
+; GlobalISel doesn't implement SME yet, but once it does, we should be mindful of this case.
+; GISEL: warning: Instruction selection used fallback path for caller_more_args
+; GISEL: warning: Instruction selection used fallback path for caller_same_args
+
+declare void @external_func() "aarch64_inout_za"
+
+; ZA state being live for both caller and callee forces the non-sibcall tail
+; call fast path. FPDiff = (caller's incoming argument stack) - (callee's
+; outgoing argument stack) can come out either positive or negative, and in
+; either case its magnitude must be rounded away from zero to a multiple of
+; 16 to keep the stack pointer 16-byte aligned at all times.
+declare void @callee_fewer_args(i64, i64, i64, i64, i64, i64, i64, i64) "aarch64_inout_za"
+define void @caller_more_args(i64, i64, i64, i64, i64, i64, i64, i64, i64) "aarch64_inout_za" {
+; CHECK-LABEL: caller_more_args:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
+; CHECK-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-NEXT:    .cfi_offset w30, -8
+; CHECK-NEXT:    .cfi_offset w29, -16
+; CHECK-NEXT:    bl _external_func
+; CHECK-NEXT:    mov w0, #1 ; =0x1
+; CHECK-NEXT:    mov w1, #2 ; =0x2
+; CHECK-NEXT:    mov w2, #3 ; =0x3
+; CHECK-NEXT:    mov w3, #4 ; =0x4
+; CHECK-NEXT:    mov w4, #5 ; =0x5
+; CHECK-NEXT:    mov w5, #6 ; =0x6
+; CHECK-NEXT:    mov w6, #7 ; =0x7
+; CHECK-NEXT:    mov w7, #8 ; =0x8
+; CHECK-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
+; CHECK-NEXT:    add sp, sp, #16
+; CHECK-NEXT:    b _callee_fewer_args
+entry:
+  tail call void @external_func()
+  tail call void @callee_fewer_args(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8) "aarch64_inout_za"
+  ret void
+}
+
+; Likewise for a callee that has the same amount of argument stack as the
+; caller, the FPDiff becomes negative, and must be rounded away from zero to the
+; next multiple of 16 to keep the stack aligned for the callee.
+declare void @callee_same_args(i64, i64, i64, i64, i64, i64, i64, i64, i64) "aarch64_inout_za"
+define void @caller_same_args(i64, i64, i64, i64, i64, i64, i64, i64, i64) "aarch64_inout_za" {
+; CHECK-LABEL: caller_same_args:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    stp x29, x30, [sp, #-32]! ; 16-byte Folded Spill
+; CHECK-NEXT:    .cfi_def_cfa_offset 32
+; CHECK-NEXT:    .cfi_offset w30, -24
+; CHECK-NEXT:    .cfi_offset w29, -32
+; CHECK-NEXT:    bl _external_func
+; CHECK-NEXT:    mov w8, #9 ; =0x9
+; CHECK-NEXT:    mov w0, #1 ; =0x1
+; CHECK-NEXT:    mov w1, #2 ; =0x2
+; CHECK-NEXT:    str x8, [sp, #16]
+; CHECK-NEXT:    mov w2, #3 ; =0x3
+; CHECK-NEXT:    mov w3, #4 ; =0x4
+; CHECK-NEXT:    mov w4, #5 ; =0x5
+; CHECK-NEXT:    mov w5, #6 ; =0x6
+; CHECK-NEXT:    mov w6, #7 ; =0x7
+; CHECK-NEXT:    mov w7, #8 ; =0x8
+; CHECK-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
+; CHECK-NEXT:    b _callee_same_args
+entry:
+  tail call void @external_func()
+  tail call void @callee_same_args(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9) "aarch64_inout_za"
+  ret void
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; GISEL: {{.*}}

@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@jroelofs
jroelofs force-pushed the jroelofs/rdar184474075 branch from 0dec7bc to 0edc262 Compare August 19, 2026 01:04
@jroelofs
jroelofs requested a review from dtellenbach August 25, 2026 21:51
… FPDiff

When a caller has a non-multiple of the minimum stack alignment more argument
stack space than the callee it is tail calling, we need to ensure that the
resulting FPDiff's magnitude has been rounded up to a multiple of the platform's
minimum stack alignment.

rdar://184474075
@jroelofs
jroelofs force-pushed the jroelofs/rdar184474075 branch from 0edc262 to 4c42713 Compare August 28, 2026 19:35
@github-actions

Copy link
Copy Markdown

🪟 Windows x64 Test Results

  • 136489 tests passed
  • 3316 tests skipped

All executed tests passed, but another part of the build failed. Click on a failure below to see the details.

[code=4294967295] bin/mlir-opt.exe
FAILED: [code=4294967295] bin/mlir-opt.exe
C:\Windows\system32\cmd.exe /C "cd . && C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -E vs_link_exe --msvc-ver=1944 --intdir=tools\mlir\tools\mlir-opt\CMakeFiles\mlir-opt.dir --rc="C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\rc.exe" --mt="C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\mt.exe" --manifests  -- C:\clang\clang-msvc\bin\lld-link.exe /nologo @CMakeFiles\mlir-opt.rsp  /out:bin\mlir-opt.exe /implib:lib\mlir-opt.lib /pdb:bin\mlir-opt.pdb /version:0.0 /MANIFEST:NO /Brepro /INCREMENTAL:NO /subsystem:console  /STACK:10000000 && cd ."
LINK: command "C:\clang\clang-msvc\bin\lld-link.exe /nologo @CMakeFiles\mlir-opt.rsp /out:bin\mlir-opt.exe /implib:lib\mlir-opt.lib /pdb:bin\mlir-opt.pdb /version:0.0 /MANIFEST:NO /Brepro /INCREMENTAL:NO /subsystem:console /STACK:10000000" failed (exit code 1) with the following output:
lld-link: error: undefined symbol: class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl mlir::transform::createCheckUsesPass(void)
>>> referenced by MLIRRegisterAllPasses.lib(RegisterAllPasses.cpp.obj):(private: virtual class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl std::_Func_impl_no_alloc<class `void __cdecl mlir::transform::registerCheckUsesPass(void)'::`1'::<lambda_1>, class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>>>::_Do_call(void))

lld-link: error: undefined symbol: class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl mlir::transform::createInferEffectsPass(void)
>>> referenced by MLIRRegisterAllPasses.lib(RegisterAllPasses.cpp.obj):(private: virtual class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl std::_Func_impl_no_alloc<class `void __cdecl mlir::transform::registerInferEffectsPass(void)'::`1'::<lambda_1>, class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>>>::_Do_call(void))

lld-link: error: undefined symbol: class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl mlir::transform::createInterpreterPass(void)
>>> referenced by MLIRRegisterAllPasses.lib(RegisterAllPasses.cpp.obj):(private: virtual class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl std::_Func_impl_no_alloc<class `void __cdecl mlir::transform::registerInterpreterPass(void)'::`1'::<lambda_1>, class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>>>::_Do_call(void))

lld-link: error: undefined symbol: class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl mlir::transform::createPreloadLibraryPass(void)
>>> referenced by MLIRRegisterAllPasses.lib(RegisterAllPasses.cpp.obj):(private: virtual class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>> __cdecl std::_Func_impl_no_alloc<class `void __cdecl mlir::transform::registerPreloadLibraryPass(void)'::`1'::<lambda_1>, class std::unique_ptr<class mlir::Pass, struct std::default_delete<class mlir::Pass>>>::_Do_call(void))

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@jroelofs
jroelofs merged commit 234ce03 into llvm:main Sep 1, 2026
8 of 12 checks passed
@jroelofs
jroelofs deleted the jroelofs/rdar184474075 branch September 1, 2026 16:42
@llvm-ci

llvm-ci commented Sep 1, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder profcheck running on profcheck-b2 while building llvm at step 5 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 5 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/profcheck.sh --jobs=64' (failure)
...
++ cat ../llvm-project/llvm/utils/profcheck-xfail.txt
++ tr '\n' ';'
+ export 'LIT_XFAIL=CodeGen/ARM/sjljeh-swifterror.ll;CodeGen/DirectX/legalize-i8-alloca.ll;CodeGen/WinEH/wineh-comdat.ll;CodeGen/WinEH/wineh-scope-statenumbering.ll;CodeGen/WinEH/wineh-setjmp.ll;CodeGen/WinEH/wineh-statenumbering-cleanups.ll;CodeGen/WinEH/wineh-statenumbering.ll;DebugInfo/Generic/block-asan.ll;Transforms/AtomicExpand/ARM/atomic-expansion-v7.ll;Transforms/CrossDSOCFI/basic.ll;Transforms/CrossDSOCFI/cfi_functions.ll;Transforms/CrossDSOCFI/thumb.ll;Transforms/FixIrreducible/basic.ll;Transforms/FixIrreducible/bug45623.ll;Transforms/FixIrreducible/callbr.ll;Transforms/FixIrreducible/nested.ll;Transforms/FixIrreducible/pr191979.ll;Transforms/FixIrreducible/switch.ll;Transforms/GVN/PRE/pre-load-through-select.ll;Transforms/GVN/PRE/pre-loop-load-through-select.ll;Transforms/GVN/debugloc-load-select.ll;Transforms/GVN/load-select-addr-store-fwd.ll;Transforms/GVN/load-through-select-dbg.ll;Transforms/GVN/opaque-ptr.ll;Transforms/GVN/pr69301.ll;Transforms/IndVarSimplify/debugloc-rem-subst.ll;Transforms/IndVarSimplify/eliminate-rem.ll;Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll;Transforms/IndVarSimplify/pr45835.ll;Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll;Transforms/IndirectBrExpand/basic.ll;Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll;Transforms/InstCombine/X86/x86-avx512.ll;Transforms/InstCombine/bitreverse.ll;Transforms/InstCombine/builtin-dynamic-object-size.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll;Transforms/InstCombine/cast-mul-select.ll;Transforms/InstCombine/clamp-to-minmax.ll;Transforms/InstCombine/fabs.ll;Transforms/InstCombine/fcmp-select.ll;Transforms/InstCombine/ffs-1.ll;Transforms/InstCombine/ffs-i16.ll;Transforms/InstCombine/fmul.ll;Transforms/InstCombine/fneg.ll;Transforms/InstCombine/intrinsic-select.ll;Transforms/InstCombine/ldexp-ext.ll;Transforms/InstCombine/ldexp.ll;Transforms/InstCombine/logical-select.ll;Transforms/InstCombine/lshr.ll;Transforms/InstCombine/memchr-11.ll;Transforms/InstCombine/memchr-2.ll;Transforms/InstCombine/memchr-3.ll;Transforms/InstCombine/memchr-6.ll;Transforms/InstCombine/memchr-7.ll;Transforms/InstCombine/memchr-9.ll;Transforms/InstCombine/memchr.ll;Transforms/InstCombine/memrchr-3.ll;Transforms/InstCombine/memrchr-4.ll;Transforms/InstCombine/minmax-fold.ll;Transforms/InstCombine/minmax-fp.ll;Transforms/InstCombine/minmax-intrinsics.ll;Transforms/InstCombine/mul-inseltpoison.ll;Transforms/InstCombine/mul.ll;Transforms/InstCombine/nested-select.ll;Transforms/InstCombine/pow-1.ll;Transforms/InstCombine/pow-3.ll;Transforms/InstCombine/pow-sqrt.ll;Transforms/InstCombine/pull-conditional-binop-through-shift.ll;Transforms/InstCombine/select-factorize.ll;Transforms/InstCombine/select-min-max.ll;Transforms/InstCombine/select-of-symmetric-selects.ll;Transforms/InstCombine/select-select.ll;Transforms/InstCombine/shift.ll;Transforms/InstCombine/simplify-demanded-fpclass.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-and.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-or.ll;Transforms/InstCombine/strchr-1.ll;Transforms/InstCombine/strchr-3.ll;Transforms/InstCombine/strlen-1.ll;Transforms/InstCombine/strrchr-3.ll;Transforms/InstCombine/sub-xor-cmp.ll;Transforms/InstCombine/truncating-saturate.ll;Transforms/InstCombine/unordered-fcmp-select.ll;Transforms/InstCombine/wcslen-1.ll;Transforms/InstCombine/wcslen-3.ll;Transforms/InstCombine/xor-and-or.ll;Transforms/InstCombine/zext-bool-add-sub.ll;Transforms/LoopIdiom/AArch64/byte-compare-index.ll;Transforms/LoopIdiom/AArch64/find-first-byte.ll;Transforms/LowerAtomic/atomic-load.ll;Transforms/LowerAtomic/atomic-swap.ll;Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll;Transforms/LowerConstantIntrinsics/objectsize_basic.ll;Transforms/OpenMP/always_inline_device.ll;Transforms/OpenMP/custom_state_machines.ll;Transforms/OpenMP/custom_state_machines_remarks.ll;Transforms/OpenMP/get_hardware_num_threads_in_blo
k_fold.ll;Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll;Transforms/OpenMP/parallel_region_merging.ll;Transforms/OpenMP/single_threaded_execution.ll;Transforms/OpenMP/spmdization.ll;Transforms/OpenMP/spmdization_assumes.ll;Transforms/OpenMP/spmdization_guarding.ll;Transforms/OpenMP/spmdization_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_indirect.ll;Transforms/OpenMP/spmdization_no_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_remarks.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-exp.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math-binary.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-log.ll;Transforms/StackProtector/cross-dso-cfi-stack-chk-fail.ll;Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll;Transforms/TailCallElim/accum_recursion.ll;Transforms/TailCallElim/basic.ll;Transforms/TailCallElim/debugloc.ll;Transforms/TailCallElim/dropping_debugloc_acc_rec_inst_rnew.ll;Transforms/TailCallElim/inf-recursion.ll;Transforms/Util/control-flow-hub-finalize-same-succ-crash.ll;Transforms/Util/libcalls-opt-remarks.ll;Transforms/Util/lowerswitch.ll;tools/opt/mtune.ll;'
+ LIT_XFAIL='CodeGen/ARM/sjljeh-swifterror.ll;CodeGen/DirectX/legalize-i8-alloca.ll;CodeGen/WinEH/wineh-comdat.ll;CodeGen/WinEH/wineh-scope-statenumbering.ll;CodeGen/WinEH/wineh-setjmp.ll;CodeGen/WinEH/wineh-statenumbering-cleanups.ll;CodeGen/WinEH/wineh-statenumbering.ll;DebugInfo/Generic/block-asan.ll;Transforms/AtomicExpand/ARM/atomic-expansion-v7.ll;Transforms/CrossDSOCFI/basic.ll;Transforms/CrossDSOCFI/cfi_functions.ll;Transforms/CrossDSOCFI/thumb.ll;Transforms/FixIrreducible/basic.ll;Transforms/FixIrreducible/bug45623.ll;Transforms/FixIrreducible/callbr.ll;Transforms/FixIrreducible/nested.ll;Transforms/FixIrreducible/pr191979.ll;Transforms/FixIrreducible/switch.ll;Transforms/GVN/PRE/pre-load-through-select.ll;Transforms/GVN/PRE/pre-loop-load-through-select.ll;Transforms/GVN/debugloc-load-select.ll;Transforms/GVN/load-select-addr-store-fwd.ll;Transforms/GVN/load-through-select-dbg.ll;Transforms/GVN/opaque-ptr.ll;Transforms/GVN/pr69301.ll;Transforms/IndVarSimplify/debugloc-rem-subst.ll;Transforms/IndVarSimplify/eliminate-rem.ll;Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll;Transforms/IndVarSimplify/pr45835.ll;Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll;Transforms/IndirectBrExpand/basic.ll;Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll;Transforms/InstCombine/X86/x86-avx512.ll;Transforms/InstCombine/bitreverse.ll;Transforms/InstCombine/builtin-dynamic-object-size.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll;Transforms/InstCombine/cast-mul-select.ll;Transforms/InstCombine/clamp-to-minmax.ll;Transforms/InstCombine/fabs.ll;Transforms/InstCombine/fcmp-select.ll;Transforms/InstCombine/ffs-1.ll;Transforms/InstCombine/ffs-i16.ll;Transforms/InstCombine/fmul.ll;Transforms/InstCombine/fneg.ll;Transforms/InstCombine/intrinsic-select.ll;Transforms/InstCombine/ldexp-ext.ll;Transforms/InstCombine/ldexp.ll;Transforms/InstCombine/logical-select.ll;Transforms/InstCombine/lshr.ll;Transforms/InstCombine/memchr-11.ll;Transforms/InstCombine/memchr-2.ll;Transforms/InstCombine/memchr-3.ll;Transforms/InstCombine/memchr-6.ll;Transforms/InstCombine/memchr-7.ll;Transforms/InstCombine/memchr-9.ll;Transforms/InstCombine/memchr.ll;Transforms/InstCombine/memrchr-3.ll;Transforms/InstCombine/memrchr-4.ll;Transforms/InstCombine/minmax-fold.ll;Transforms/InstCombine/minmax-fp.ll;Transforms/InstCombine/minmax-intrinsics.ll;Transforms/InstCombine/mul-inseltpoison.ll;Transforms/InstCombine/mul.ll;Transforms/InstCombine/nested-select.ll;Transforms/InstCombine/pow-1.ll;Transforms/InstCombine/pow-3.ll;Transforms/InstCombine/pow-sqrt.ll;Transforms/InstCombine/pull-conditional-binop-through-shift.ll;Transforms/InstCombine/select-factorize.ll;Transforms/InstCombine/select-min-max.ll;Transforms/InstCombine/select-of-symmetric-selects.ll;Transforms/InstCombine/select-select.ll;Transforms/InstCombine/shift.ll;Transforms/InstCombine/simplify-demanded-fpclass.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-and.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-or.ll;Transforms/InstCombine/strchr-1.ll;Transforms/InstCombine/strchr-3.ll;Transforms/InstCombine/strlen-1.ll;Transforms/InstCombine/strrchr-3.ll;Transforms/InstCombine/sub-xor-cmp.ll;Transforms/InstCombine/truncating-saturate.ll;Transforms/InstCombine/unordered-fcmp-select.ll;Transforms/InstCombine/wcslen-1.ll;Transforms/InstCombine/wcslen-3.ll;Transforms/InstCombine/xor-and-or.ll;Transforms/InstCombine/zext-bool-add-sub.ll;Transforms/LoopIdiom/AArch64/byte-compare-index.ll;Transforms/LoopIdiom/AArch64/find-first-byte.ll;Transforms/LowerAtomic/atomic-load.ll;Transforms/LowerAtomic/atomic-swap.ll;Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll;Transforms/LowerConstantIntrinsics/objectsize_basic.ll;Transforms/OpenMP/always_inline_device.ll;Transforms/OpenMP/custom_state_machines.ll;Transforms/OpenMP/custom_state_machines_remarks.ll;Transforms/OpenMP/get_hardware_num_threads_in_block_fold
ll;Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll;Transforms/OpenMP/parallel_region_merging.ll;Transforms/OpenMP/single_threaded_execution.ll;Transforms/OpenMP/spmdization.ll;Transforms/OpenMP/spmdization_assumes.ll;Transforms/OpenMP/spmdization_guarding.ll;Transforms/OpenMP/spmdization_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_indirect.ll;Transforms/OpenMP/spmdization_no_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_remarks.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-exp.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math-binary.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-log.ll;Transforms/StackProtector/cross-dso-cfi-stack-chk-fail.ll;Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll;Transforms/TailCallElim/accum_recursion.ll;Transforms/TailCallElim/basic.ll;Transforms/TailCallElim/debugloc.ll;Transforms/TailCallElim/dropping_debugloc_acc_rec_inst_rnew.ll;Transforms/TailCallElim/inf-recursion.ll;Transforms/Util/control-flow-hub-finalize-same-succ-crash.ll;Transforms/Util/libcalls-opt-remarks.ll;Transforms/Util/lowerswitch.ll;tools/opt/mtune.ll;'
+ ninja check-llvm
[1/167] Generating VCSRevision.h
[2/167] Building CXX object lib/MC/CMakeFiles/LLVMMC.dir/DXContainerInfo.cpp.o
[3/167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o 
ccache /usr/bin/c++ -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/profcheck-build/build/unittests/Support -I/b/profcheck-build/llvm-project/llvm/unittests/Support -I/b/profcheck-build/build/include -I/b/profcheck-build/llvm-project/llvm/include -I/b/profcheck-build/llvm-project/third-party/unittest/googletest/include -I/b/profcheck-build/llvm-project/third-party/unittest/googlemock/include -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 -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -O3 -DNDEBUG -UNDEBUG -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -std=c++17 -Winvalid-pch -Xclang -include-pch -Xclang /b/profcheck-build/build/lib/Support/CMakeFiles/LLVMSupport.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /b/profcheck-build/build/lib/Support/CMakeFiles/LLVMSupport.dir/cmake_pch.hxx -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o -c /b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:34:29: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   34 |   EXPECT_EQ(Negative, Known.SignBit);
      |                       ~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:47:24: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   47 |     ASSERT_EQ(Expected.SignBit, Known.SignBit) << RawBits;
      |               ~~~~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:47:39: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   47 |     ASSERT_EQ(Expected.SignBit, Known.SignBit) << RawBits;
      |                                 ~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:59:33: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   59 |   EXPECT_EQ(std::nullopt, Known.SignBit);
      |                           ~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:71:33: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   71 |   EXPECT_EQ(std::nullopt, Known.SignBit);
      |                           ~~~~~ ^
5 errors generated.
[4/167] Linking CXX static library lib/libLLVMMC.a
[5/167] Building CXX object tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.o
[6/167] Building CXX object lib/Object/CMakeFiles/LLVMObject.dir/IRSymtab.cpp.o
[7/167] Building CXX object unittests/ObjectYAML/CMakeFiles/ObjectYAMLTests.dir/DXContainerYAMLTest.cpp.o
[8/167] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
In file included from <built-in>:1:
In file included from /b/profcheck-build/build/lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/cmake_pch.hxx:5:
In file included from /b/profcheck-build/llvm-project/llvm/include/llvm/CodeGen/pch.h:13:
In file included from /b/profcheck-build/llvm-project/llvm/include/llvm/CodeGen/MachineFrameInfo.h:16:
In file included from /b/profcheck-build/llvm-project/llvm/include/llvm/ADT/SmallVector.h:20:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/algorithm:61:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8: warning: 'get_temporary_buffer<llvm::AsmPrinter::Structor>' is deprecated [-Wdeprecated-declarations]
  263 |                 std::get_temporary_buffer<value_type>(_M_original_len));
      |                      ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:4996:15: note: in instantiation of member function 'std::_Temporary_buffer<llvm::AsmPrinter::Structor *, llvm::AsmPrinter::Structor>::_Temporary_buffer' requested here
 4996 |       _TmpBuf __buf(__first, (__last - __first + 1) / 2);
      |               ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:5070:23: note: in instantiation of function template specialization 'std::__stable_sort<llvm::AsmPrinter::Structor *, __gnu_cxx::__ops::_Iter_comp_iter<(lambda at /b/profcheck-build/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3725:32)>>' requested here
 5070 |       _GLIBCXX_STD_A::__stable_sort(__first, __last,
      |                       ^
Step 7 (Ninja) failure: Ninja (failure)
...
++ cat ../llvm-project/llvm/utils/profcheck-xfail.txt
++ tr '\n' ';'
+ export 'LIT_XFAIL=CodeGen/ARM/sjljeh-swifterror.ll;CodeGen/DirectX/legalize-i8-alloca.ll;CodeGen/WinEH/wineh-comdat.ll;CodeGen/WinEH/wineh-scope-statenumbering.ll;CodeGen/WinEH/wineh-setjmp.ll;CodeGen/WinEH/wineh-statenumbering-cleanups.ll;CodeGen/WinEH/wineh-statenumbering.ll;DebugInfo/Generic/block-asan.ll;Transforms/AtomicExpand/ARM/atomic-expansion-v7.ll;Transforms/CrossDSOCFI/basic.ll;Transforms/CrossDSOCFI/cfi_functions.ll;Transforms/CrossDSOCFI/thumb.ll;Transforms/FixIrreducible/basic.ll;Transforms/FixIrreducible/bug45623.ll;Transforms/FixIrreducible/callbr.ll;Transforms/FixIrreducible/nested.ll;Transforms/FixIrreducible/pr191979.ll;Transforms/FixIrreducible/switch.ll;Transforms/GVN/PRE/pre-load-through-select.ll;Transforms/GVN/PRE/pre-loop-load-through-select.ll;Transforms/GVN/debugloc-load-select.ll;Transforms/GVN/load-select-addr-store-fwd.ll;Transforms/GVN/load-through-select-dbg.ll;Transforms/GVN/opaque-ptr.ll;Transforms/GVN/pr69301.ll;Transforms/IndVarSimplify/debugloc-rem-subst.ll;Transforms/IndVarSimplify/eliminate-rem.ll;Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll;Transforms/IndVarSimplify/pr45835.ll;Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll;Transforms/IndirectBrExpand/basic.ll;Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll;Transforms/InstCombine/X86/x86-avx512.ll;Transforms/InstCombine/bitreverse.ll;Transforms/InstCombine/builtin-dynamic-object-size.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll;Transforms/InstCombine/cast-mul-select.ll;Transforms/InstCombine/clamp-to-minmax.ll;Transforms/InstCombine/fabs.ll;Transforms/InstCombine/fcmp-select.ll;Transforms/InstCombine/ffs-1.ll;Transforms/InstCombine/ffs-i16.ll;Transforms/InstCombine/fmul.ll;Transforms/InstCombine/fneg.ll;Transforms/InstCombine/intrinsic-select.ll;Transforms/InstCombine/ldexp-ext.ll;Transforms/InstCombine/ldexp.ll;Transforms/InstCombine/logical-select.ll;Transforms/InstCombine/lshr.ll;Transforms/InstCombine/memchr-11.ll;Transforms/InstCombine/memchr-2.ll;Transforms/InstCombine/memchr-3.ll;Transforms/InstCombine/memchr-6.ll;Transforms/InstCombine/memchr-7.ll;Transforms/InstCombine/memchr-9.ll;Transforms/InstCombine/memchr.ll;Transforms/InstCombine/memrchr-3.ll;Transforms/InstCombine/memrchr-4.ll;Transforms/InstCombine/minmax-fold.ll;Transforms/InstCombine/minmax-fp.ll;Transforms/InstCombine/minmax-intrinsics.ll;Transforms/InstCombine/mul-inseltpoison.ll;Transforms/InstCombine/mul.ll;Transforms/InstCombine/nested-select.ll;Transforms/InstCombine/pow-1.ll;Transforms/InstCombine/pow-3.ll;Transforms/InstCombine/pow-sqrt.ll;Transforms/InstCombine/pull-conditional-binop-through-shift.ll;Transforms/InstCombine/select-factorize.ll;Transforms/InstCombine/select-min-max.ll;Transforms/InstCombine/select-of-symmetric-selects.ll;Transforms/InstCombine/select-select.ll;Transforms/InstCombine/shift.ll;Transforms/InstCombine/simplify-demanded-fpclass.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-and.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-or.ll;Transforms/InstCombine/strchr-1.ll;Transforms/InstCombine/strchr-3.ll;Transforms/InstCombine/strlen-1.ll;Transforms/InstCombine/strrchr-3.ll;Transforms/InstCombine/sub-xor-cmp.ll;Transforms/InstCombine/truncating-saturate.ll;Transforms/InstCombine/unordered-fcmp-select.ll;Transforms/InstCombine/wcslen-1.ll;Transforms/InstCombine/wcslen-3.ll;Transforms/InstCombine/xor-and-or.ll;Transforms/InstCombine/zext-bool-add-sub.ll;Transforms/LoopIdiom/AArch64/byte-compare-index.ll;Transforms/LoopIdiom/AArch64/find-first-byte.ll;Transforms/LowerAtomic/atomic-load.ll;Transforms/LowerAtomic/atomic-swap.ll;Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll;Transforms/LowerConstantIntrinsics/objectsize_basic.ll;Transforms/OpenMP/always_inline_device.ll;Transforms/OpenMP/custom_state_machines.ll;Transforms/OpenMP/custom_state_machines_remarks.ll;Transforms/OpenMP/get_hardware_num_threads_in_blo
k_fold.ll;Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll;Transforms/OpenMP/parallel_region_merging.ll;Transforms/OpenMP/single_threaded_execution.ll;Transforms/OpenMP/spmdization.ll;Transforms/OpenMP/spmdization_assumes.ll;Transforms/OpenMP/spmdization_guarding.ll;Transforms/OpenMP/spmdization_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_indirect.ll;Transforms/OpenMP/spmdization_no_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_remarks.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-exp.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math-binary.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-log.ll;Transforms/StackProtector/cross-dso-cfi-stack-chk-fail.ll;Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll;Transforms/TailCallElim/accum_recursion.ll;Transforms/TailCallElim/basic.ll;Transforms/TailCallElim/debugloc.ll;Transforms/TailCallElim/dropping_debugloc_acc_rec_inst_rnew.ll;Transforms/TailCallElim/inf-recursion.ll;Transforms/Util/control-flow-hub-finalize-same-succ-crash.ll;Transforms/Util/libcalls-opt-remarks.ll;Transforms/Util/lowerswitch.ll;tools/opt/mtune.ll;'
+ LIT_XFAIL='CodeGen/ARM/sjljeh-swifterror.ll;CodeGen/DirectX/legalize-i8-alloca.ll;CodeGen/WinEH/wineh-comdat.ll;CodeGen/WinEH/wineh-scope-statenumbering.ll;CodeGen/WinEH/wineh-setjmp.ll;CodeGen/WinEH/wineh-statenumbering-cleanups.ll;CodeGen/WinEH/wineh-statenumbering.ll;DebugInfo/Generic/block-asan.ll;Transforms/AtomicExpand/ARM/atomic-expansion-v7.ll;Transforms/CrossDSOCFI/basic.ll;Transforms/CrossDSOCFI/cfi_functions.ll;Transforms/CrossDSOCFI/thumb.ll;Transforms/FixIrreducible/basic.ll;Transforms/FixIrreducible/bug45623.ll;Transforms/FixIrreducible/callbr.ll;Transforms/FixIrreducible/nested.ll;Transforms/FixIrreducible/pr191979.ll;Transforms/FixIrreducible/switch.ll;Transforms/GVN/PRE/pre-load-through-select.ll;Transforms/GVN/PRE/pre-loop-load-through-select.ll;Transforms/GVN/debugloc-load-select.ll;Transforms/GVN/load-select-addr-store-fwd.ll;Transforms/GVN/load-through-select-dbg.ll;Transforms/GVN/opaque-ptr.ll;Transforms/GVN/pr69301.ll;Transforms/IndVarSimplify/debugloc-rem-subst.ll;Transforms/IndVarSimplify/eliminate-rem.ll;Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll;Transforms/IndVarSimplify/pr45835.ll;Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll;Transforms/IndirectBrExpand/basic.ll;Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll;Transforms/InstCombine/X86/x86-avx512.ll;Transforms/InstCombine/bitreverse.ll;Transforms/InstCombine/builtin-dynamic-object-size.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll;Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll;Transforms/InstCombine/cast-mul-select.ll;Transforms/InstCombine/clamp-to-minmax.ll;Transforms/InstCombine/fabs.ll;Transforms/InstCombine/fcmp-select.ll;Transforms/InstCombine/ffs-1.ll;Transforms/InstCombine/ffs-i16.ll;Transforms/InstCombine/fmul.ll;Transforms/InstCombine/fneg.ll;Transforms/InstCombine/intrinsic-select.ll;Transforms/InstCombine/ldexp-ext.ll;Transforms/InstCombine/ldexp.ll;Transforms/InstCombine/logical-select.ll;Transforms/InstCombine/lshr.ll;Transforms/InstCombine/memchr-11.ll;Transforms/InstCombine/memchr-2.ll;Transforms/InstCombine/memchr-3.ll;Transforms/InstCombine/memchr-6.ll;Transforms/InstCombine/memchr-7.ll;Transforms/InstCombine/memchr-9.ll;Transforms/InstCombine/memchr.ll;Transforms/InstCombine/memrchr-3.ll;Transforms/InstCombine/memrchr-4.ll;Transforms/InstCombine/minmax-fold.ll;Transforms/InstCombine/minmax-fp.ll;Transforms/InstCombine/minmax-intrinsics.ll;Transforms/InstCombine/mul-inseltpoison.ll;Transforms/InstCombine/mul.ll;Transforms/InstCombine/nested-select.ll;Transforms/InstCombine/pow-1.ll;Transforms/InstCombine/pow-3.ll;Transforms/InstCombine/pow-sqrt.ll;Transforms/InstCombine/pull-conditional-binop-through-shift.ll;Transforms/InstCombine/select-factorize.ll;Transforms/InstCombine/select-min-max.ll;Transforms/InstCombine/select-of-symmetric-selects.ll;Transforms/InstCombine/select-select.ll;Transforms/InstCombine/shift.ll;Transforms/InstCombine/simplify-demanded-fpclass.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-and.ll;Transforms/InstCombine/sink-not-into-another-hand-of-logical-or.ll;Transforms/InstCombine/strchr-1.ll;Transforms/InstCombine/strchr-3.ll;Transforms/InstCombine/strlen-1.ll;Transforms/InstCombine/strrchr-3.ll;Transforms/InstCombine/sub-xor-cmp.ll;Transforms/InstCombine/truncating-saturate.ll;Transforms/InstCombine/unordered-fcmp-select.ll;Transforms/InstCombine/wcslen-1.ll;Transforms/InstCombine/wcslen-3.ll;Transforms/InstCombine/xor-and-or.ll;Transforms/InstCombine/zext-bool-add-sub.ll;Transforms/LoopIdiom/AArch64/byte-compare-index.ll;Transforms/LoopIdiom/AArch64/find-first-byte.ll;Transforms/LowerAtomic/atomic-load.ll;Transforms/LowerAtomic/atomic-swap.ll;Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll;Transforms/LowerConstantIntrinsics/objectsize_basic.ll;Transforms/OpenMP/always_inline_device.ll;Transforms/OpenMP/custom_state_machines.ll;Transforms/OpenMP/custom_state_machines_remarks.ll;Transforms/OpenMP/get_hardware_num_threads_in_block_fold
ll;Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll;Transforms/OpenMP/parallel_region_merging.ll;Transforms/OpenMP/single_threaded_execution.ll;Transforms/OpenMP/spmdization.ll;Transforms/OpenMP/spmdization_assumes.ll;Transforms/OpenMP/spmdization_guarding.ll;Transforms/OpenMP/spmdization_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_indirect.ll;Transforms/OpenMP/spmdization_no_guarding_two_reaching_kernels.ll;Transforms/OpenMP/spmdization_remarks.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-exp.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math-binary.ll;Transforms/PreISelIntrinsicLowering/AArch64/expand-log.ll;Transforms/StackProtector/cross-dso-cfi-stack-chk-fail.ll;Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll;Transforms/TailCallElim/accum_recursion.ll;Transforms/TailCallElim/basic.ll;Transforms/TailCallElim/debugloc.ll;Transforms/TailCallElim/dropping_debugloc_acc_rec_inst_rnew.ll;Transforms/TailCallElim/inf-recursion.ll;Transforms/Util/control-flow-hub-finalize-same-succ-crash.ll;Transforms/Util/libcalls-opt-remarks.ll;Transforms/Util/lowerswitch.ll;tools/opt/mtune.ll;'
+ ninja check-llvm
[1/167] Generating VCSRevision.h
[2/167] Building CXX object lib/MC/CMakeFiles/LLVMMC.dir/DXContainerInfo.cpp.o
[3/167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o 
ccache /usr/bin/c++ -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/profcheck-build/build/unittests/Support -I/b/profcheck-build/llvm-project/llvm/unittests/Support -I/b/profcheck-build/build/include -I/b/profcheck-build/llvm-project/llvm/include -I/b/profcheck-build/llvm-project/third-party/unittest/googletest/include -I/b/profcheck-build/llvm-project/third-party/unittest/googlemock/include -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 -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -O3 -DNDEBUG -UNDEBUG -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -std=c++17 -Winvalid-pch -Xclang -include-pch -Xclang /b/profcheck-build/build/lib/Support/CMakeFiles/LLVMSupport.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /b/profcheck-build/build/lib/Support/CMakeFiles/LLVMSupport.dir/cmake_pch.hxx -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/KnownFPClassTest.cpp.o -c /b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:34:29: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   34 |   EXPECT_EQ(Negative, Known.SignBit);
      |                       ~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:47:24: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   47 |     ASSERT_EQ(Expected.SignBit, Known.SignBit) << RawBits;
      |               ~~~~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:47:39: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   47 |     ASSERT_EQ(Expected.SignBit, Known.SignBit) << RawBits;
      |                                 ~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:59:33: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   59 |   EXPECT_EQ(std::nullopt, Known.SignBit);
      |                           ~~~~~ ^
/b/profcheck-build/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:71:33: error: no member named 'SignBit' in 'llvm::KnownFPClass'
   71 |   EXPECT_EQ(std::nullopt, Known.SignBit);
      |                           ~~~~~ ^
5 errors generated.
[4/167] Linking CXX static library lib/libLLVMMC.a
[5/167] Building CXX object tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.o
[6/167] Building CXX object lib/Object/CMakeFiles/LLVMObject.dir/IRSymtab.cpp.o
[7/167] Building CXX object unittests/ObjectYAML/CMakeFiles/ObjectYAMLTests.dir/DXContainerYAMLTest.cpp.o
[8/167] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
In file included from <built-in>:1:
In file included from /b/profcheck-build/build/lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/cmake_pch.hxx:5:
In file included from /b/profcheck-build/llvm-project/llvm/include/llvm/CodeGen/pch.h:13:
In file included from /b/profcheck-build/llvm-project/llvm/include/llvm/CodeGen/MachineFrameInfo.h:16:
In file included from /b/profcheck-build/llvm-project/llvm/include/llvm/ADT/SmallVector.h:20:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/algorithm:61:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8: warning: 'get_temporary_buffer<llvm::AsmPrinter::Structor>' is deprecated [-Wdeprecated-declarations]
  263 |                 std::get_temporary_buffer<value_type>(_M_original_len));
      |                      ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:4996:15: note: in instantiation of member function 'std::_Temporary_buffer<llvm::AsmPrinter::Structor *, llvm::AsmPrinter::Structor>::_Temporary_buffer' requested here
 4996 |       _TmpBuf __buf(__first, (__last - __first + 1) / 2);
      |               ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:5070:23: note: in instantiation of function template specialization 'std::__stable_sort<llvm::AsmPrinter::Structor *, __gnu_cxx::__ops::_Iter_comp_iter<(lambda at /b/profcheck-build/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3725:32)>>' requested here
 5070 |       _GLIBCXX_STD_A::__stable_sort(__first, __last,
      |                       ^

@jroelofs

jroelofs commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/cherry-pick 234ce03

@llvmbot

llvmbot commented Sep 1, 2026

Copy link
Copy Markdown
Member

/pull-request #220313

// the amount needed to keep FPDiff aligned, and therefore preserve the
// required alignment going into the callee.
FPDiff -= offsetToAlignment(FPDiff, StackAlign);
NumBytes += offsetToAlignment(FPDiff, StackAlign);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, this should have been done in the other order.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

jroelofs added a commit that referenced this pull request Sep 1, 2026
…lls with FPDiff" (#220419)

Reverts #217156

I noticed an issue with it right after it landed, and to simplify
cherry-picking, I'm going to revert and re-land. See:
#220406 for the re-land.
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Sep 1, 2026
…all tail calls with FPDiff" (#220419)

Reverts llvm/llvm-project#217156

I noticed an issue with it right after it landed, and to simplify
cherry-picking, I'm going to revert and re-land. See:
llvm/llvm-project#220406 for the re-land.
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 1, 2026
…all tail calls with FPDiff" (#220419)

Reverts llvm/llvm-project#217156

I noticed an issue with it right after it landed, and to simplify
cherry-picking, I'm going to revert and re-land. See:
llvm/llvm-project#220406 for the re-land.
nekoshirro pushed a commit to nekoshirro/Alchemist-LLVM that referenced this pull request Sep 2, 2026
…lls with FPDiff" (#220419)

Reverts llvm/llvm-project#217156

I noticed an issue with it right after it landed, and to simplify
cherry-picking, I'm going to revert and re-land. See:
llvm/llvm-project#220406 for the re-land.
Signed-off-by: Hafidz Muzakky <[email protected]>
Iasonaskrpr pushed a commit to Iasonaskrpr/llvm-project that referenced this pull request Sep 4, 2026
… FPDiff (llvm#217156)

When a caller has a non-multiple of the minimum stack alignment more
argument stack space than the callee it is tail calling, we need to
ensure that the resulting FPDiff's magnitude has been rounded up to a
multiple of the platform's minimum stack alignment.

rdar://184474075
Iasonaskrpr pushed a commit to Iasonaskrpr/llvm-project that referenced this pull request Sep 4, 2026
…lls with FPDiff" (llvm#220419)

Reverts llvm#217156

I noticed an issue with it right after it landed, and to simplify
cherry-picking, I'm going to revert and re-land. See:
llvm#220406 for the re-land.
asudarsa-qti pushed a commit to asudarsa-qti/llvm-project that referenced this pull request Sep 4, 2026
… FPDiff (llvm#217156)

When a caller has a non-multiple of the minimum stack alignment more
argument stack space than the callee it is tail calling, we need to
ensure that the resulting FPDiff's magnitude has been rounded up to a
multiple of the platform's minimum stack alignment.

rdar://184474075
asudarsa-qti pushed a commit to asudarsa-qti/llvm-project that referenced this pull request Sep 4, 2026
…lls with FPDiff" (llvm#220419)

Reverts llvm#217156

I noticed an issue with it right after it landed, and to simplify
cherry-picking, I'm going to revert and re-land. See:
llvm#220406 for the re-land.
addmisol pushed a commit to addmisol/llvm-project2 that referenced this pull request Sep 6, 2026
… FPDiff (llvm#217156)

When a caller has a non-multiple of the minimum stack alignment more
argument stack space than the callee it is tail calling, we need to
ensure that the resulting FPDiff's magnitude has been rounded up to a
multiple of the platform's minimum stack alignment.

rdar://184474075
addmisol pushed a commit to addmisol/llvm-project2 that referenced this pull request Sep 6, 2026
…lls with FPDiff" (llvm#220419)

Reverts llvm#217156

I noticed an issue with it right after it landed, and to simplify
cherry-picking, I'm going to revert and re-land. See:
llvm#220406 for the re-land.
jroelofs added a commit to jroelofs/llvm-project that referenced this pull request Sep 11, 2026
jroelofs added a commit to jroelofs/llvm-project that referenced this pull request Sep 14, 2026
This fixes another subtle bug in frame accounting (see: llvm#217156 / llvm#220406), for
tail calls that have a non-multiple of 16 bytes worth of stack arg area, and
need that stack arg re-use to be increased to cover the alignment requirement.
This is best illustrated with callers containing 8 formal arguments covering the
first 8 GPRs (x0-x7), followed by 9 bytes of argument passed on the stack.

In a callee-pops tail call (e.g. tailcc/swifttailcc), the set of reusable stack
arg area bytes has already been sufficiently aligned by LowerFormalArguments, so
growing NumBytes up to StackAlign is enough to consume that excess. Otherwise
(e.g. a plain C-convention call, forced off the sibcall path, as in the
aarch64_inout_za tests), we can't rely on either having been pre-aligned, so we
round NumBytes up to the same residue mod StackAlign as NumReusableBytes, which
cancels the residue out of their difference (FPDiff), thus keeping the stack
aligned going into the callee.

Concretely, llvm#220406 computed the Realign distance needed to round FPDiff up to
the next multiple of StackAlign, then subtracted that from FPDiff. Subtracting
that round-up distance overshoots rounding down to the nearest multiple, and in
general arrives at a value that may not even be a multiple of StackAlign. For
example, in @caller_last_stack_arg_i64 we had NumReusableBytes=8 and NumBytes=1
for an FPDiff of 7, which computed Realign=9, FPDiff=-2, NumBytes=10 instead of
the intended NumBytes=8, FPDiff=0.

rdar://187331378
jroelofs added a commit that referenced this pull request Sep 16, 2026
…ls (#223545)

This fixes another subtle bug in frame accounting (see: #217156 /
#220406), for tail calls that have a non-multiple of 16 bytes worth of
stack arg area, and need that stack arg re-use to be increased to cover
the alignment requirement. This is best illustrated with callers
containing 8 formal arguments covering the first 8 GPRs (x0-x7),
followed by 9 bytes of argument passed on the stack.

In a callee-pops tail call (e.g. tailcc/swifttailcc), the set of
reusable stack arg area bytes has already been sufficiently aligned by
LowerFormalArguments, so growing NumBytes up to StackAlign is enough to
consume that excess. Otherwise (e.g. a plain C-convention call, forced
off the sibcall path, as in the aarch64_inout_za tests), we can't rely
on either having been pre-aligned, so we round NumBytes up to the same
residue mod StackAlign as NumReusableBytes, which cancels the residue
out of their difference (FPDiff), thus keeping the stack aligned going
into the callee.

Concretely, #220406 computed the Realign distance needed to round FPDiff
up to the next multiple of StackAlign, then subtracted that from FPDiff.
Subtracting that round-up distance overshoots rounding down to the
nearest multiple, and in general arrives at a value that may not even be
a multiple of StackAlign. For example, in @caller_last_stack_arg_i64 we
had NumReusableBytes=8 and NumBytes=1 for an FPDiff of 7, which computed
Realign=9, FPDiff=-2, NumBytes=10 instead of the intended NumBytes=8,
FPDiff=0.

rdar://187331378
yebinchon pushed a commit to yebinchon/llvm-project that referenced this pull request Sep 18, 2026
…ls (llvm#223545)

This fixes another subtle bug in frame accounting (see: llvm#217156 /
llvm#220406), for tail calls that have a non-multiple of 16 bytes worth of
stack arg area, and need that stack arg re-use to be increased to cover
the alignment requirement. This is best illustrated with callers
containing 8 formal arguments covering the first 8 GPRs (x0-x7),
followed by 9 bytes of argument passed on the stack.

In a callee-pops tail call (e.g. tailcc/swifttailcc), the set of
reusable stack arg area bytes has already been sufficiently aligned by
LowerFormalArguments, so growing NumBytes up to StackAlign is enough to
consume that excess. Otherwise (e.g. a plain C-convention call, forced
off the sibcall path, as in the aarch64_inout_za tests), we can't rely
on either having been pre-aligned, so we round NumBytes up to the same
residue mod StackAlign as NumReusableBytes, which cancels the residue
out of their difference (FPDiff), thus keeping the stack aligned going
into the callee.

Concretely, llvm#220406 computed the Realign distance needed to round FPDiff
up to the next multiple of StackAlign, then subtracted that from FPDiff.
Subtracting that round-up distance overshoots rounding down to the
nearest multiple, and in general arrives at a value that may not even be
a multiple of StackAlign. For example, in @caller_last_stack_arg_i64 we
had NumReusableBytes=8 and NumBytes=1 for an FPDiff of 7, which computed
Realign=9, FPDiff=-2, NumBytes=10 instead of the intended NumBytes=8,
FPDiff=0.

rdar://187331378
jroelofs added a commit to jroelofs/llvm-project that referenced this pull request Sep 18, 2026
…ls (llvm#223545)

This fixes another subtle bug in frame accounting (see: llvm#217156 /
llvm#220406), for tail calls that have a non-multiple of 16 bytes worth of
stack arg area, and need that stack arg re-use to be increased to cover
the alignment requirement. This is best illustrated with callers
containing 8 formal arguments covering the first 8 GPRs (x0-x7),
followed by 9 bytes of argument passed on the stack.

In a callee-pops tail call (e.g. tailcc/swifttailcc), the set of
reusable stack arg area bytes has already been sufficiently aligned by
LowerFormalArguments, so growing NumBytes up to StackAlign is enough to
consume that excess. Otherwise (e.g. a plain C-convention call, forced
off the sibcall path, as in the aarch64_inout_za tests), we can't rely
on either having been pre-aligned, so we round NumBytes up to the same
residue mod StackAlign as NumReusableBytes, which cancels the residue
out of their difference (FPDiff), thus keeping the stack aligned going
into the callee.

Concretely, llvm#220406 computed the Realign distance needed to round FPDiff
up to the next multiple of StackAlign, then subtracted that from FPDiff.
Subtracting that round-up distance overshoots rounding down to the
nearest multiple, and in general arrives at a value that may not even be
a multiple of StackAlign. For example, in @caller_last_stack_arg_i64 we
had NumReusableBytes=8 and NumBytes=1 for an FPDiff of 7, which computed
Realign=9, FPDiff=-2, NumBytes=10 instead of the intended NumBytes=8,
FPDiff=0.

rdar://187331378
(cherry picked from commit ec4d25a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants