[PATCH] D55975: [X86] Remove x86ISD::INC/DEC. Just select them from X86ISD::ADD/SUB at isel time

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 20 17:52:36 PST 2018


craig.topper created this revision.
craig.topper added reviewers: RKSimon, andreadb, spatel.

INC/DEC are pretty much the same as ADD/SUB except that they don't update the C flag.

This patch removes the special nodes and just pattern matches from ADD/SUB during isel if the C flag isn't being used.

I had to avoid selecting DEC is the result isn't used. This will become a SUB immediate which will turned into a CMP later by optimizeCompareInstr. This lead to the one test change where we use a CMP instead of a DEC for an overflow intrinsic since we only checked the flag.

This also exposed a hole in our RMW flag matching use of hasNoCarryFlagUses. Our root node for the match is a store and there's no guarantee that all the flag users have been selected yet. So hasNoCarryFlagUses needs to check copyToReg and machine opcodes, but it also needs to check for the pre-match SETCC, SETCC_CARRY, BRCOND, and CMOV opcodes.


https://reviews.llvm.org/D55975

Files:
  lib/Target/X86/X86FastISel.cpp
  lib/Target/X86/X86ISelDAGToDAG.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  lib/Target/X86/X86InstrArithmetic.td
  lib/Target/X86/X86InstrCompiler.td
  lib/Target/X86/X86InstrInfo.td
  test/CodeGen/X86/sub-with-overflow.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55975.179213.patch
Type: text/x-patch
Size: 17299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181221/140d8a1f/attachment.bin>


More information about the llvm-commits mailing list