diff options
author | dim <dim@FreeBSD.org> | 2013-11-25 22:56:46 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-11-25 22:56:46 +0000 |
commit | 0d569e265d41507eb35c2340aef857fc8fc863c9 (patch) | |
tree | 247a7030c882667021e98cab65a676d406465ab2 | |
parent | cb9e583d86990eba0d5af8913cdbbb20da5b2c9e (diff) | |
download | FreeBSD-src-0d569e265d41507eb35c2340aef857fc8fc863c9.zip FreeBSD-src-0d569e265d41507eb35c2340aef857fc8fc863c9.tar.gz |
MFC r258350:
Pull in r191896 from upstream llvm trunk:
CaptureTracking: Plug a loophole in the "too many uses" heuristic.
The heuristic was added to avoid spending too much compile time in a
specially crafted test case (PR17461, PR16474) with many uses on a
select or bitcast instruction can still trigger the slow case. Add a
check for that case.
This only affects compile time, don't have a good way to test it.
This fixes the excessive compile time spent on a specific file of the
graphics/rawtherapee port.
Reported by: mandree
Approved by: re (gjb)
-rw-r--r-- | contrib/llvm/lib/Analysis/CaptureTracking.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/llvm/lib/Analysis/CaptureTracking.cpp b/contrib/llvm/lib/Analysis/CaptureTracking.cpp index a729270..2118917 100644 --- a/contrib/llvm/lib/Analysis/CaptureTracking.cpp +++ b/contrib/llvm/lib/Analysis/CaptureTracking.cpp @@ -146,8 +146,14 @@ void llvm::PointerMayBeCaptured(const Value *V, CaptureTracker *Tracker) { case Instruction::PHI: case Instruction::Select: // The original value is not captured via this if the new value isn't. + Count = 0; for (Instruction::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE; ++UI) { + // If there are lots of uses, conservatively say that the value + // is captured to avoid taking too much compile time. + if (Count++ >= Threshold) + return Tracker->tooManyUses(); + Use *U = &UI.getUse(); if (Visited.insert(U)) if (Tracker->shouldExplore(U)) |