Page MenuHomePhabricator

[InstCombine] Make `FoldOpIntoSelect` handle non-constants and use condition to deduce constants.
Needs ReviewPublic

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


  1. Make FoldOpIntoSelect handle non-constants by returning nullptr instead of aborting.
  2. Make the fold use the information present in the condition for deducing constants i.e: ` %c = icmp eq i8 %x, 10 %s = select i1 %c, i8 3, i8 2 %r = mul i8 %x, %s `

    If we fold the mul into the select, on the true side we insert 10 for %x in the mul.

Diff Detail

Unit TestsFailed

170 msx64 debian > Flang.Driver::code-gen-rv64.f90
Script: -- : 'RUN: at line 5'; rm -f /var/lib/buildkite-agent/builds/llvm-project/build/tools/flang/test/Driver/Output/code-gen-rv64.f90.tmp.o