[polly] 0aff317 - [CodeGen] Fix getArrayAccessFor crashes as in bug 32534 with -polly-vectorizer=polly.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 11:59:55 PST 2019


Author: Michael Kruse
Date: 2019-11-12T13:58:28-06:00
New Revision: 0aff3174dcc00516fd26c6554266b05a236166bb

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

LOG: [CodeGen] Fix getArrayAccessFor crashes as in bug 32534 with -polly-vectorizer=polly.

Root cause is VectorBlockGenerator::copyStmt iterates all instructions
in basic block, however some load instructions may be not unnecessary
thus removed by simplification. As a result, these load instructions
don't have a corresponding array.

Looking at BlockGenerator::copyBB, it only iterates instructions list
of ScopStmt. Given it must be a block type scop in case of
vectorization, I think we should do the same in
VectorBlockGenerator::copyStmt.

Patch by bin.narwal <bin.narwal at gmail.com>

Differential Revision: https://reviews.llvm.org/D70076

Added: 
    

Modified: 
    polly/lib/CodeGen/BlockGenerators.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 599ae6cda3d7..ca8d80f608cf 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -1391,8 +1391,8 @@ void VectorBlockGenerator::copyStmt(
 
   generateScalarVectorLoads(Stmt, VectorBlockMap);
 
-  for (Instruction &Inst : *BB)
-    copyInstruction(Stmt, &Inst, VectorBlockMap, ScalarBlockMap, NewAccesses);
+  for (Instruction *Inst : Stmt.getInstructions())
+    copyInstruction(Stmt, Inst, VectorBlockMap, ScalarBlockMap, NewAccesses);
 
   verifyNoScalarStores(Stmt);
 }


        


More information about the llvm-commits mailing list