llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.92k stars 11.52k forks source link

[Attributes] report `musttail` on intrinsic calls #91347

Open jsji opened 4 months ago

jsji commented 4 months ago

arsenm commented 6 hours ago declare range(i64 0, 2) i64 @llvm.llround.f32(float) nounwind readnone define i64 @testmsxs(float %x) { entry: %0 = musttail call i64 @llvm.llround.f32(float %x) ret i64 %0 }

I'm surprised we allow musttail on intrinsic calls, which aren't really supposed to have ABI

jsji commented 4 months ago

@arsenm FYI. Had a quick run, we have quite some usage of mustail on intrinsic calls.

eg:

Failed Tests (46): LLVM :: CodeGen/X86/cfguard-checks.ll LLVM :: CodeGen/X86/fast-isel-disable-tail-calls.ll LLVM :: CodeGen/X86/icall-branch-funnel.ll LLVM :: CodeGen/X86/musttail-fastcall.ll LLVM :: CodeGen/X86/musttail-indirect.ll LLVM :: CodeGen/X86/musttail-varargs.ll LLVM :: CodeGen/X86/musttail.ll LLVM :: DebugInfo/COFF/thunk.ll LLVM :: ThinLTO/X86/cfi-devirt.ll LLVM :: ThinLTO/X86/devirt-after-icp.ll LLVM :: ThinLTO/X86/devirt.ll LLVM :: ThinLTO/X86/devirt2.ll LLVM :: ThinLTO/X86/devirt_function_alias.ll LLVM :: ThinLTO/X86/devirt_vcall_vis_hidden.ll LLVM :: ThinLTO/X86/devirt_vcall_vis_public.ll LLVM :: Transforms/Attributor/callgraph.ll LLVM :: Transforms/Coroutines/coro-await-suspend-lower-invoke.ll LLVM :: Transforms/Coroutines/coro-await-suspend-lower.ll LLVM :: Transforms/Coroutines/coro-elide-musttail.ll LLVM :: Transforms/Coroutines/coro-only-destroy-when-complete.ll LLVM :: Transforms/Coroutines/coro-preserve-final.ll LLVM :: Transforms/Coroutines/coro-split-musttail-chain-pgo-counter-promo.ll LLVM :: Transforms/Coroutines/coro-split-musttail-ppc64le.ll LLVM :: Transforms/Coroutines/coro-split-musttail.ll LLVM :: Transforms/Coroutines/coro-split-musttail1.ll LLVM :: Transforms/Coroutines/coro-split-musttail3.ll LLVM :: Transforms/DeadArgElim/musttail-indirect.ll LLVM :: Transforms/Inline/inline-brunch-funnel.ll LLVM :: Transforms/Inline/inline-varargs.ll LLVM :: Transforms/InstCombine/musttail-thunk.ll LLVM :: Transforms/InstSimplify/call.ll LLVM :: Transforms/JumpTableToSwitch/skip.ll LLVM :: Transforms/LowerTypeTests/icall-branch-funnel.ll LLVM :: Transforms/PGOProfile/indirect_call_promotion_musttail.ll LLVM :: Transforms/PGOProfile/indirect_call_promotion_musttail_typecheck.ll LLVM :: Transforms/SimplifyCFG/pr35774.ll LLVM :: Transforms/WholeProgramDevirt/branch-funnel-threshold.ll LLVM :: Transforms/WholeProgramDevirt/branch-funnel.ll LLVM :: Transforms/WholeProgramDevirt/expand-check.ll LLVM :: Transforms/WholeProgramDevirt/vcp-accesses-memory.ll LLVM :: Transforms/WholeProgramDevirt/vcp-decl.ll LLVM :: Transforms/WholeProgramDevirt/vcp-no-this.ll LLVM :: Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll LLVM :: Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll LLVM :: Transforms/WholeProgramDevirt/vcp-type-mismatch.ll LLVM :: Transforms/WholeProgramDevirt/vcp-uses-this.ll