Fix BinaryContext::handleAddressRef to properly detect references to other function's Constant islands.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
399 | getOrCreateIslandAccess (which is called by getOrCreateProxyIslandAccess) returns nullptr if !isInConstantIsland(Address)) |
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
399 | It should be IslandIter = std::prev(IslandIter) or std::advance(IslandIter, -1), but i think there's no need to be verbose here. Why not leave it as a decrement? |
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
399 | Than it looks like "IslandIter == AddressToConstantIslandMap.begin()" check above is redundant too (it might be rewritten that iterator not equal to begin() before decrement and without else case). Although I don't might to have both your and mine checks for better code flow control, my IMHO that we need either check both edge cases here or none. |
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
399 | You're probably right, i'll change to if (IslandIter != AddressToConstantIslandMap.begin()) --IslandIter; |
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
399 | Yes, I meant that. Because of the standard https://en.cppreference.com/w/cpp/iterator/prev checkout Note section. |
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
399 | I know that, bit IslandIter is not an rvalue |
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
399 | You're right, for some reason I was sure that it was telling about operation on the it == end(), not the end() itself.. NMW |
bolt/lib/Core/BinaryContext.cpp | ||
---|---|---|
396 | Unneeded parentheses |
Unneeded parentheses