[LV] Ignore more debug info.
authorFlorian Hahn <florian.hahn@arm.com>
Thu, 11 Oct 2018 09:27:24 +0000 (09:27 +0000)
committerFlorian Hahn <florian.hahn@arm.com>
Thu, 11 Oct 2018 09:27:24 +0000 (09:27 +0000)
We can avoid doing some unnecessary work by skipping debug instructions
in a few loops. It also helps to ensure debug instructions do not
prevent vectorization, although I do not have any concrete test cases
for that.

Reviewers: rengolin, hsaito, dcaballe, aprantl, vsk

Reviewed By: rengolin, dcaballe

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

llvm-svn: 344232

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

index c7c4568..cad1711 100644 (file)
@@ -4655,7 +4655,7 @@ LoopVectorizationCostModel::getSmallestAndWidestTypes() {
   // For each block.
   for (BasicBlock *BB : TheLoop->blocks()) {
     // For each instruction in the loop.
-    for (Instruction &I : *BB) {
+    for (Instruction &I : BB->instructionsWithoutDebug()) {
       Type *T = I.getType();
 
       // Skip ignored values.
@@ -4893,7 +4893,7 @@ LoopVectorizationCostModel::calculateRegisterUsage(ArrayRef<unsigned> VFs) {
 
   unsigned Index = 0;
   for (BasicBlock *BB : make_range(DFS.beginRPO(), DFS.endRPO())) {
-    for (Instruction &I : *BB) {
+    for (Instruction &I : BB->instructionsWithoutDebug()) {
       IdxToInstr[Index++] = &I;
 
       // Save the end location of each USE.