<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang hangs compiling part of Chromium on Mac"
   href="https://llvm.org/bugs/show_bug.cgi?id=29064">29064</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang hangs compiling part of Chromium on Mac
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, rnk@google.com, sebpop@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17008" name="attach_17008" title="repro">attachment 17008</a> <a href="attachment.cgi?id=17008&action=edit" title="repro">[details]</a></span>
repro

Reproduction with the attached source:

$ clang -cc1 -triple x86_64-apple-macosx10.7.0 -emit-obj -mrelocation-model pic
-pic-level 2 -mthread-model posix -mdisable-fp-elim -relaxed-aliasing
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.3
-dwarf-column-info -debug-info-kind=standalone -dwarf-version=2
-debugger-tuning=lldb -stdlib=libc++ -O2 -std=c++11 -fdeprecated-macro 
-fvisibility hidden -fvisibility-inlines-hidden -stack-protector 1 -fblocks
-fno-rtti -fno-threadsafe-statics -fobjc-runtime=macosx-10.7.0
-fencode-extended-block-signature -fmax-type-align=16 -vectorize-loops
-vectorize-slp -o /dev/null -x c++ /tmp/b.ii


I think this was triggered by a change in libc++: r278356, which added
__always__inline__ on the basic_string<>::__init methods.

The function being compiled,
_Z23PopulateIpcMessageNamesRN10ipc_fuzzer12MessageNamesE is constructing a very
large number of strings, so it might be that this change pushed the compile
time from very slow to glacial by hitting some quadratic algorithm
(MemoryDependenceAnalysis?)


The stack from where clang is spending time looks like this:

#0  InsertIntoBucketImpl<llvm::Instruction const*> (TheBucket=0x1c15a560,
Lookup=@0x7fffffffa870: 0x15a01a18, Key=@0x7fffffffa870: 0x15a01a18,
this=0x7fffffffaed0) at ../include/llvm/ADT/DenseMap.h:487
#1  InsertIntoBucket<llvm::Instruction const* const&> (Key=@0x7fffffffa870:
0x15a01a18, TheBucket=0x1c15a560, this=0x7fffffffaed0) at
../include/llvm/ADT/DenseMap.h:450
#2  FindAndConstruct (Key=@0x7fffffffa870: 0x15a01a18, this=0x7fffffffaed0) at
../include/llvm/ADT/DenseMap.h:267
#3  operator[] (Key=@0x7fffffffa870: 0x15a01a18, this=0x7fffffffaed0) at
../include/llvm/ADT/DenseMap.h:271
#4  llvm::OrderedBasicBlock::comesBefore (this=0x7fffffffaed0, A=0x14ef32a8,
B=0x15a142c8) at ../lib/Analysis/OrderedBasicBlock.cpp:50
#5  0x000000000148ca2c in llvm::OrderedBasicBlock::dominates (this=<optimized
out>, A=<optimized out>, B=B@entry=0x15a142c8) at
../lib/Analysis/OrderedBasicBlock.cpp:84
#6  0x000000000140052e in (anonymous namespace)::CapturesBefore::isSafeToPrune
(this=this@entry=0x7fffffffacd0, I=0x15a142c8) at
../lib/Analysis/CaptureTracking.cpp:90
#7  0x00000000014007b8 in (anonymous namespace)::CapturesBefore::shouldExplore
(this=0x7fffffffacd0, U=<optimized out>) at
../lib/Analysis/CaptureTracking.cpp:124
#8  0x0000000001400abb in llvm::PointerMayBeCaptured (V=V@entry=0x15e37d28,
Tracker=Tracker@entry=0x7fffffffacd0) at
../lib/Analysis/CaptureTracking.cpp:226
#9  0x0000000001401c29 in llvm::PointerMayBeCapturedBefore
(V=V@entry=0x15e37d28, ReturnCaptures=ReturnCaptures@entry=true,
StoreCaptures=StoreCaptures@entry=true, I=I@entry=0x14ef32a8,
DT=DT@entry=0xd5bcfe0, IncludeI=IncludeI@entry=true,
OBB=OBB@entry=0x7fffffffaed0)
    at ../lib/Analysis/CaptureTracking.cpp:202
#10 0x00000000013c80a5 in llvm::AAResults::callCapturesBefore (this=0x1a061c10,
I=I@entry=0x14ef32a8, MemLoc=..., DT=0xd5bcfe0, OBB=OBB@entry=0x7fffffffaed0)
at ../lib/Analysis/AliasAnalysis.cpp:448
#11 0x000000000147e620 in
llvm::MemoryDependenceResults::getSimplePointerDependencyFrom
(this=this@entry=0x17668e70, MemLoc=..., isLoad=isLoad@entry=false, ScanIt=...,
BB=0x14597c70, QueryInst=0x0) at
../lib/Analysis/MemoryDependenceAnalysis.cpp:652
#12 0x000000000147e6af in
llvm::MemoryDependenceResults::getPointerDependencyFrom
(this=this@entry=0x17668e70, MemLoc=..., isLoad=isLoad@entry=false, ScanIt=...,
BB=BB@entry=0x14597c70, QueryInst=QueryInst@entry=0x0) at
../lib/Analysis/MemoryDependenceAnalysis.cpp:341
#13 0x0000000001a48e93 in eliminateDeadStores (BB=..., AA=AA@entry=0x1a061c10,
MD=MD@entry=0x17668e70, DT=DT@entry=0xd5bcfe0, TLI=TLI@entry=0x8297c80) at
../lib/Transforms/Scalar/DeadStoreElimination.cpp:1143
#14 0x0000000001a4a5cd in eliminateDeadStores (F=..., AA=0x1a061c10,
MD=0x17668e70, DT=0xd5bcfe0, TLI=0x8297c80) at
../lib/Transforms/Scalar/DeadStoreElimination.cpp:1166
#15 0x000000000185114b in llvm::FPPassManager::runOnFunction
(this=this@entry=0x14893850, F=...) at ../lib/IR/LegacyPassManager.cpp:1522
#16 0x000000000243e280 in RunPassOnSCC (DevirtualizedCall=<synthetic pointer>,
CallGraphUpToDate=<synthetic pointer>, CG=..., CurSCC=..., P=0x14893850,
this=<optimized out>) at ../lib/Analysis/CallGraphSCCPass.cpp:151
#17 RunAllPassesOnSCC (DevirtualizedCall=<synthetic pointer>, CG=...,
CurSCC=..., this=<optimized out>) at ../lib/Analysis/CallGraphSCCPass.cpp:420
#18 (anonymous namespace)::CGPassManager::runOnModule (this=<optimized out>,
M=...) at ../lib/Analysis/CallGraphSCCPass.cpp:475
#19 0x000000000185181f in runOnModule (M=..., this=<optimized out>) at
../lib/IR/LegacyPassManager.cpp:1599
#20 llvm::legacy::PassManagerImpl::run (this=0x19e80570, M=...) at
../lib/IR/LegacyPassManager.cpp:1702
#21 0x00000000018519d9 in llvm::legacy::PassManager::run
(this=this@entry=0x7fffffffb9c0, M=...) at ../lib/IR/LegacyPassManager.cpp:1733
#22 0x0000000001d17296 in EmitAssembly (OS=..., Action=clang::Backend_EmitObj,
this=0x7fffffffbab0) at ../tools/clang/lib/CodeGen/BackendUtil.cpp:718
#23 clang::EmitBackendOutput (Diags=..., CGOpts=..., TOpts=..., LOpts=...,
TDesc=..., M=0x58b0af0, Action=Action@entry=clang::Backend_EmitObj,
OS=std::unique_ptr<llvm::raw_pwrite_stream> containing 0x0) at
../tools/clang/lib/CodeGen/BackendUtil.cpp:808
#24 0x00000000022f8318 in clang::BackendConsumer::HandleTranslationUnit
(this=0x58b0610, C=...) at ../tools/clang/lib/CodeGen/CodeGenAction.cpp:195
#25 0x000000000261767b in clang::ParseAST (S=..., PrintStats=<optimized out>,
SkipFunctionBodies=<optimized out>) at
../tools/clang/lib/Parse/ParseAST.cpp:167
#26 0x0000000002021dda in clang::ASTFrontendAction::ExecuteAction
(this=this@entry=0x5894f60) at
../tools/clang/lib/Frontend/FrontendAction.cpp:558
#27 0x00000000022f86de in clang::CodeGenAction::ExecuteAction (this=0x5894f60)
at ../tools/clang/lib/CodeGen/CodeGenAction.cpp:867
#28 0x0000000002022a76 in clang::FrontendAction::Execute
(this=this@entry=0x5894f60) at
../tools/clang/lib/Frontend/FrontendAction.cpp:458
#29 0x0000000001ffe69e in clang::CompilerInstance::ExecuteAction
(this=this@entry=0x588f600, Act=...) at
../tools/clang/lib/Frontend/CompilerInstance.cpp:871
#30 0x00000000020a6e94 in clang::ExecuteCompilerInvocation
(Clang=Clang@entry=0x588f600) at
../tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:246
#31 0x0000000000a4f358 in cc1_main (Argv=..., Argv0=Argv0@entry=0x7fffffffdd02
"/usr/local/google/work/llvm/build.reldebug/bin/clang",
MainAddr=MainAddr@entry=0xa4b960 <GetExecutablePath(char const*, bool)>) at
../tools/clang/tools/driver/cc1_main.cpp:181
#32 0x00000000009faaaf in ExecuteCC1Tool (Tool=..., argv=...) at
../tools/clang/tools/driver/driver.cpp:299
#33 main (argc_=<optimized out>, argv_=<optimized out>) at
../tools/clang/tools/driver/driver.cpp:380</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>