[llvm] 8848766 - [Codegen] TargetLowering::getCanonicalIndexType - early out scaled MVT::i8 indices. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 14 05:08:52 PDT 2021


Author: Simon Pilgrim
Date: 2021-10-14T13:08:40+01:00
New Revision: 88487662f7c245419e00672c42cb5adc749c1ba3

URL: https://github.com/llvm/llvm-project/commit/88487662f7c245419e00672c42cb5adc749c1ba3
DIFF: https://github.com/llvm/llvm-project/commit/88487662f7c245419e00672c42cb5adc749c1ba3.diff

LOG: [Codegen] TargetLowering::getCanonicalIndexType - early out scaled MVT::i8 indices. NFCI.

Avoids unused assignment scan-build warning.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index df84b4cd5a994..cc2b96f9b0b70 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -7956,10 +7956,8 @@ TargetLowering::getCanonicalIndexType(ISD::MemIndexType IndexType, EVT MemVT,
       (IndexType == ISD::SIGNED_SCALED) || (IndexType == ISD::SIGNED_UNSCALED);
 
   // Scaling is unimportant for bytes, canonicalize to unscaled.
-  if (IsScaledIndex && MemVT.getScalarType() == MVT::i8) {
-    IsScaledIndex = false;
-    IndexType = IsSignedIndex ? ISD::SIGNED_UNSCALED : ISD::UNSIGNED_UNSCALED;
-  }
+  if (IsScaledIndex && MemVT.getScalarType() == MVT::i8)
+    return IsSignedIndex ? ISD::SIGNED_UNSCALED : ISD::UNSIGNED_UNSCALED;
 
   return IndexType;
 }


        


More information about the llvm-commits mailing list