[PATCH] D68577: [LV] Apply sink-after & interleave-groups as VPlan transformations (NFC)

Wang Tianqing via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 18:09:08 PST 2019


tianqing added a comment.

In D68577#1736452 <https://reviews.llvm.org/D68577#1736452>, @rtrieu wrote:

> The recommited patch is hitting an assert.  See message and reduced test case below:
>
> assertion failed at llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:91 in llvm::VPRecipeBase *llvm::VPRecipeBuilder::getRecipe(llvm::Instruction *): Ingredient2Recipe[I] != nullptr && "Ingredient doesn't have a recipe"


I've got a similar crash. My case is a little bit simpler:

  #include <stdio.h>
  
  void find(int *data) {
      char t = 0; // changing char to int won't trigger the crash
      for (int i = 789; i > 0; i--)
          t = t || (data[i] == 42); // note the short circuit of OR
      if (t) // removing this conditional won't trigger the crash
        printf("some string");
  }

This compiles to (under clang++ -O3):

  define dso_local void @_Z4findPi(i32* nocapture readonly %0) local_unnamed_addr #0 {
    br label %4
  
  2:                                                ; preds = %11
    %3 = phi i1 [ %12, %11 ]
    br i1 %3, label %16, label %18
  
  4:                                                ; preds = %11, %1
    %5 = phi i64 [ 789, %1 ], [ %13, %11 ]
    %6 = phi i1 [ true, %1 ], [ %15, %11 ]
    br i1 %6, label %7, label %11
  
  7:                                                ; preds = %4
    %8 = getelementptr inbounds i32, i32* %0, i64 %5
    %9 = load i32, i32* %8, align 4, !tbaa !2
    %10 = icmp eq i32 %9, 42
    br label %11
  
  11:                                               ; preds = %4, %7
    %12 = phi i1 [ true, %4 ], [ %10, %7 ]
    %13 = add nsw i64 %5, -1
    %14 = icmp eq i64 %13, 0
    %15 = xor i1 %12, true
    br i1 %14, label %2, label %4
  
  16:                                               ; preds = %2
    %17 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
    br label %18
  
  18:                                               ; preds = %2, %16
    ret void
  }

It identifies "br i1 %6, label %7, label %11" as sinkable and tries to sink it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68577/new/

https://reviews.llvm.org/D68577





More information about the llvm-commits mailing list