Page MenuHomePhabricator

[InstCombine] More aggressively try and fold irem/idiv/mul into selects.
Needs RevisionPublic

Authored by goldstein.w.n on Fri, Mar 17, 7:05 PM.

Details

Summary

Don't only do constant cases, also try cases were we can't constant
fold both sides. In the same we can't constant fold both sides, only
do transform if the select is single use.

Diff Detail

Event Timeline

goldstein.w.n created this revision.Fri, Mar 17, 7:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Mar 17, 7:05 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Fri, Mar 17, 7:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Mar 17, 7:05 PM
nikic requested changes to this revision.Sat, Mar 18, 3:03 PM

This is not generally legal for div/rem, see https://alive2.llvm.org/ce/z/2iiR26 using one of your tests. This is only legal if the operation is speculatable.

This revision now requires changes to proceed.Sat, Mar 18, 3:03 PM