[PATCH] D149383: [SelectionDAG][WIP] Add support for evaluating SetCC based on knownbits

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 22:15:29 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/test/CodeGen/X86/fold-rmw-ops.ll:1359
+; CHECK-NEXT:    movb $1, %al # encoding: [0xb0,0x01]
+; CHECK-NEXT:    testb %al, %al # encoding: [0x84,0xc0]
 ; CHECK-NEXT:    jne b # TAILCALL
----------------
goldstein.w.n wrote:
> These `movb $1, %al; testb %al, %al`'s (here and in many other cases) are unnecessary. I assume its because SelectionDAG only has BB view, so even if we can rule out some BBs (based on known true/false br-cond), there is no pass for that. Is there anything we can/should do about that?
> 
> Also NB, we really should never emit `movb $1, %al; testb %al, %al` just grabbing any gpr (I guess least recently used to minimize potential latency) and do `cmpb %gpr8, gpr8` then `jne`/`je` depending if we want it to be always true/false.
> 
Hopefully most of these are just tests that should have been folded by InstCombine or other passes earlier and not really cases that originate in SelectionDAG.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149383/new/

https://reviews.llvm.org/D149383



More information about the llvm-commits mailing list