[llvm] r252917 - [ShrinkWrap] Make sure we do not mess up with EH funclet lowering.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 12 10:13:42 PST 2015
Author: qcolombet
Date: Thu Nov 12 12:13:42 2015
New Revision: 252917
URL: http://llvm.org/viewvc/llvm-project?rev=252917&view=rev
Log:
[ShrinkWrap] Make sure we do not mess up with EH funclet lowering.
ShrinkWrapping does not understand exception handling constraints for now, so
make sure we do not mess with them by aborting on functions that use EH
funclets.
Modified:
llvm/trunk/lib/CodeGen/ShrinkWrap.cpp
llvm/trunk/test/CodeGen/X86/late-address-taken.ll
Modified: llvm/trunk/lib/CodeGen/ShrinkWrap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShrinkWrap.cpp?rev=252917&r1=252916&r2=252917&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ShrinkWrap.cpp (original)
+++ llvm/trunk/lib/CodeGen/ShrinkWrap.cpp Thu Nov 12 12:13:42 2015
@@ -63,11 +63,13 @@
#include "llvm/CodeGen/Passes.h"
// To know about callee-saved.
#include "llvm/CodeGen/RegisterClassInfo.h"
+#include "llvm/MC/MCAsmInfo.h"
#include "llvm/Support/Debug.h"
// To query the target about frame lowering.
#include "llvm/Target/TargetFrameLowering.h"
// To know about frame setup operation.
#include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Target/TargetMachine.h"
// To access TargetInstrInfo.
#include "llvm/Target/TargetSubtargetInfo.h"
@@ -377,6 +379,11 @@ bool ShrinkWrap::runOnMachineFunction(Ma
DEBUG(dbgs() << "Look into: " << MBB.getNumber() << ' ' << MBB.getName()
<< '\n');
+ if (MBB.isEHFuncletEntry()) {
+ DEBUG(dbgs() << "EH Funclets are not supported yet.\n");
+ return false;
+ }
+
for (const MachineInstr &MI : MBB) {
if (!useOrDefCSROrFI(MI))
continue;
@@ -458,7 +465,10 @@ bool ShrinkWrap::isShrinkWrapEnabled(con
switch (EnableShrinkWrapOpt) {
case cl::BOU_UNSET:
- return TFI->enableShrinkWrapping(MF);
+ return TFI->enableShrinkWrapping(MF) &&
+ // Windows with CFI has some limitations that makes it impossible
+ // to use shrink-wrapping.
+ !MF.getTarget().getMCAsmInfo()->usesWindowsCFI();
// If EnableShrinkWrap is set, it takes precedence on whatever the
// target sets. The rational is that we assume we want to test
// something related to shrink-wrapping.
Modified: llvm/trunk/test/CodeGen/X86/late-address-taken.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/late-address-taken.ll?rev=252917&r1=252916&r2=252917&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/late-address-taken.ll (original)
+++ llvm/trunk/test/CodeGen/X86/late-address-taken.ll Thu Nov 12 12:13:42 2015
@@ -1,4 +1,6 @@
-; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s -enable-shrink-wrap=false | FileCheck %s
+; Make sure shrink-wrapping does not break the lowering of exception handling.
+; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s -enable-shrink-wrap=true | FileCheck %s
; Repro cases from PR25168
More information about the llvm-commits
mailing list