diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-04-07 19:22:18 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-04-07 19:22:18 +0000 |
commit | 28192c93980948293b7b2570154faca9ef30d892 (patch) | |
tree | 179a0e940852edaa62fd8f9d822dd7ad76232e3a /llvm/lib/Analysis/ValueTracking.cpp | |
parent | e1f4ca1b0f219b89027c163557ab4ec8e61e0b19 (diff) | |
download | bcm5719-llvm-28192c93980948293b7b2570154faca9ef30d892.tar.gz bcm5719-llvm-28192c93980948293b7b2570154faca9ef30d892.zip |
Fix ValueTracking to conclude that debug intrinsics are safe to
speculate. Without this, loop rotate (among many other places) would
suddenly stop working in the presence of debug info. I found this
looking at loop rotate, and have augmented its tests with a reduction
out of a very hot loop in yacr2 where failing to do this rotation costs
sometimes more than 10% in runtime performance, perturbing numerous
downstream optimizations.
This should have no impact on performance without debug info, but the
change in performance when debug info is enabled can be extreme. As
a consequence (and this how I got to this yak) any profiling of
performance problems should be treated with deep suspicion -- they may
have been wildly innacurate of debug info was enabled for profiling. =/
Just a heads up.
llvm-svn: 154263
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index c6b53a927db..a430f6281ef 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1854,6 +1854,14 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V, case Instruction::Call: { if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) { switch (II->getIntrinsicID()) { + // These synthetic intrinsics have no side-effects, and just mark + // information about their operands. + // FIXME: There are other no-op synthetic instructions that potentially + // should be considered at least *safe* to speculate... + case Intrinsic::dbg_declare: + case Intrinsic::dbg_value: + return true; + case Intrinsic::bswap: case Intrinsic::ctlz: case Intrinsic::ctpop: |