This is an archive of the discontinued LLVM Phabricator instance.

[Pipeliner] Fix incorrect phi values in the epilog and kernel
ClosedPublic

Authored by bcahoon on Aug 23 2018, 8:49 AM.

Details

Summary

The code that generates the loop definition operand for phis in the epilog and kernel is incorrect in some cases.

In the kernel, when a phi refers to another phi, the code that updates PhiOp2 needs to include the stage difference between the two phis.

In the epilog, the check for using the loop definition instead of the phi definition uses the StageDiffAdj value (the difference between the phi stage and the loop definition stage), but the adjustment is not needed to determine if the current stage contains an iteration with the loop definition.

Diff Detail

Repository
rL LLVM

Event Timeline

bcahoon created this revision.Aug 23 2018, 8:49 AM
bcahoon updated this revision to Diff 162209.Aug 23 2018, 9:55 AM

Fixed test case. Needed an extra llc option to work correctly.

xbolva00 added inline comments.
llvm/lib/CodeGen/MachinePipeliner.cpp
2728 ↗(On Diff #162209)

static_cast ?

+ below too

bcahoon updated this revision to Diff 162260.Aug 23 2018, 1:56 PM

Changed code in the patch to use static_cast. I'll submit a separate patch to fix the other occurrences of a cast.

pranavb accepted this revision.Aug 27 2018, 12:46 PM
This revision is now accepted and ready to land.Aug 27 2018, 12:46 PM
This revision was automatically updated to reflect the committed changes.