This is an archive of the discontinued LLVM Phabricator instance.

[LoopInfo] Look through trunc instructions
AbandonedPublic

Authored by SjoerdMeijer on Feb 19 2021, 7:35 AM.

Details

Summary

In trying to get the induction variable with getInductionVariable, a compare instruction of this form is pattern matched:

cmp = IndVar < FinalValue

But IndVarSimplify could be responsible for generating a slightly different pattern:

cmp = Trunc(IndVar) < FinalValue

This looks through the trunc instructions so that we try to pattern match the original pattern.

This depends on D89693. getInductionVariable is used by getInductionDescriptor which is used in TTI hook getPreferredAddressingMode. With this change, it can now find an IV for this loop, and it generates post-increments.

Diff Detail