This is an archive of the discontinued LLVM Phabricator instance.

StructurizeCFG: prefer reduced number of live values
ClosedPublic

Authored by ruiling on Aug 23 2022, 1:38 AM.

Details

Summary

The instruction simplification will try to simplify the affected phis.
In some cases, this might extend the liveness of values. For example:

BB0:
 | \
 | BB1
 | /
BB2:phi (BB0, v), (BB1, undef)

The phi in BB2 will be simplified to v as v dominates BB2, but this is
increasing the number of active values in BB1. By setting CanUseUndef
to false, we will not simplify the phi in this way, this would help
register pressure. This is mandatory for the later change to help
reducing VGPR pressure for AMDGPU.

Diff Detail

Event Timeline

ruiling created this revision.Aug 23 2022, 1:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2022, 1:38 AM
ruiling requested review of this revision.Aug 23 2022, 1:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2022, 1:38 AM
foad accepted this revision.Aug 23 2022, 3:18 AM

LGTM.

llvm/test/CodeGen/AMDGPU/loop_break.ll
49

Not your fault, but bb.2 really should have been removed because it only contains an implicit def which does not generate any code.

llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll
29–31

Not your fault, but this comparison really should be simplified to "true".

This revision is now accepted and ready to land.Aug 23 2022, 3:18 AM
foad added inline comments.Aug 23 2022, 3:28 AM
llvm/test/Transforms/StructurizeCFG/one-loop-multiple-backedges.ll
2
sameerds accepted this revision.Aug 24 2022, 12:57 AM
ruiling updated this revision to Diff 459995.Sep 14 2022, 12:27 AM
ruiling marked an inline comment as done.

rebase

This revision was landed with ongoing or failed builds.Sep 25 2022, 6:56 PM
This revision was automatically updated to reflect the committed changes.