diff options
author | hev <wangrui@loongson.cn> | 2024-02-26 11:13:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 11:13:21 +0800 |
commit | 8be39b3901e3326ceebeaf0381f8cc57fdc0d464 (patch) | |
tree | 074d2ba5dbbdefb399ee2f84e87b8b410ed55a81 /llvm/lib/Target/LoongArch | |
parent | 0f02431273faa2cd001c59fd5de767659bc0c976 (diff) | |
download | llvm-8be39b3901e3326ceebeaf0381f8cc57fdc0d464.zip llvm-8be39b3901e3326ceebeaf0381f8cc57fdc0d464.tar.gz llvm-8be39b3901e3326ceebeaf0381f8cc57fdc0d464.tar.bz2 |
[LoongArch] Improve pattern matching for AddLike predicate (#82767)
This commit updates the pattern matching logic for the `AddLike`
predicate in `LoongArchInstrInfo.td` to use the
`isBaseWithConstantOffset` function provided by `CurDAG`. This
optimization aims to improve the efficiency of pattern matching by
identifying cases where the operation can be represented as a base
address plus a constant offset, which can lead to more efficient code
generation.
Diffstat (limited to 'llvm/lib/Target/LoongArch')
-rw-r--r-- | llvm/lib/Target/LoongArch/LoongArchInstrInfo.td | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td index ae73a8a..fcfff08 100644 --- a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td +++ b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td @@ -1048,7 +1048,7 @@ class PatGprImm_32<SDPatternOperator OpNode, LAInst Inst, Operand ImmOpnd> /// Predicates def AddLike: PatFrags<(ops node:$A, node:$B), [(add node:$A, node:$B), (or node:$A, node:$B)], [{ - return N->getOpcode() == ISD::ADD || isOrEquivalentToAdd(N); + return CurDAG->isBaseWithConstantOffset(SDValue(N, 0)); }]>; /// Simple arithmetic operations |