[PATCH] D43536: [LV] Quick workaround for PR36311, vectorizer's isUniform() abuse triggers assert in SCEV

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 12:52:23 PST 2018


hsaito updated this revision to Diff 135315.

https://reviews.llvm.org/D43536

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/pr36311.ll


Index: lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- lib/Transforms/Vectorize/LoopVectorize.cpp
+++ lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3048,8 +3048,13 @@
 
   // Handle Stores:
   if (SI) {
-    assert(!Legal->isUniform(SI->getPointerOperand()) &&
-           "We do not allow storing to uniform addresses");
+    // TODO
+    // Quick workaround for PR36311 by commenting out the assert for which
+    // Legality already ensured will never trigger. Real fix is to avoid
+    // recomputing isUniform() here. Eventually, we should support some form
+    // of stores to uniform addresses.
+    // assert(!Legal->isUniform(SI->getPointerOperand()) &&
+    //        "We do not allow storing to uniform addresses");
     setDebugLocFromInst(Builder, SI);
 
     for (unsigned Part = 0; Part < UF; ++Part) {
Index: test/Transforms/LoopVectorize/pr36311.ll
===================================================================
--- test/Transforms/LoopVectorize/pr36311.ll
+++ test/Transforms/LoopVectorize/pr36311.ll
@@ -0,0 +1,44 @@
+; RUN: opt -loop-vectorize -force-vector-width=2 -S < %s
+;
+; Cleaned up version of fe_tools.all_dimensions.ll from PR36311.
+; Forcing VF=2 to trigger vector code gen
+
+$_ZN6dealii7FETools37hierarchic_to_lexicographic_numberingILi2EEENSt3__16vectorIjNS2_9allocatorIjEEEERKNS_17FiniteElementDataIXT_EEE = comdat any
+
+declare i32 @__gxx_personality_v0(...)
+
+; Function Attrs: uwtable
+define dso_local void @_ZN6dealii7FETools37hierarchic_to_lexicographic_numberingILi2EEENSt3__16vectorIjNS2_9allocatorIjEEEERKNS_17FiniteElementDataIXT_EEE() local_unnamed_addr #0 comdat align 2 personality i8* bitcast (i32 (....)* @__gxx_personality_v0 to i8*) {
+entry:
+  br label %for.body51
+
+for.body51:                                       ; preds = %for.body51, %entry
+  br i1 undef, label %for.body51, label %for.body89.lr.ph
+
+for.cond80.loopexit:                              ; preds = %for.body89
+  %inc94.lcssa = phi i32 [ %inc94, %for.body89 ]
+  br i1 undef, label %for.body89.lr.ph, label %nrvo.skipdtor.loopexit
+
+for.body89.lr.ph:                                 ; preds = %for.cond80.loopexit, %for.body51
+  %i79.0179 = phi i32 [ %add90, %for.cond80.loopexit ], [ 0, %for.body51 ]
+  %next_index.4178 = phi i32 [ %inc94.lcssa, %for.cond80.loopexit ], [ undef, %for.body51 ]
+  %add90 = add nuw i32 %i79.0179, 1
+  %mul91 = mul i32 %add90, undef
+  br label %for.body89
+
+for.body89:                                       ; preds = %for.body89, %for.body89.lr.ph
+  %j.0175 = phi i32 [ 0, %for.body89.lr.ph ], [ %add92, %for.body89 ]
+  %next_index.5174 = phi i32 [ %next_index.4178, %for.body89.lr.ph ], [ %inc94, %for.body89 ]
+  %add92 = add nuw i32 %j.0175, 1
+  %add93 = add i32 %add92, %mul91
+  %inc94 = add i32 %next_index.5174, 1
+  %conv95 = zext i32 %next_index.5174 to i64
+  %arrayidx.i160 = getelementptr inbounds i32, i32* undef, i64 %conv95
+  store i32 %add93, i32* %arrayidx.i160, align 4
+;, !tbaa !1
+  %cmp87 = icmp ult i32 %add92, undef
+  br i1 %cmp87, label %for.body89, label %for.cond80.loopexit
+
+nrvo.skipdtor.loopexit:                           ; preds = %for.cond80.loopexit
+  ret void
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43536.135315.patch
Type: text/x-patch
Size: 3290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180221/56586394/attachment-0001.bin>


More information about the llvm-commits mailing list