[PATCH] D18100: Simplify Logic in IRMover
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 14:22:45 PST 2016
joker.eph created this revision.
joker.eph added reviewers: tejohnson, rafael.
joker.eph added a subscriber: llvm-commits.
I'm not sure about correctness here. The test-suite is passing though.
http://reviews.llvm.org/D18100
Files:
lib/Linker/IRMover.cpp
Index: lib/Linker/IRMover.cpp
===================================================================
--- lib/Linker/IRMover.cpp
+++ lib/Linker/IRMover.cpp
@@ -388,7 +388,6 @@
/// due to the use of Value handles which the Linker doesn't actually need,
/// but this allows us to reuse the ValueMapper code.
ValueToValueMapTy ValueMap;
- ValueToValueMapTy AliasValueMap;
DenseSet<GlobalValue *> ValuesToLink;
std::vector<GlobalValue *> Worklist;
@@ -1056,16 +1055,10 @@
bool ShouldLink = shouldLink(DGV, *SGV);
- // just missing from map
- if (ShouldLink) {
- auto I = ValueMap.find(SGV);
- if (I != ValueMap.end())
- return cast<Constant>(I->second);
-
- I = AliasValueMap.find(SGV);
- if (I != AliasValueMap.end())
- return cast<Constant>(I->second);
- }
+ /// First verify if the value hasn't been alreay linked.
+ auto I = ValueMap.find(SGV);
+ if (I != ValueMap.end())
+ return cast<Constant>(I->second);
if (!ShouldLink && ForAlias)
DGV = nullptr;
@@ -1196,7 +1189,7 @@
void IRLinker::linkAliasBody(GlobalAlias &Dst, GlobalAlias &Src) {
Constant *Aliasee = Src.getAliasee();
- Constant *Val = MapValue(Aliasee, AliasValueMap, ValueMapperFlags, &TypeMap,
+ Constant *Val = MapValue(Aliasee, ValueMap, ValueMapperFlags, &TypeMap,
&LValMaterializer);
Dst.setAliasee(Val);
}
@@ -1555,8 +1548,7 @@
Worklist.pop_back();
// Already mapped.
- if (ValueMap.find(GV) != ValueMap.end() ||
- AliasValueMap.find(GV) != AliasValueMap.end())
+ if (ValueMap.find(GV) != ValueMap.end())
continue;
assert(!GV->isDeclaration());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18100.50477.patch
Type: text/x-patch
Size: 1655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160311/5f33bf98/attachment.bin>
More information about the llvm-commits
mailing list