This is an archive of the discontinued LLVM Phabricator instance.

[IndVars] Pass TTI to replaceCongruentIVs
ClosedPublic

Authored by dmakogon on Nov 2 2021, 8:24 AM.

Details

Summary

In IndVarSimplify after simplifying and extending loop IVs we call replaceCongruentIVs() function.
This function optionally takes a TTI argument in order to be able to replace narrow IVs uses with truncates of the widest one.
For some reason the TTI wasn't passed to the function in IndVars pass, so it couldn't perform such
transform.
This patch fixes it.

Diff Detail

Event Timeline

dmakogon created this revision.Nov 2 2021, 8:24 AM
dmakogon requested review of this revision.Nov 2 2021, 8:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2021, 8:24 AM
dmakogon added a comment.EditedNov 2 2021, 8:33 AM

The majority of the regenerated checks are check's variables renames (these only happen with the patch applied).
The functional impact is only reflected in pr27133.ll and widen-loop-comp.ll files.

mkazantsev accepted this revision.Nov 2 2021, 8:48 AM

Wow, that's impressive number of noop updates. :) Change in pr27133.ll is OK and widen-loop-comp.ll has improvements so LGTM. Passing there TTI totally makes sense.

This revision is now accepted and ready to land.Nov 2 2021, 8:48 AM
dmakogon updated this revision to Diff 384357.Nov 3 2021, 1:26 AM

Added one more improved test case after gvn pass

This revision was automatically updated to reflect the committed changes.