Page MenuHomePhabricator

[RISCV][NFC] Add Test for (select (or B1, B2), X, Y)
ClosedPublic

Authored by lenary on May 1 2020, 2:33 PM.

Details

Summary

As shown, LLVM is keen to avoid logic and introduce selects (in DAGCombiner, and
other places). This leads to control flow on RISC-V which we should attempt to
avoid.

Diff Detail

Event Timeline

lenary created this revision.May 1 2020, 2:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2020, 2:33 PM

LGTM.

llvm/test/CodeGen/RISCV/select-or.ll
8–9

Nit: if the codegen improvement isn't expected to be merged quickly then consider writing something more generic like "illustrates whether we use conditional jumps or additional logic", since for now it might be a bit confusing that the test does generate several branches.

luismarques accepted this revision.May 1 2020, 3:57 PM
This revision is now accepted and ready to land.May 1 2020, 3:57 PM
lenary updated this revision to Diff 261643.May 2 2020, 7:22 AM

Update comment in test to more generally talk about what the test is looking
for, rather than the specific hook in the optimisation.

lenary planned changes to this revision.May 5 2020, 5:08 AM

I might actually add a few other tests, given i know (select (and A, B), C, D) is also a pattern that appears places.

lenary updated this revision to Diff 274034.Jun 29 2020, 3:21 AM
  • Added (select (and A, B), X, Y) test.
This revision is now accepted and ready to land.Jun 29 2020, 3:21 AM
lenary updated this revision to Diff 274530.Jun 30 2020, 10:26 AM
  • Expand select(or/and) tests to include if(or/and) cases
lenary updated this revision to Diff 274537.Jun 30 2020, 10:42 AM
  • Simplify and test to ensure branchy code is generated.
This revision was automatically updated to reflect the committed changes.