[PATCH] D46031: [DAGCombiner] DON'T unfold scalar masked merge if 'B' is constant

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 26 07:29:10 PDT 2018


lebedev.ri added inline comments.


================
Comment at: test/CodeGen/X86/unfold-masked-merge-scalar-variablemask.ll:658
 ; CHECK-BMI:       # %bb.0:
+; CHECK-BMI-NEXT:    xorl $42, %edi
 ; CHECK-BMI-NEXT:    andl %edx, %edi
----------------
lebedev.ri wrote:
> Looked at this in llvm-mca, no clear winner.
> The change decreases instruction count and IPC, but the cycle count does not change.
> So i guess it's ok?
On top of D46073, this `@in_constant_varx_42` pattern (i.e. `%y` being constant) is the only remaining issue.
```
# *** IR Dump After Machine InstCombiner ***:
# Machine code for function in_constant_varx_42: IsSSA, TracksLiveness
Function Live Ins: $edi in %0, $edx in %2

bb.0 (%ir-block.0):
  liveins: $edi, $edx
  %2:gr32 = COPY $edx
  %0:gr32 = COPY $edi
  %3:gr32 = AND32rr %0:gr32, %2:gr32, implicit-def dead $eflags
  %4:gr32 = NOT32r %2:gr32
  %5:gr32 = AND32ri8 %4:gr32, 42, implicit-def dead $eflags
  %6:gr32 = OR32rr %3:gr32, killed %5:gr32, implicit-def dead $eflags
  $eax = COPY %6:gr32
  RET 0, $eax

# End machine code for function in_constant_varx_42.
```
This *seems* ok (as per mca) on aarch64, but i'm not so sure about x86.
{F6036317}


Repository:
  rL LLVM

https://reviews.llvm.org/D46031





More information about the llvm-commits mailing list