[PATCH] D137936: [AArch64] Optimize cmp chain when the result is tested for [in]equality with 0

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 04:47:33 PST 2022


Allen created this revision.
Allen added reviewers: dmgreen, bcl5980, efriedma, spatel.
Herald added subscribers: ecnelises, hiraditya, kristof.beyls.
Herald added a project: All.
Allen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

- For case bcmp9, there is extras AND and EXTEND int the chain of OR/XOR, which prevent the transform, so we address it with following steps: a) Fold AND + any_extend -> zero_extend in Optimized type-legalized selection DAG b) extend the isOrXorChain to address the ZERO_EXTEND

- The key IR frag related: t37: i32,ch = load<(load (s8) from %ir.4), anyext from i8> t0, t11, undef:i64 t12: i64 = add t4, Constant:i64<8> t38: i32,ch = load<(load (s8) from %ir.5), anyext from i8> t0, t12, undef:i64 t39: i32 = xor t37, t38 t40: i64 = any_extend t39 t42: i64 = and t40, Constant:i64<255>


https://reviews.llvm.org/D137936

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/bcmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137936.475108.patch
Type: text/x-patch
Size: 9182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221114/f640453f/attachment.bin>


More information about the llvm-commits mailing list