Skip to content

Commit e6dd841

Browse files
[EVM] Don't check for function name to detect entry function
After FE changes, "evm-entry-function" attribute is set to the entry function. Instead of checking the function name check for this attribute. Signed-off-by: Vladimir Radosavljevic <[email protected]>
1 parent ef97444 commit e6dd841

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/Target/EVM/EVMAsmPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ void EVMAsmPrinter::emitFunctionBodyEnd() { FirstFunctIsHandled = true; }
132132
void EVMAsmPrinter::emitBasicBlockStart(const MachineBasicBlock &MBB) {
133133
AsmPrinter::emitBasicBlockStart(MBB);
134134

135-
// If this is __entry function, we don't need to emit JUMPDEST
135+
// If this is the entry function, we don't need to emit JUMPDEST
136136
// instruction in the first basic block, as it is the entry point
137137
// of the EVM bytecode.
138138
auto IsEntryPoint = [this](const MachineBasicBlock &MBB) {
139139
return !FirstFunctIsHandled && &MBB == &MF->front() &&
140-
MF->getName() == "__entry";
140+
MF->getFunction().hasFnAttribute("evm-entry-function");
141141
};
142142

143143
// Emit JUMPDEST instruction at the beginning of the basic block, if

llvm/test/CodeGen/EVM/jumpdest-in-entry-point.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target triple = "evm"
66

77
declare void @llvm.evm.return(ptr addrspace(1), i256)
88

9-
define void @__entry() noreturn {
9+
define void @__entry() noreturn "evm-entry-function" {
1010
; CHECK-LABEL: __entry:
1111
; CHECK: ; %bb.0: ; %entry
1212
; CHECK-NEXT: PUSH0

0 commit comments

Comments
 (0)