(original) (raw)
Hi Chandler,We observed some regressions in our regular testing (despite I saw nothing suspicious in my runs). I did accurate investigation and was able to reproduce and track down the regression.
I found the exact request to GlobalsModRef that results in the performance loss (I added a limit on number of requests into the implementation and bisected the number to find the interesting request).
Here are the details:
We’re checking following two locations:
(lldb) p ((llvm::Instruction\*)(LocA.Ptr))->dump()
%arrayidx.i = getelementptr inbounds \[1 x %struct.elt\_list\*\], \[1 x %struct.elt\_list\*\]\* %te.i, i64 0, i64 %indvars.iv.i
(lldb) p ((llvm::Instruction\*)(LocB.Ptr))->dump()
@reg\_values = internal unnamed\_addr global %struct.varray\_head\_tag\* null, align 8
and the function in question is “cselib\_init”:
(lldb) p ((llvm::Instruction\*)(LocA.Ptr))->getParent()->getParent()->getName()
(llvm::StringRef) $3 = (Data = "cselib\_init", Length = 11)
Corresponding underlying values:
(lldb) p UV2->dump()
@reg\_values = internal unnamed\_addr global %struct.varray\_head\_tag\* null, align 8
(lldb) p UV1->dump()
%32 = load %struct.varray\_head\_tag\*, %struct.varray\_head\_tag\*\* @reg\_values, align 8, !tbaa !2
Backtrace:
(lldb) bt \* thread #1: tid = 0x120baaf, 0x00000001038b752a libLTO.dylib\`(anonymous namespace)::GlobalsModRef::alias(this=0x000000010eba5c10, LocA=0x00007fff5fbf4198, LocB=0x00007fff5fbf6268) + 570 at GlobalsModRef.cpp:519, queue = 'com.apple.main-thread', stop reason = step over
\* frame #0: 0x00000001038b752a libLTO.dylib\`(anonymous namespace)::GlobalsModRef::alias(this=0x000000010eba5c10, LocA=0x00007fff5fbf4198, LocB=0x00007fff5fbf6268) + 570 at GlobalsModRef.cpp:519
frame #1: 0x00000001038b82f7 libLTO.dylib\`non-virtual thunk to (anonymous namespace)::GlobalsModRef::alias(this=0x000000010eba5c30, LocA=0x00007fff5fbf4198, LocB=0x00007fff5fbf6268) + 55 at GlobalsModRef.cpp:562
frame #2: 0x00000001038d6aa8 libLTO.dylib\`llvm::AliasAnalysis::getModRefInfo(this=0x000000010eba5c30, S=0x000000010a1a22e0, Loc=0x00007fff5fbf6268) + 120 at AliasAnalysis.cpp:288
frame #3: 0x0000000103a0a814 libLTO.dylib\`llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(this=0x000000010e6cf0c0, MemLoc=0x00007fff5fbf6268, isLoad=true, ScanIt=llvm::BasicBlock::iterator at 0x00007fff5fbf4390, BB=0x000000010a19ffa0, QueryInst=0x000000010a1a20c8) + 1908 at MemoryDependenceAnalysis.cpp:570
frame #4: 0x0000000103a0ffa5 libLTO.dylib\`llvm::MemoryDependenceAnalysis::GetNonLocalInfoForBlock(this=0x000000010e6cf0c0, QueryInst=0x000000010a1a20c8, Loc=0x00007fff5fbf6268, isLoad=true, BB=0x000000010a19ffa0, Cache=0x0000000100f9d568, NumSortedEntries=0) + 2165 at MemoryDependenceAnalysis.cpp:965
frame #5: 0x0000000103a0e3a9 libLTO.dylib\`llvm::MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(this=0x000000010e6cf0c0, QueryInst=0x000000010a1a20c8, Pointer=0x00007fff5fbf62a8, Loc=0x00007fff5fbf6268, isLoad=true, StartBB=0x000000010a19ffa0, Result=0x00007fff5fbf6bf0, Visited=0x00007fff5fbf6208, SkipFirstBlock=false) + 5897 at MemoryDependenceAnalysis.cpp:1200
frame #6: 0x0000000103a0cb3b libLTO.dylib\`llvm::MemoryDependenceAnalysis::getNonLocalPointerDependency(this=0x000000010e6cf0c0, QueryInst=0x000000010a1a20c8, Result=0x00007fff5fbf6bf0) + 635 at MemoryDependenceAnalysis.cpp:911
frame #7: 0x000000010340c5b5 libLTO.dylib\`(anonymous namespace)::GVN::processNonLocalLoad(this=0x000000010e6ce680, LI=0x000000010a1a20c8) + 101 at GVN.cpp:1706
frame #8: 0x0000000103408eef libLTO.dylib\`(anonymous namespace)::GVN::processLoad(this=0x000000010e6ce680, L=0x000000010a1a20c8) + 1551 at GVN.cpp:1905
frame #9: 0x00000001034080fd libLTO.dylib\`(anonymous namespace)::GVN::processInstruction(this=0x000000010e6ce680, I=0x000000010a1a20c8) + 397 at GVN.cpp:2220
frame #10: 0x0000000103407d1b libLTO.dylib\`(anonymous namespace)::GVN::processBlock(this=0x000000010e6ce680, BB=0x000000010a19ffa0) + 251 at GVN.cpp:2394
frame #11: 0x0000000103401755 libLTO.dylib\`(anonymous namespace)::GVN::iterateOnFunction(this=0x000000010e6ce680, F=0x00000001085f69f8) + 1541 at GVN.cpp:2677
frame #12: 0x0000000103400fef libLTO.dylib\`(anonymous namespace)::GVN::runOnFunction(this=0x000000010e6ce680, F=0x00000001085f69f8) + 623 at GVN.cpp:2352
frame #13: 0x00000001027cd05b libLTO.dylib\`llvm::FPPassManager::runOnFunction(this=0x000000010eba6810, F=0x00000001085f69f8) + 427 at LegacyPassManager.cpp:1520
frame #14: 0x00000001027cd375 libLTO.dylib\`llvm::FPPassManager::runOnModule(this=0x000000010eba6810, M=0x000000010115c5f0) + 117 at LegacyPassManager.cpp:1540
frame #15: 0x00000001027cdda1 libLTO.dylib\`(anonymous namespace)::MPPassManager::runOnModule(this=0x000000010e6cbaf0, M=0x000000010115c5f0) + 1409 at LegacyPassManager.cpp:1596
frame #16: 0x00000001027cd636 libLTO.dylib\`llvm::legacy::PassManagerImpl::run(this=0x000000010e6cb740, M=0x000000010115c5f0) + 310 at LegacyPassManager.cpp:1698
frame #17: 0x00000001027ce521 libLTO.dylib\`llvm::legacy::PassManager::run(this=0x00007fff5fbf82b8, M=0x000000010115c5f0) + 33 at LegacyPassManager.cpp:1729
The function body is in the attached file.