[PATCH] D57254: [Outliner] Set nounwind for outlined functions

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 26 13:39:32 PST 2019


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineOutliner.cpp:1134
+      }))
+    F->addFnAttr(Attribute::NoUnwind);
+
----------------
dmgreen wrote:
> efriedma wrote:
> > The outliner will refuse to outline calls that might unwind; you don't need the hasFnAttribute check.  (It might be possible in theory, but it would be complicated to construct the correct unwind info.)
> That would certainly make this simpler.
> 
> I don't see any code that would stop calls that may throw from being outlined, though. And some examples seem to show it is happen at the moment (looking at aarch64, if I'm getting this right).
> 
> Do you think it _should_ be disabled for unwindable calls? It seems to work at the moment for the simple examples I attempted.
We should never outline calls unless we can examine the callee to prove it doesn't depend on the caller's stack layout (which also implies it can't unwind).  See https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp#L5305 .

Looking at the code more carefully, it's possible it doesn't handle tail calls correctly; not sure.


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

https://reviews.llvm.org/D57254





More information about the llvm-commits mailing list