Skip to content

Commit 91de0ee

Browse files
committed
[EVM] Constraint spills
1 parent ded6b19 commit 91de0ee

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

llvm/lib/Target/EVM/EVMFinalizeStackFrames.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,16 @@ bool EVMFinalizeStackFrames::runOnModule(Module &M) {
149149
SmallVector<std::pair<MachineFunction *, uint64_t>, 8> ToReplaceFI;
150150

151151
SmallVector<MachineFunction *> MFs;
152-
for_each(M.getFunctionList(), [&MFs, &MMI](Function &F) {
153-
if (MachineFunction *MF = MMI.getMachineFunction(F))
154-
MFs.push_back(MF);
155-
});
156-
157-
if (!MFs.empty() &&
152+
bool ShouldSpillConstants = false;
153+
for_each(M.getFunctionList(),
154+
[&MFs, &MMI, &ShouldSpillConstants](Function &F) {
155+
if (MachineFunction *MF = MMI.getMachineFunction(F)) {
156+
ShouldSpillConstants |= MF->getFrameInfo().hasStackObjects();
157+
MFs.push_back(MF);
158+
}
159+
});
160+
161+
if (ShouldSpillConstants &&
158162
MFs.front()->getFunction().hasFnAttribute("evm-entry-function")) {
159163
EVMConstantSpiller ConstSpiller(M, MMI);
160164
if (ConstSpiller.getSpillSize()) {

0 commit comments

Comments
 (0)