[PATCH] D50780: Check that the key is in the LEAs map before accessing

Tom Rix via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 19 09:02:45 PDT 2018


trixirt added a comment.

I don't think there are any meaningful side effects.

In this function, removeRedundantAddrCalc, when genMemOpKey returns a key not already in the map, the value/vector on instructions is empty.
When chooseBestLEA is passed an empty vector, it never loops over it an returns a nullptr.
A nullptr causes the mi loop to continue

If on a future mi loop pass, there was a match, the match would return the same empty value/vector
and cause the same continue in the mi loop

When removeRedundantAddrCalc returns, it is only to 1 place in the main runOnMachineFunction work loop.
The LEAs map's scope is the work loop and removeRedundantAddrCalc is it's last use.


Repository:
  rL LLVM

https://reviews.llvm.org/D50780





More information about the llvm-commits mailing list