Skip to content

Commit fece61f

Browse files
committed
fix some comments
1 parent 074a6f5 commit fece61f

File tree

7 files changed

+23
-27
lines changed

7 files changed

+23
-27
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17930,7 +17930,6 @@ AArch64TargetLowering::isDesirableToCommuteWithShift(const SDNode *N,
1793017930

1793117931
SDValue ShiftLHS = N->getOperand(0);
1793217932
EVT VT = N->getValueType(0);
17933-
SDValue Add;
1793417933

1793517934
if (!ShiftLHS->hasOneUse())
1793617935
return false;
@@ -17957,7 +17956,6 @@ AArch64TargetLowering::isDesirableToCommuteWithShift(const SDNode *N,
1795717956
}
1795817957
}
1795917958
}
17960-
1796117959
return true;
1796217960
}
1796317961

llvm/lib/Target/Hexagon/HexagonISelLowering.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,19 +2154,20 @@ bool HexagonTargetLowering::hasBitTest(SDValue X, SDValue Y) const {
21542154

21552155
bool HexagonTargetLowering::isDesirableToCommuteWithShift(
21562156
const SDNode *N, CombineLevel Level) const {
2157-
using namespace llvm::SDPatternMatch;
21582157
assert((N->getOpcode() == ISD::SHL || N->getOpcode() == ISD::SRA ||
21592158
N->getOpcode() == ISD::SRL) &&
21602159
"Expected shift op");
21612160

21622161
SDValue ShiftLHS = N->getOperand(0);
2163-
SDValue Add;
21642162

2165-
if (ShiftLHS->hasOneUse() ||
2166-
sd_match(ShiftLHS, m_OneUse(m_SExt(m_OneUse(m_Value(Add))))))
2167-
return true;
2163+
if (!ShiftLHS->hasOneUse())
2164+
return false;
21682165

2169-
return false;
2166+
if ((ShiftLHS.getOpcode() == ISD::SIGN_EXTEND &&
2167+
!ShiftLHS.getOperand(0)->hasOneUse()))
2168+
return false;
2169+
2170+
return true;
21702171
}
21712172

21722173
bool HexagonTargetLowering::isTruncateFree(Type *Ty1, Type *Ty2) const {

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19169,17 +19169,17 @@ Value *PPCTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(
1916919169

1917019170
bool PPCTargetLowering::isDesirableToCommuteWithShift(
1917119171
const SDNode *N, CombineLevel Level) const {
19172-
using namespace llvm::SDPatternMatch;
1917319172
assert((N->getOpcode() == ISD::SHL || N->getOpcode() == ISD::SRA ||
1917419173
N->getOpcode() == ISD::SRL) &&
1917519174
"Expected shift op");
1917619175

1917719176
SDValue ShiftLHS = N->getOperand(0);
19178-
SDValue Add;
19177+
if (!ShiftLHS->hasOneUse())
19178+
return false;
1917919179

19180-
if (ShiftLHS->hasOneUse() ||
19181-
sd_match(ShiftLHS, m_OneUse(m_SExt(m_OneUse(m_Value(Add))))))
19182-
return true;
19180+
if ((ShiftLHS.getOpcode() == ISD::SIGN_EXTEND &&
19181+
!ShiftLHS.getOperand(0)->hasOneUse()))
19182+
return false;
1918319183

19184-
return false;
19184+
return true;
1918519185
}

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18226,13 +18226,12 @@ bool RISCVTargetLowering::isDesirableToCommuteWithShift(
1822618226
}
1822718227
}
1822818228

18229-
if ((N0->getOpcode() == ISD::ADD || N0->getOpcode() == ISD::OR) &&
18230-
!N0->hasOneUse())
18229+
if (!N0->hasOneUse())
1823118230
return false;
1823218231

1823318232
if (N0->getOpcode() == ISD::SIGN_EXTEND &&
1823418233
N0->getOperand(0)->getOpcode() == ISD::ADD &&
18235-
!(N0->hasOneUse() && N0->getOperand(0)->hasOneUse()))
18234+
!N0->getOperand(0)->hasOneUse())
1823618235
return isLDST();
1823718236

1823818237
return true;

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60676,17 +60676,17 @@ Align X86TargetLowering::getPrefLoopAlignment(MachineLoop *ML) const {
6067660676

6067760677
bool X86TargetLowering::isDesirableToCommuteWithShift(
6067860678
const SDNode *N, CombineLevel Level) const {
60679-
using namespace llvm::SDPatternMatch;
6068060679
assert((N->getOpcode() == ISD::SHL || N->getOpcode() == ISD::SRA ||
6068160680
N->getOpcode() == ISD::SRL) &&
6068260681
"Expected shift op");
6068360682

6068460683
SDValue ShiftLHS = N->getOperand(0);
60685-
SDValue Add;
60684+
if (!ShiftLHS->hasOneUse())
60685+
return false;
6068660686

60687-
if (ShiftLHS->hasOneUse() ||
60688-
sd_match(ShiftLHS, m_OneUse(m_SExt(m_OneUse(m_Value(Add))))))
60689-
return true;
60687+
if ((ShiftLHS.getOpcode() == ISD::SIGN_EXTEND &&
60688+
!ShiftLHS.getOperand(0)->hasOneUse()))
60689+
return false;
6069060690

60691-
return false;
60691+
return true;
6069260692
}

llvm/test/CodeGen/RISCV/add_sext_shl_constant.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2-
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
3-
; RUN: | FileCheck -check-prefix=RV64 %s
2+
; RUN: llc -mtriple=riscv64 < %s | FileCheck -check-prefix=RV64 %s
43

54
define void @add_sext_shl_moreOneUse_add(ptr %array1, i32 %a, i32 %b) {
65
; RV64-LABEL: add_sext_shl_moreOneUse_add:

llvm/test/CodeGen/RISCV/add_shl_constant.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3-
; RUN: | FileCheck -check-prefix=RV32 %s
2+
; RUN: llc -mtriple=riscv32 < %s | FileCheck -check-prefix=RV32 %s
43

54
define i32 @add_shl_oneUse(i32 %x, i32 %y) nounwind {
65
; RV32-LABEL: add_shl_oneUse:

0 commit comments

Comments
 (0)