This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Disable combineBinOpToReduce if the reduction AVL might be 0.
ClosedPublic

Authored by craig.topper on Apr 25 2023, 11:10 AM.

Details

Summary

If the reduction AVL is 0, operand 0 of the reduction will be
returned rather than the scalar input.

To make the fold legal, we would need to fold the new scalar value
with whatever operand 0 is which may require a new scalar operation
before the reduction.

Block the combine if we can't prove AVL is non-zero.

Diff Detail

Event Timeline

craig.topper created this revision.Apr 25 2023, 11:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2023, 11:10 AM
craig.topper requested review of this revision.Apr 25 2023, 11:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2023, 11:10 AM
This revision is now accepted and ready to land.Apr 25 2023, 6:24 PM
This revision was landed with ongoing or failed builds.Apr 25 2023, 6:47 PM
This revision was automatically updated to reflect the committed changes.