[llvm] [BPF] Remove unused weak symbol __bpf_trap (PR #166003)
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 08:57:55 PST 2025
================
@@ -160,6 +170,20 @@ bool BPFAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
}
void BPFAsmPrinter::emitInstruction(const MachineInstr *MI) {
+ if (MI->isCall()) {
+ for (const MachineOperand &Op : MI->operands()) {
+ if (Op.isGlobal()) {
+ if (const GlobalValue *GV = Op.getGlobal())
+ if (GV->getName() == BPF_TRAP)
+ SawTrapCall = true;
+ } else if (Op.isSymbol()) {
+ if (const MCSymbol *Sym = Op.getMCSymbol())
----------------
rupprecht wrote:
This will always fire an assertion:
```cc
MCSymbol *getMCSymbol() const {
assert(isMCSymbol() && "Wrong MachineOperand accessor");
return Contents.Sym;
}
```
But `isMCSymbol()` is always false since `isSymbol()` is true instead.
What's the right fix?
https://github.com/llvm/llvm-project/pull/166003
More information about the llvm-commits
mailing list