-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Description
This IR:
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"
define void @_Z1fv() #0 {
entry:
br label %for.body
for.cond.loopexit.loopexit: ; preds = %for.body
ret void
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%add15.lcssa1921 = phi i32 [ 0, %entry ], [ %add.1, %for.body ]
%conv8 = sext i16 0 to i32
%add = add i32 %add15.lcssa1921, %conv8
%conv8.1 = sext i16 0 to i32
%add.1 = add i32 %add, %conv8.1
store i32 %add.1, ptr null, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
%0 = and i64 %indvars.iv.next, 255
%exitcond.not = icmp eq i64 %0, 0
br i1 %exitcond.not, label %for.cond.loopexit.loopexit, label %for.body
}
attributes #0 = { "target-cpu"="grace" }
Triggers this assert:
opt: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8181: llvm::VPRecipeBase* llvm::VPRecipeBuilder::tryToCreatePartialReduction(llvm::VPInstruction*, unsigned int): Assertion `ScaleFactor == vputils::getVFScaleFactor(Accumulator->getDefiningRecipe()) && "all accumulators in chain must have same scale factor"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=loop-vectorize <source>
1. Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "<source>"
2. Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "_Z1fv"
#0 0x00000000059ad0e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59ad0e8)
#1 0x00000000059a9f94 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x00007efe89442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007efe894969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007efe89442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007efe894287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x00007efe8942871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x00007efe89439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x00000000036b2f1b llvm::VPRecipeBuilder::tryToCreatePartialReduction(llvm::VPInstruction*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36b2f1b)
#9 0x00000000036b599f llvm::VPRecipeBuilder::tryToCreateWidenRecipe(llvm::VPSingleDefRecipe*, llvm::VFRange&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36b599f)
#10 0x00000000036d4e5e llvm::LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>, llvm::VFRange&, llvm::LoopVersioning*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36d4e5e)
#11 0x00000000036d63a8 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36d63a8)
Compile with: opt -S -passes=loop-vectorize, see also: https://godbolt.org/z/7oedf34Pq
Reproduced from this C reproducer:
int a, b;
extern char e;
int *c;
short *d;
void f() {
for (int g;;)
for (char h; h < 20; h++) {
a = c[h];
for (int i = 0; i < 22; i += 3) {
e = 0;
b += d[g];
}
}
}