[PATCH] D34862: [CGP] Relax a bit restriction for optimizeMemoryInst to extend scope

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 06:14:19 PDT 2017


efriedma added a comment.

Err, wait a sec... you don't need to check dominance at all.

The point of the check is to make sure we don't end up in an infinite loop: if we already sank the addressing mode, we don't want to sink it again.

If we didn't look through a PHI node to come up with an instruction in AddrModeInsts, it must dominate the memory instruction because the IR wouldn't be valid otherwise, so checking dominance is useless.  If we did look through a PHI node to come up with an instruction in AddrModeInsts, it isn't really local anyway; we're using the PHI node, not the instruction itself, so the dominance relationship is irrelevant.

So I think the right solution here is to actually track how we came up with each instruction in AddrModeInsts, and skip the IsNonLocalValue check for the ones that came from PHI nodes.


https://reviews.llvm.org/D34862





More information about the llvm-commits mailing list