[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


================
@@ -500,12 +500,20 @@ class NVPTXTargetLowering : public TargetLowering {
 
   bool isTruncateFree(Type *SrcTy, Type *DstTy) const override {
     // Truncating 64-bit to 32-bit is free in SASS.
-    if (!SrcTy->isIntegerTy() || !DstTy->isIntegerTy())
+    if (!(SrcTy->isIntegerTy() && DstTy->isIntegerTy()))
       return false;
     return SrcTy->getPrimitiveSizeInBits() == 64 &&
            DstTy->getPrimitiveSizeInBits() == 32;
   }
 
+  bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override {
+    // Truncating 64-bit to 32-bit is free in SASS.
+    if (!(SrcVT.isScalarInteger() && DestVT.isScalarInteger()))
----------------
arsenm wrote:

demorgan this 

https://github.com/llvm/llvm-project/pull/98666


More information about the llvm-commits mailing list