[llvm] 432c41e - [SLP] Avoid getPointerElementType() call

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 06:46:21 PST 2021


Author: Nikita Popov
Date: 2021-12-13T15:46:13+01:00
New Revision: 432c41ebe935fd42fa210ad1b165b996a10c88f4

URL: https://github.com/llvm/llvm-project/commit/432c41ebe935fd42fa210ad1b165b996a10c88f4
DIFF: https://github.com/llvm/llvm-project/commit/432c41ebe935fd42fa210ad1b165b996a10c88f4.diff

LOG: [SLP] Avoid getPointerElementType() call

Use the load result type instead of the element type of the load
pointer operand.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index e1401171924b..7ee1386c9392 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5222,15 +5222,15 @@ static bool isLoadCombineCandidateImpl(Value *Root, unsigned NumElts,
       FoundOr = true;
   }
   // Check if the input is an extended load of the required or/shift expression.
-  Value *LoadPtr;
+  Value *Load;
   if ((MustMatchOrInst && !FoundOr) || ZextLoad == Root ||
-      !match(ZextLoad, m_ZExt(m_Load(m_Value(LoadPtr)))))
+      !match(ZextLoad, m_ZExt(m_Value(Load))) || !isa<LoadInst>(Load))
     return false;
 
   // Require that the total load bit width is a legal integer type.
   // For example, <8 x i8> --> i64 is a legal integer on a 64-bit target.
   // But <16 x i8> --> i128 is not, so the backend probably can't reduce it.
-  Type *SrcTy = LoadPtr->getType()->getPointerElementType();
+  Type *SrcTy = Load->getType();
   unsigned LoadBitWidth = SrcTy->getIntegerBitWidth() * NumElts;
   if (!TTI->isTypeLegal(IntegerType::get(Root->getContext(), LoadBitWidth)))
     return false;


        


More information about the llvm-commits mailing list