[PATCH] D131471: [RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x, y, neq/eq))
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 10 08:44:35 PDT 2022
- Previous message: [PATCH] D131471: [RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x, y, neq/eq))
- Next message: [PATCH] D131471: [RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x, y, neq/eq))
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:8275
+ // (add constant - 1, (setcc x, y, neq/eq))
+ if (isa<ConstantSDNode>(N0) && N1.getOpcode() == ISD::SETCC) {
+ auto *Nnz0 = cast<ConstantSDNode>(N0);
----------------
liaolucy wrote:
> craig.topper wrote:
> > Do we need to check that this is the only user of the setcc?
> At present, I think only setcc, ensure that rd is only 0/1, I have not found other SDNode have this function.
That wasn’t my question. What if the setcc is used by another instruction other than this sub. Then the original setcc won’t be removed and there will be two setccs with opposite conditions.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131471/new/
https://reviews.llvm.org/D131471
- Previous message: [PATCH] D131471: [RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x, y, neq/eq))
- Next message: [PATCH] D131471: [RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x, y, neq/eq))
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the llvm-commits
mailing list