Skip to content

Commit

Permalink
Skip cloned functions in stackmap pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel-Durov committed Sep 26, 2024
1 parent 9893eec commit 5c5740b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 5 additions & 6 deletions llvm/lib/CodeGen/TargetPassConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1186,17 +1186,16 @@ bool TargetPassConfig::addISelPasses() {
}
addPass(createYkSplitBlocksAfterCallsPass());
}
// `YkModuleClone` needs to run before `YkBasicBlockTracerPass` and
// `YkInsertStackMaps` because they both skip cloned functions.
if (YkModuleClone) {
addPass(createYkModuleClonePass());
}

if (YkInsertStackMaps) {
addPass(createYkStackmapsPass());
}

// YkModuleClonePass must run before YkBasicBlockTracerPass because
// YkBasicBlockTracerPass skips processing cloned functions based on
// function name prefix set by YkModuleClonePass.
if (YkModuleClone) {
addPass(createYkModuleClonePass());
}
if (YkBasicBlockTracer) {
addPass(createYkBasicBlockTracerPass());
}
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Transforms/Yk/StackMaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// stop-gap interpreter.

#include "llvm/Transforms/Yk/Stackmaps.h"
#include "llvm/Transforms/Yk/ModuleClone.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
Expand Down Expand Up @@ -51,6 +52,9 @@ class YkStackmaps : public ModulePass {
for (Function &F : M) {
if (F.empty()) // skip declarations.
continue;
if (F.getName().startswith(YK_CLONE_PREFIX)) // skip cloned functions
continue;

LivenessAnalysis LA(&F);
for (BasicBlock &BB : F) {
for (Instruction &I : BB) {
Expand Down

0 comments on commit 5c5740b

Please sign in to comment.