summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2019-10-04 21:24:12 +0000
committerJessica Paquette <jpaquette@apple.com>2019-10-04 21:24:12 +0000
commit784892c9641a65e9acbcb442e26b00022240f4ee (patch)
tree6d8672d5ba9ed090becfad395f1df7be397fafcf /llvm/lib/CodeGen/MachineOutliner.cpp
parent984d08c680a79c72da1fbd55f7c4f8f672ef7f95 (diff)
downloadbcm5719-llvm-784892c9641a65e9acbcb442e26b00022240f4ee.tar.gz
bcm5719-llvm-784892c9641a65e9acbcb442e26b00022240f4ee.zip
[MachineOutliner] Disable outlining from noreturn functions
Outlining from noreturn functions doesn't do the correct thing right now. The outliner should respect that the caller is marked noreturn. In the event that we have a noreturn function, and the outlined code is in tail position, the outliner will not see that the outlined function should be tail called. As a result, you end up with a regular call containing a return. Fixing this requires that we check that all candidates live inside noreturn functions. So, for the sake of correctness, don't outline from noreturn functions right now. Add machine-outliner-noreturn.mir to test this. llvm-svn: 373791
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 533cce57adc..60eeefba9d6 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1303,6 +1303,12 @@ void MachineOutliner::populateMapper(InstructionMapper &Mapper, Module &M,
if (F.empty())
continue;
+ // Disable outlining from noreturn functions right now. Noreturn requires
+ // special handling for the case where what we are outlining could be a
+ // tail call.
+ if (F.hasFnAttribute(Attribute::NoReturn))
+ continue;
+
// There's something in F. Check if it has a MachineFunction associated with
// it.
MachineFunction *MF = MMI.getMachineFunction(F);
OpenPOWER on IntegriCloud