llvm-project/llvm/test
Matt Davis 13b8331054 [StackProtector] Ignore certain intrinsics when calculating sspstrong heuristic.
Summary:
The 'strong' StackProtector heuristic takes into consideration call instructions.
Certain intrinsics, such as lifetime.start, can cause the
StackProtector to protect functions that do not need to be protected.

Specifically, a volatile variable, (not optimized away), but belonging to a stack
allocation will encourage a llvm.lifetime.start to be inserted during
compilation. Because that intrinsic is a 'call' the strong StackProtector
will see that the alloca'd variable is being passed to a call instruction, and
insert a stack protector. In this case the intrinsic isn't really lowered to a
call. This can cause unnecessary stack checking, at the cost of additional
(wasted) CPU cycles.

In the future we should rely on TargetTransformInfo::isLoweredToCall, but as of
now that routine considers all intrinsics as not being lowerable. That needs
to be corrected, and such a change is on my list of things to get moving on.

As a side note, the updated stack-protector-dbginfo.ll test always seems to
pass.  I never see the dbg.declare/dbg.value reaching the
StackProtector::HasAddressTaken, but I don't see any code excluding dbg
intrinsic calls either, so I think it's the safest thing to do.

Reviewers: void, timshen

Reviewed By: timshen

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D45331

llvm-svn: 329450
2018-04-06 20:14:13 +00:00
..
Analysis [CostModel][X86] Regenerate bit count cost tests with update_analyze_test_checks.py 2018-04-06 16:14:27 +00:00
Assembler Make the LLParser accept call instructions of variables in the program AS 2018-02-27 11:15:11 +00:00
Bindings [LLVM-C] Audit Inline Assembly APIs for Consistency 2018-04-06 02:31:29 +00:00
Bitcode [IR] Upgrade comment token in objc retain release marker 2018-04-05 02:44:46 +00:00
BugPoint
CodeGen [StackProtector] Ignore certain intrinsics when calculating sspstrong heuristic. 2018-04-06 20:14:13 +00:00
DebugInfo Re-commit r329179 after fixing build&test issues 2018-04-04 14:42:14 +00:00
Examples
ExecutionEngine [RuntimeDyld][PowerPC] Add a test case for r329335. 2018-04-05 21:56:55 +00:00
Feature Remove the LoopInstSimplify pass (-loop-instsimplify) 2018-03-12 20:49:42 +00:00
FileCheck
Instrumentation hwasan: add -hwasan-match-all-tag flag 2018-04-04 20:44:59 +00:00
Integer
JitListener
LTO Object: Fix handling of @@@ in .symver directive 2018-03-20 00:45:03 +00:00
Linker [DebugInfo] Add remaining files to r325970 2018-02-23 23:13:18 +00:00
MC [RISCV] Update MC compression tests 2018-04-06 18:27:45 +00:00
Object Disable a test using environment variables that requires a real shell 2018-04-03 18:19:52 +00:00
ObjectYAML [WebAssembly] Disallow weak undefined globals in the object format 2018-03-09 16:30:44 +00:00
Other [EarlyCSE] Add debug counter for debugging mis-optimizations. NFC. 2018-04-06 18:47:33 +00:00
SafepointIRVerifier
SymbolRewriter
TableGen TableGen: Support Intrinsic values in SearchableTable 2018-04-01 17:08:58 +00:00
ThinLTO/X86 [ThinLTO] Clear dllimport when setting dso_local. 2018-03-13 15:24:51 +00:00
Transforms [InstCombine] limit nsz: -(X - Y) --> Y - X to hasOneUse() 2018-04-06 17:24:08 +00:00
Unit
Verifier Tweak an assert message in the verifier 2018-04-06 10:20:19 +00:00
YAMLParser
tools [llvm-mca] Do not separate iterations with a newline in the timeline view. 2018-04-06 15:30:02 +00:00
.clang-format
CMakeLists.txt Remove llvm-mcmarkup. 2018-04-02 23:17:55 +00:00
TestRunner.sh
lit.cfg.py Remove llvm-mcmarkup. 2018-04-02 23:17:55 +00:00
lit.site.cfg.py.in