File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -854,6 +854,29 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
854
854
SetNoInline (F);
855
855
}
856
856
}
857
+
858
+ bool HasStackCallsOrVLA =
859
+ std::any_of (M.getFunctionList ().begin (), M.getFunctionList ().end (),
860
+ [](auto &F) {
861
+ return F.hasFnAttribute (" visaStackCall" ) ||
862
+ F.hasFnAttribute (" hasVLA" );
863
+ });
864
+ if (!HasStackCallsOrVLA) {
865
+ for (auto FuncName : DetectionFunctions) {
866
+ if (auto F = M.getFunction (FuncName)) {
867
+ std::vector<CallInst *> CallersToDelete;
868
+ for (auto User : F->users ()) {
869
+ if (auto I = dyn_cast<CallInst>(User)) {
870
+ CallersToDelete.push_back (I);
871
+ }
872
+ }
873
+ std::for_each (
874
+ CallersToDelete.begin (), CallersToDelete.end (),
875
+ [](auto CallInst) { CallInst->eraseFromParent (); });
876
+ F->eraseFromParent ();
877
+ }
878
+ }
879
+ }
857
880
}
858
881
859
882
return true ;
You can’t perform that action at this time.
0 commit comments