[llvm] r341478 - [Hexagon] Ignore unnamed globals in HexagonConstExtenders
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 5 08:54:45 PDT 2018
Author: kparzysz
Date: Wed Sep 5 08:54:44 2018
New Revision: 341478
URL: http://llvm.org/viewvc/llvm-project?rev=341478&view=rev
Log:
[Hexagon] Ignore unnamed globals in HexagonConstExtenders
This replaces r337723. The global list in the module can be huge with LTO,
plus the module can change between different invocations of the pass, so
there is no easy way to deterministically cache the ordering (especially
in the presence of multiple threads).
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp?rev=341478&r1=341477&r2=341478&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonConstExtenders.cpp Wed Sep 5 08:54:44 2018
@@ -730,21 +730,8 @@ bool HCE::ExtRoot::operator< (const HCE:
}
case MachineOperand::MO_ExternalSymbol:
return StringRef(V.SymbolName) < StringRef(ER.V.SymbolName);
- case MachineOperand::MO_GlobalAddress: {
- // Global values may not have names, so compare their positions
- // in the parent module.
- const Module &M = *V.GV->getParent();
- auto FindPos = [&M] (const GlobalValue &V) {
- unsigned P = 0;
- for (const GlobalValue &T : M.global_values()) {
- if (&T == &V)
- return P;
- P++;
- }
- llvm_unreachable("Global value not found in module");
- };
- return FindPos(*V.GV) < FindPos(*ER.V.GV);
- }
+ case MachineOperand::MO_GlobalAddress:
+ return V.GV->getGUID() < ER.V.GV->getGUID();
case MachineOperand::MO_BlockAddress: {
const BasicBlock *ThisB = V.BA->getBasicBlock();
const BasicBlock *OtherB = ER.V.BA->getBasicBlock();
@@ -1221,6 +1208,12 @@ void HCE::recordExtender(MachineInstr &M
}
ED.UseMI = &MI;
+
+ // Ignore unnamed globals.
+ ExtRoot ER(ED.getOp());
+ if (ER.Kind == MachineOperand::MO_GlobalAddress)
+ if (ER.V.GV->getName().empty())
+ return;
Extenders.push_back(ED);
}
More information about the llvm-commits
mailing list