This is a follow up D96600 and cleans up all calls to getPreferredAddresingMode. i.e., we really don't need to query the same things again and again, but get the preferred addressing mode once. So this should be a lot friendlier for compile times, especially if we start implementing getPreferredAddresingMode.
Details
Diff Detail
Event Timeline
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | ||
---|---|---|
5565 | Should the EnableBackedgeIndexing option override what the target defines? Or could it be removed, or replaced? |
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | ||
---|---|---|
3814 |
Good point. I think in general an option takes precedence, but that's not really happening here. I think haIving an option for this would be good (I noticed it would at least be convenient for testing), which accepts values that match the values this hook returns: preindexed, postindexed, and none. I was thinking of doing that as a follow up of this NFC, so that would mean generalising and renaming this EnableBackedgeIndexing if that sounds like a good idea (so leave this as a NFC). |
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | ||
---|---|---|
3814 | I was also going to suggest, in the previous patch, to just remove the option. I just added it for testing and I don't think it's useful now. |
LGTM, the target's preferred addressing mode should be independent of the contents of the loop, which may change between the different calls in the original code.
Please resolve @dmgreen's comment before landing. For me, adjusting EnableBackedgeIndexing handling would be fine as a follow up.
Thanks guys.
I will commit this to get this NFC out of the way, and then follow up shortly to make some changes to options as I also found that's convenient to have for testing.
I will rename EnableBackedgeIndexing to PreferredAddressingMode, and let it accept the 3 values corresponding to the enum values of AddressingModeKind.
Good point. I think in general an option takes precedence, but that's not really happening here.
I think haIving an option for this would be good (I noticed it would at least be convenient for testing), which accepts values that match the values this hook returns: preindexed, postindexed, and none. I was thinking of doing that as a follow up of this NFC, so that would mean generalising and renaming this EnableBackedgeIndexing if that sounds like a good idea (so leave this as a NFC).