[llvm] b97c447 - [SLP] NFC. Add assert for shouldBroadcast and canBeVectorized. (#119327)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 03:25:24 PST 2024


Author: Han-Kuan Chen
Date: 2024-12-10T19:25:19+08:00
New Revision: b97c447dac892276eaff1ae6d07e3f986373a690

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

LOG: [SLP] NFC. Add assert for shouldBroadcast and canBeVectorized. (#119327)

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 50590e51ae0ed7..dd1e53a05ebeb8 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2460,6 +2460,8 @@ class BoUpSLP {
     /// the whole vector (it is mixed with constants or loop invariant values).
     /// Note: This modifies the 'IsUsed' flag, so a cleanUsed() must follow.
     bool shouldBroadcast(Value *Op, unsigned OpIdx, unsigned Lane) {
+      assert(Op == getValue(OpIdx, Lane) &&
+             "Op is expected to be getValue(OpIdx, Lane).");
       // Small number of loads - try load matching.
       if (isa<LoadInst>(Op) && getNumLanes() == 2 && getNumOperands() == 2)
         return false;
@@ -2517,6 +2519,8 @@ class BoUpSLP {
     /// Checks if there is at least single compatible operand in lanes other
     /// than \p Lane, compatible with the operand \p Op.
     bool canBeVectorized(Instruction *Op, unsigned OpIdx, unsigned Lane) const {
+      assert(Op == getValue(OpIdx, Lane) &&
+             "Op is expected to be getValue(OpIdx, Lane).");
       bool OpAPO = getData(OpIdx, Lane).APO;
       for (unsigned Ln = 0, Lns = getNumLanes(); Ln != Lns; ++Ln) {
         if (Ln == Lane)


        


More information about the llvm-commits mailing list