Use emplace_back instead of a constructor call and push_back. NFC
[oota-llvm.git] / lib / Target / X86 / X86CallFrameOptimization.cpp
index b1995694535265eb67027d40a0df3c8b6f501396..e3031b8946417744f75ffa3655c2d4164ad52ef7 100644 (file)
@@ -26,6 +26,7 @@
 #include "llvm/ADT/Statistic.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/IR/Function.h"
@@ -130,6 +131,11 @@ bool X86CallFrameOptimization::isLegal(MachineFunction &MF) {
   if (STI.is64Bit())
     return false;
 
+  // We can't encode multiple DW_CFA_GNU_args_size in the compact
+  // unwind encoding that Darwin uses.
+  if (STI.isTargetDarwin() && !MF.getMMI().getLandingPads().empty())
+    return false;
+
   // You would expect straight-line code between call-frame setup and
   // call-frame destroy. You would be wrong. There are circumstances (e.g.
   // CMOV_GR8 expansion of a select that feeds a function call!) where we can