(srl (not X), N-1) is either 0/1, so any zext can be combined to
this.
To avoid the transformation when the result of the setcc is being
used directly, only allow mismatch if the zext type is larger than
i8.
Paths 
  |  Differential  D145002  
[DAGCombiner] Make `(zext (sgt X, -1))` -> `(srl (not X), N-1)` work if typeof(zext)!=typeof(X) Needs ReviewPublic Authored by goldstein.w.n on Feb 28 2023, 1:20 PM. 
Details 
 Summary (srl (not X), N-1) is either 0/1, so any zext can be combined to To avoid the transformation when the result of the setcc is being 
Diff Detail 
 Event Timelinegoldstein.w.n added inline comments. 
 RKSimon added inline comments. 
 
 
 goldstein.w.n marked an inline comment as done. Comment ActionsFix add + sext case 
 
 
 
 
 
 
 
 
 
 
 Comment Actions Remove dead comment 
 
Revision Contents 
 
 
 
 
Diff 512919 llvm/include/llvm/CodeGen/TargetLowering.h
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
 
 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
 
 llvm/lib/Target/MSP430/MSP430ISelLowering.h
 llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
 llvm/lib/Target/X86/X86ISelLowering.h
 llvm/test/CodeGen/AArch64/arm64-icmp-opt.ll
 llvm/test/CodeGen/PowerPC/fp-strict-fcmp.ll
 llvm/test/CodeGen/PowerPC/setcc-logic.ll
 llvm/test/CodeGen/PowerPC/signbit-shift.ll
 llvm/test/CodeGen/RISCV/select-constant-xor.ll
 llvm/test/CodeGen/RISCV/selectcc-to-shiftand.ll
 llvm/test/CodeGen/X86/icmp-opt.ll
 llvm/test/CodeGen/X86/select-constant-xor.ll
 llvm/test/CodeGen/X86/select.ll
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Don't bother with the if() - getZExtOrTrunc checks this anyway