diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2015-11-14 01:55:17 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2015-11-14 01:55:17 +0000 |
| commit | 2cdcfd23cd019d40977006f6bee476442821a8b1 (patch) | |
| tree | 657d44350d9cd9244ccd375e8567f9bddd73d6aa /llvm/lib/CodeGen/ShrinkWrap.cpp | |
| parent | d1d5c5168f52056856f1267799801593998cdb04 (diff) | |
| download | bcm5719-llvm-2cdcfd23cd019d40977006f6bee476442821a8b1.tar.gz bcm5719-llvm-2cdcfd23cd019d40977006f6bee476442821a8b1.zip | |
[ShrinkWrapping] Disable the optimization for functions with sanitize like
attribute.
Even if the target supports shrink-wrapping, the prologue and epilogue
must not move because a crash can happen anywhere and sanitizers need
to be able to unwind from the PC of the crash.
llvm-svn: 253116
Diffstat (limited to 'llvm/lib/CodeGen/ShrinkWrap.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/ShrinkWrap.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/ShrinkWrap.cpp b/llvm/lib/CodeGen/ShrinkWrap.cpp index 8a797018815..07371f66061 100644 --- a/llvm/lib/CodeGen/ShrinkWrap.cpp +++ b/llvm/lib/CodeGen/ShrinkWrap.cpp @@ -468,7 +468,14 @@ bool ShrinkWrap::isShrinkWrapEnabled(const MachineFunction &MF) { return TFI->enableShrinkWrapping(MF) && // Windows with CFI has some limitations that make it impossible // to use shrink-wrapping. - !MF.getTarget().getMCAsmInfo()->usesWindowsCFI(); + !MF.getTarget().getMCAsmInfo()->usesWindowsCFI() && + // Sanitizers look at the value of the stack at the location + // of the crash. Since a crash can happen anywhere, the + // frame must be lowered before anything else happen for the + // sanitizers to be able to get a correct stack frame. + !(MF.getFunction()->hasFnAttribute(Attribute::SanitizeAddress) || + MF.getFunction()->hasFnAttribute(Attribute::SanitizeThread) || + MF.getFunction()->hasFnAttribute(Attribute::SanitizeMemory)); // 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. |

