[PATCH] D110339: SelectionDAGBuilder: Improve canonicalization by not swapping branch targets
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 23 09:38:42 PDT 2021
craig.topper added inline comments.
================
Comment at: llvm/test/CodeGen/X86/2006-08-21-ExtraMovInst.ll:15
+; CHECK-NEXT: cmpl $39, %ecx
+; CHECK-NEXT: jle .LBB0_1
; CHECK-NEXT: # %bb.2: # %bb12
----------------
MatzeB wrote:
> RKSimon wrote:
> > This kind of thing is going to increase EFLAGS usage - I addressed this for CMOVs + SETs with SGT/UGT in D101074 but haven't had time to address JMP/BRANCH, or add the SLE/ULE equivalent yet.
> > This kind of thing is going to increase EFLAGS usage
>
> Wow, I was not aware that affects performance. Does that mean MachineCodePlacement / analyzeBranch can pessimize code when it flips the true/false branches and negates the condition of a jump?
At least on Intel CPUs, I'm not aware of a performance issue for jumps. There is an extra uop for CMOV and SETCC conditions that use the C flag and Z flag. That would cmovbe, cmova, setbe, and seta. There is no extra uop for branches on the same conditions.
I can't speak to AMD CPUs.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110339/new/
https://reviews.llvm.org/D110339
More information about the llvm-commits
mailing list