This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Simplify nested SI_END_CF
ClosedPublic

Authored by rampitec on Mar 11 2020, 3:58 PM.

Details

Summary

This is to replace the optimization from the SIOptimizeExecMaskingPreRA.
We have less opportunities in the control flow lowering because many
VGPR copies are still in place and will be removed later, but we know
for sure an instruction is SI_END_CF and not just an arbitrary S_OR_B64
with EXEC.

The subsequent change needs to convert s_and_saveexec into s_and and
address new TODO lines in tests, then code block guarded by the
-amdgpu-remove-redundant-endcf option in the pre-RA exec mask optimizer
will be removed.

Diff Detail

Event Timeline

rampitec created this revision.Mar 11 2020, 3:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2020, 3:58 PM
arsenm added inline comments.Mar 11 2020, 4:04 PM
llvm/test/CodeGen/AMDGPU/collapse-endcf.mir
67–70

Should changing the test input to the CF pseudo be split into a separate patch?

rampitec marked an inline comment as done.Mar 11 2020, 4:10 PM
rampitec added inline comments.
llvm/test/CodeGen/AMDGPU/collapse-endcf.mir
67–70

I can do it and pre-commit.

rampitec updated this revision to Diff 249793.Mar 11 2020, 4:18 PM
rampitec marked an inline comment as done.

Pre-comitted test and rebased.

arsenm added inline comments.Mar 11 2020, 4:58 PM
llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
408–410

Was this copied directly from SIOptimizeExecMaskingPreRA.cpp? Should this go in a utility function somewhere?

rampitec marked an inline comment as done.Mar 11 2020, 5:10 PM
rampitec added inline comments.
llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
408–410

Almost. There are some mechanical and interface changes, but this is essentially the same code.
I do not need it in the utilities as the subsequent patch should remove this code from SIOptimizeExecMaskingPreRA.cpp completely.

arsenm accepted this revision.Mar 12 2020, 10:57 AM
This revision is now accepted and ready to land.Mar 12 2020, 10:57 AM
This revision was automatically updated to reflect the committed changes.