[llvm] 2a82e23 - Fix handling of dontcall attributes for arches that lower calls via fastSelectInstruction (#153302)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 12 16:12:25 PDT 2025
Author: Daniel Paoliello
Date: 2025-08-12T16:12:22-07:00
New Revision: 2a82e231465b1720261df37fe46cfb909ddf4092
URL: https://github.com/llvm/llvm-project/commit/2a82e231465b1720261df37fe46cfb909ddf4092
DIFF: https://github.com/llvm/llvm-project/commit/2a82e231465b1720261df37fe46cfb909ddf4092.diff
LOG: Fix handling of dontcall attributes for arches that lower calls via fastSelectInstruction (#153302)
Recently my change to avoid duplicate `dontcall` attribute errors
(#152810) caused the Clang `Frontend/backend-attribute-error-warning.c`
test to fail on Arm32:
<https://lab.llvm.org/buildbot/#/builders/154/builds/20134>
The root cause is that, if the default `IFastSel` path bails, then
targets are given the opportunity to lower instructions via
`fastSelectInstruction`. That's the path taken by Arm32 and since its
implementation of `selectCall` didn't call `diagnoseDontCall` no error
was emitted.
I've checked the other implementations of `fastSelectInstruction` and
the only other one that lowers call instructions in WebAssembly, so I've
fixed that too.
Added:
Modified:
llvm/lib/Target/ARM/ARMFastISel.cpp
llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index 54aa355d4db0a..14e1160e70dae 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/lib/Target/ARM/ARMFastISel.cpp
@@ -2504,6 +2504,7 @@ bool ARMFastISel::SelectCall(const Instruction *I,
// Set all unused physreg defs as dead.
static_cast<MachineInstr *>(MIB)->setPhysRegsDeadExcept(UsedRegs, TRI);
+ diagnoseDontCall(*CI);
return true;
}
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
index ec95e86e4fe3d..2666342d0c7b9 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
@@ -912,6 +912,8 @@ bool WebAssemblyFastISel::selectCall(const Instruction *I) {
if (!IsVoid)
updateValueMap(Call, ResultReg);
+
+ diagnoseDontCall(*Call);
return true;
}
More information about the llvm-commits
mailing list