This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Add support for switch statements
ClosedPublic

Authored by kristof.beyls on Dec 30 2016, 7:54 AM.

Details

Summary

Add support for lowering switch statements.
This patch does this using a trivial chain of conditional branches.
In the future, we probably want to reuse the optimized switch lowering used in SelectionDAG.

This increases the compile pass rate in the test-suite run with -O0 -mllvm -global-isel=true -mllvm -global-isel-abort=1 from 53.6% to 59.9%.

Diff Detail

Event Timeline

kristof.beyls retitled this revision from to [GlobalISel] Add support for switch statements.
kristof.beyls updated this object.
kristof.beyls added a subscriber: llvm-commits.
qcolombet accepted this revision.Jan 4 2017, 4:12 PM
qcolombet edited edge metadata.

Hi Kristof,

LGTM modulo formatting and an additional test case.
No need for another round of review.

Cheers,
-Quentin

lib/CodeGen/GlobalISel/IRTranslator.cpp
229

The formatting looks strange here: auto& vs. auto &.

Make sure to run clang-format.

test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
179

Please use explicit variables (i.e., no %[0-9]+ ones).
You can use opt -instnamer for that.

191

Could you add a test case with more than one case in the switch?

This revision is now accepted and ready to land.Jan 4 2017, 4:12 PM
This revision was automatically updated to reflect the committed changes.