Skip to content

Commit 04956c2

Browse files
Address comments
1 parent 1e6e38d commit 04956c2

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
@@ -15649,17 +15649,17 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
1564915649
break;
1565015650
}
1565115651

15652-
if (TLI.isNarrowingProfitable(N0.getNode(), SrcVT, VT)) {
15652+
if (!LegalOperations || TLI.isOperationLegal(N0.getOpcode(), VT)) {
1565315653
switch (N0.getOpcode()) {
1565415654
case ISD::ADD:
1565515655
case ISD::SUB:
1565615656
case ISD::MUL:
1565715657
case ISD::AND:
1565815658
case ISD::OR:
1565915659
case ISD::XOR:
15660-
if (!(N0.hasOneUse() && VT.isScalarInteger()))
15660+
if (!N0.hasOneUse() || !VT.isScalarInteger())
1566115661
break;
15662-
if (LegalOperations && !TLI.isOperationLegal(N0.getOpcode(), VT))
15662+
if (!TLI.isNarrowingProfitable(N0.getNode(), SrcVT, VT))
1566315663
break;
1566415664
SDValue NarrowL = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(0));
1566515665
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
@@ -498,15 +498,15 @@ class NVPTXTargetLowering : public TargetLowering {
498498

499499
bool isTruncateFree(Type *SrcTy, Type *DstTy) const override {
500500
// Truncating 64-bit to 32-bit is free in SASS.
501-
if (!(SrcTy->isIntegerTy() && DstTy->isIntegerTy()))
501+
if (!SrcTy->isIntegerTy() || !DstTy->isIntegerTy())
502502
return false;
503503
return SrcTy->getPrimitiveSizeInBits() == 64 &&
504504
DstTy->getPrimitiveSizeInBits() == 32;
505505
}
506506

507507
bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override {
508508
// Truncating 64-bit to 32-bit is free in SASS.
509-
if (!(SrcVT.isScalarInteger() && DestVT.isScalarInteger()))
509+
if (!SrcVT.isScalarInteger() || !DestVT.isScalarInteger())
510510
return false;
511511
return SrcVT.getFixedSizeInBits() == 64 &&
512512
DestVT.getFixedSizeInBits() == 32;

0 commit comments

Comments
 (0)