[PATCH] D149383: [SelectionDAG][WIP] Add support for evaluating SetCC based on knownbits
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 14:39:51 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/test/CodeGen/X86/avx512-mask-op.ll:615
+; CHECK-NEXT: movb $1, %al
+; CHECK-NEXT: testb %al, %al
+; CHECK-NEXT: retq
----------------
Why do we emit any code here?
================
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
----------------
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.
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