Page MenuHomePhabricator

[SimplifyCFG] Freeze the extra condition when optimizing to switch
Needs ReviewPublic

Authored by aqjune on Jan 17 2021, 9:02 PM.

Details

Reviewers
nikic
lebedev.ri
Summary

As discussed in D93943, this patch fixes the UB issue by freezing the extra condition when optimizing
if(extracond || X == C1 || X == C2 || ...) into if(extracond) { switch(X) { .. } }.

Note that this transformation is safe if undef value is gone.

Diff Detail

Event Timeline

aqjune created this revision.Jan 17 2021, 9:02 PM
aqjune requested review of this revision.Jan 17 2021, 9:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2021, 9:02 PM

Since this might affect the quality of generated assembly, I'll run experiment and see how it goes.

aqjune edited the summary of this revision. (Show Details)Jan 17 2021, 9:11 PM