Skip to content

Commit b3db5a2

Browse files
authored
Merge pull request #4 from PLUTOFX/copilot/fix-frontend-compilation-error
Fix WebAssemblySpillPointers crash at O2: move pass before PEI
2 parents 21bdc41 + cc2af38 commit b3db5a2

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ pythonenv*
7070
/clang/utils/analyzer/projects/*/RefScanBuildResults
7171
# automodapi puts generated documentation files here.
7272
/lldb/docs/python_api/
73+
build/

llvm/lib/Target/WebAssembly/WebAssemblySpillPointers.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class WebAssemblySpillPointers final : public MachineFunctionPass {
4646
void getAnalysisUsage(AnalysisUsage &AU) const override {
4747
AU.setPreservesCFG();
4848
AU.addRequired<LiveIntervals>();
49-
AU.addPreserved<LiveIntervals>();
5049
MachineFunctionPass::getAnalysisUsage(AU);
5150
}
5251

llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,11 @@ void WebAssemblyPassConfig::addPostRegAlloc() {
525525
// control flow.
526526
disablePass(&MachineBlockPlacementID);
527527

528+
// Spill pointer-typed values to shadow stack for GC.
529+
// This must run before PEI so that frame indices are properly resolved.
530+
if (getOptLevel() != CodeGenOpt::None)
531+
addPass(createWebAssemblySpillPointers());
532+
528533
TargetPassConfig::addPostRegAlloc();
529534
}
530535

@@ -568,11 +573,6 @@ void WebAssemblyPassConfig::addPreEmitPass() {
568573
addPass(createWebAssemblyRegColoring());
569574
}
570575

571-
// Spill pointer-typed values to shadow stack for GC.
572-
// This must run after register allocation but before explicit locals.
573-
if (getOptLevel() != CodeGenOpt::None)
574-
addPass(createWebAssemblySpillPointers());
575-
576576
// Sort the blocks of the CFG into topological order, a prerequisite for
577577
// BLOCK and LOOP markers.
578578
addPass(createWebAssemblyCFGSort());

0 commit comments

Comments
 (0)