Skip to content

Commit bbf1635

Browse files
Address comments
1 parent 1d681b9 commit bbf1635

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15874,17 +15874,17 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
1587415874
break;
1587515875
}
1587615876

15877-
if (TLI.isNarrowingProfitable(N0.getNode(), SrcVT, VT)) {
15877+
if (!LegalOperations || TLI.isOperationLegal(N0.getOpcode(), VT)) {
1587815878
switch (N0.getOpcode()) {
1587915879
case ISD::ADD:
1588015880
case ISD::SUB:
1588115881
case ISD::MUL:
1588215882
case ISD::AND:
1588315883
case ISD::OR:
1588415884
case ISD::XOR:
15885-
if (!(N0.hasOneUse() && VT.isScalarInteger()))
15885+
if (!N0.hasOneUse() || !VT.isScalarInteger())
1588615886
break;
15887-
if (LegalOperations && !TLI.isOperationLegal(N0.getOpcode(), VT))
15887+
if (!TLI.isNarrowingProfitable(N0.getNode(), SrcVT, VT))
1588815888
break;
1588915889
SDValue NarrowL = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(0));
1589015890
SDValue NarrowR = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(1));

llvm/lib/Target/NVPTX/NVPTXISelLowering.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ class NVPTXTargetLowering : public TargetLowering {
156156

157157
bool isTruncateFree(Type *SrcTy, Type *DstTy) const override {
158158
// Truncating 64-bit to 32-bit is free in SASS.
159-
if (!(SrcTy->isIntegerTy() && DstTy->isIntegerTy()))
159+
if (!SrcTy->isIntegerTy() || !DstTy->isIntegerTy())
160160
return false;
161161
return SrcTy->getPrimitiveSizeInBits() == 64 &&
162162
DstTy->getPrimitiveSizeInBits() == 32;
163163
}
164164

165165
bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override {
166166
// Truncating 64-bit to 32-bit is free in SASS.
167-
if (!(SrcVT.isScalarInteger() && DestVT.isScalarInteger()))
167+
if (!SrcVT.isScalarInteger() || !DestVT.isScalarInteger())
168168
return false;
169169
return SrcVT.getFixedSizeInBits() == 64 &&
170170
DestVT.getFixedSizeInBits() == 32;

0 commit comments

Comments
 (0)