[PATCH] D152128: [RISCV] Fold special case (xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 19:34:22 PDT 2023
- Previous message: [PATCH] D152128: [RISCV] Fold special case (xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
- Next message: [PATCH] D152128: [RISCV] Fold special case (xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
craig.topper added inline comments.
Herald added a subscriber: wangpc.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:10484
+ SDLoc DL(N0);
+ int64_t Imm = ConstN00->getSExtValue();
+ if (isInt<12>(Imm + 1))
----------------
Use APInt methods here. I don't think we're protected against types being larger than i64 here. So getSExtValue() might assert.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:10485
+ int64_t Imm = ConstN00->getSExtValue();
+ if (isInt<12>(Imm + 1))
+ return DAG.getSetCC(DL, VT, N0.getOperand(1),
----------------
`Imm+1` is undefined behavior if Imm happens to be INT64_MAX. Another reason to use APInt.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152128/new/
https://reviews.llvm.org/D152128
- Previous message: [PATCH] D152128: [RISCV] Fold special case (xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
- Next message: [PATCH] D152128: [RISCV] Fold special case (xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the llvm-commits
mailing list