[PATCH] D80401: [SLP] fix verification check for valid IR

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 13:32:51 PDT 2020


spatel created this revision.
spatel added reviewers: ABataev, RKSimon, craig.topper, jdoerfert.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

This is a fix for PR45965 - https://bugs.llvm.org/show_bug.cgi?id=45965 - which was left out of D80106 <https://reviews.llvm.org/D80106> because of a test failure.
SLP does its own mini-CSE after potentially creating redundant instructions, so we need to wait for that to complete before running the verifier. Otherwise, we will see a test failure for test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll (not changed here) because a phi temporarily has identical but different incoming values for the same incoming block.

The test that is altered here could be fixed independently because the incoming input metadata is invalid. AFAICT, that fix does not change the motivation for that test. The test was escaping verification in SLP without this change because we were not running verifyFunction() unless SLP actually changed the IR.

Note: "-disable-verify" on the RUN line doesn't seem to suppress the verifyFunction; not sure if that's another bug.


https://reviews.llvm.org/D80401

Files:
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll


Index: llvm/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
===================================================================
--- llvm/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
+++ llvm/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -basicaa -disable-verify -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s
+; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-darwin13.3.0"
@@ -75,5 +75,7 @@
 
 declare i32 @_xfn(<2 x double>) #4
 
-!3 = !{!"int", !4, i64 0}
+!3 = !{!"int", !5, i64 0}
 !4 = !{!3, !3, i64 0}
+!5 = !{!"omnipotent char", !6, i64 0}
+!6 = !{!"Simple C/C++ TBAA"}
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2362,6 +2362,7 @@
            "trying to erase instruction with users.");
     Pair.getFirst()->eraseFromParent();
   }
+  assert(!verifyFunction(*F, &dbgs()));
 }
 
 void BoUpSLP::eraseInstructions(ArrayRef<Value *> AV) {
@@ -5731,7 +5732,6 @@
   if (Changed) {
     R.optimizeGatherSequence();
     LLVM_DEBUG(dbgs() << "SLP: vectorized \"" << F.getName() << "\"\n");
-    LLVM_DEBUG(verifyFunction(F));
   }
   return Changed;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80401.265581.patch
Type: text/x-patch
Size: 1559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200521/a4796350/attachment-0001.bin>


More information about the llvm-commits mailing list