[llvm] [DAGCombine] Propagate truncate to operands (PR #98666)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 21:56:22 PDT 2024
================
@@ -15527,6 +15532,28 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
break;
}
+ if (TLI.isNarrowingProfitable(N0.getNode(), SrcVT, VT)) {
+ switch (N0.getOpcode()) {
+ case ISD::ADD:
+ case ISD::SUB:
+ case ISD::MUL:
+ case ISD::AND:
+ case ISD::OR:
+ case ISD::XOR:
+ if (!(N0.hasOneUse() && VT.isScalarInteger()))
+ break;
+ if (LegalOperations && !TLI.isOperationLegal(N0.getOpcode(), VT))
+ break;
----------------
arsenm wrote:
Swap this check with the isNarowingProfitable above? This is the simpler condition
https://github.com/llvm/llvm-project/pull/98666
More information about the llvm-commits
mailing list