[PATCH] Improving LowerSwitch behavior for contiguous ranges

Owen Anderson resistor at mac.com
Tue Jun 10 12:25:41 PDT 2014


On Jun 10, 2014, at 11:52 AM, Eric Christopher <echristo at gmail.com> wrote:

> On Tue, Jun 10, 2014 at 11:48 AM, Owen Anderson <resistor at mac.com> wrote:
>> 
>> On Jun 10, 2014, at 11:37 AM, Hal Finkel <hfinkel at anl.gov> wrote:
>> 
>> 
>> Yep. Though I have to admit that it'd be nice if we had a range
>> propagation pass that would clean this up rather than special casing.
>> :\
>> 
>> 
>> Doesn't LVI do range propagation?
>> 
>> 
>> 
>> Sort of.
>> 
>> That said, range propagation isn’t a good solution to this problem.
>> SwitchLowering generally happens towards the end of a compilation pipeline,
>> and you don’t want to run any significant set of CFG optimizations after it
>> because they might re-introduce switches.
>> 
> 
> Fair enough. I figured range propagation would just prove dead blocks
> without doing significant CFG optimizations.

It probably doesn’t do any today, but we don’t have a good way to enforce the invariant that it won’t in the future.  More generally, LowerSwitch is firmly a lowering operation, and it’s not unreasonable to assume we won’t be running a lot of optimizations after it.  It should try to produce good output without the need for further cleanup.

—Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140610/a5b15837/attachment.html>


More information about the llvm-commits mailing list