Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Nov 2013 17:53:19 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258350 - head/contrib/llvm/lib/Analysis
Message-ID:  <201311191753.rAJHrJB6009585@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue Nov 19 17:53:19 2013
New Revision: 258350
URL: http://svnweb.freebsd.org/changeset/base/258350

Log:
  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
  MFC after:	3 days

Modified:
  head/contrib/llvm/lib/Analysis/CaptureTracking.cpp

Modified: head/contrib/llvm/lib/Analysis/CaptureTracking.cpp
==============================================================================
--- head/contrib/llvm/lib/Analysis/CaptureTracking.cpp	Tue Nov 19 16:11:03 2013	(r258349)
+++ head/contrib/llvm/lib/Analysis/CaptureTracking.cpp	Tue Nov 19 17:53:19 2013	(r258350)
@@ -146,8 +146,14 @@ void llvm::PointerMayBeCaptured(const Va
     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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311191753.rAJHrJB6009585>