[PATCH] D113105: [InstCombine] Extend stacksave/restore elimination

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 08:00:00 PDT 2021


lebedev.ri added a comment.

Not really familiar with stack manipulation infra.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1796-1797
+            return ClassifyResult::CallWithSideEffects;
+        } else {
+          return ClassifyResult::CallWithSideEffects;
+        }
----------------
Maybe add a comment that all non-intrinsic calls are considered to be side-effects?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1807
     if (IntrinsicInst *SS = dyn_cast<IntrinsicInst>(II->getArgOperand(0))) {
       if (SS->getIntrinsicID() == Intrinsic::stacksave) {
+        BasicBlock::iterator BI(SS);
----------------
&& SS.getParent() == II.getParent()


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1810
+        bool CannotRemove = false;
+        for (++BI; &*BI != II; ++BI) {
+          if (Classify(&*BI) == ClassifyResult::None)
----------------
What if they are in different blocks?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113105/new/

https://reviews.llvm.org/D113105



More information about the llvm-commits mailing list