[PATCH] D136672: [ExpandMemCmp][AArch64] Add a new option PreferCmpToExpand in inMemCmpExpansionOptions and enable on AArch64
Benjamin Maxwell via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 9 11:39:26 PST 2022
benmxwl-arm added a comment.
I happen to have been looking into https://github.com/llvm/llvm-project/issues/56543 (which I believe is what this is trying to solve), and came across a possible fix from a slightly different angle.
It seems LLVM already knows how to optimize to the desired (handwritten code) for that issue, but the patterns (some zero extend folds) needed to do so are being prevented by this XOR simplification (in DAGCombiner.cpp visitXOR) :
// Simplify: xor (op x...), (op y...) -> (op (xor x, y))
if (N0Opcode == N1.getOpcode())
if (SDValue V = hoistLogicOpWithSameOpcodeHands(N))
return V;
If you comment that fold LLVM will optimize the memcmp as desired.
So I think it's just a matter of adding/or adjusting some of these zero extend optimizations to handle xor being simplified like this.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136672/new/
https://reviews.llvm.org/D136672
More information about the llvm-commits
mailing list