Issue |
137024
|
Summary |
[LoopVectorizer] Assertion `hasKnownScalarFactor(RHS) && "Expected RHS to be a known factor!"' failed.
|
Labels |
new issue
|
Assignees |
|
Reporter |
ewlu
|
Testcase:
```llvm ir
; ModuleID = 'reduced.bc'
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"
define void @d(i1 %tobool31.not.12, i12 %0) #0 {
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
%a.promoted5561 = phi i32 [ 0, %entry ], [ %op.rdx64, %for.body ]
br label %for.body
for.body: ; preds = %for.body, %for.cond
%u.059 = phi i16 [ 0, %for.cond ], [ %add35, %for.body ]
%a.promoted5658 = phi i32 [ %a.promoted5561, %for.cond ], [ %op.rdx64, %for.body ]
%lnot.ext.12 = zext i1 %tobool31.not.12 to i32
%1 = zext i12 %0 to i32
%op.rdx = add i32 %1, %lnot.ext.12
%op.rdx64 = or i32 %op.rdx, %a.promoted5658
%add35 = add i16 %u.059, 1
%tobool.not = icmp eq i16 %add35, 0
br i1 %tobool.not, label %for.cond, label %for.body
}
attributes #0 = { "target-features"="+v" }
```
Command/backtrace
```
$ /scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt "-passes=lto<O3>" reduced.ll
WARNING: You're attempting to print out a bitcode file.
This is inadvisable as it may cause display problems. If
you REALLY want to taste LLVM bitcode first-hand, you
can force output with the `-f' option.
opt: /scratch/ewlu/daily-upstream-build/llvm/llvm/include/llvm/Support/TypeSize.h:280: constexpr llvm::details::FixedOrScalableQuantity<LeafTy, ValueTy>::ScalarTy llvm::details::FixedOrScalableQuantity<LeafTy, ValueTy>::getKnownScalarFactor(const llvm::details::FixedOrScalableQuantity<LeafTy, ValueTy>&) const [with LeafTy = llvm::TypeSize; ValueTy = long unsigned int; ScalarTy = long unsigned int]: Assertion `hasKnownScalarFactor(RHS) && "Expected RHS to be a known factor!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt -passes=lto<O3> reduced.ll
1. Running pass "function<eager-inv>(loop-mssa(licm<allowspeculation>),gvn<>,memcpyopt,dse,move-auto-init,mldst-motion<no-split-footer-bb>,loop(indvars,loop-deletion,loop-unroll-full),loop-distribute,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,infer-alignment,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,sccp,instcombine<max-iterations=1;no-verify-fixpoint>,bdce,slp-vectorizer,vector-combine,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,jump-threading)" on module "reduced.ll"
2. Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "d"
#0 0x00005d9f263c7fb2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x34c8fb2)
#1 0x00005d9f263c501f llvm::sys::RunSignalHandlers() (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x34c601f)
#2 0x00005d9f263c5164 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007431bf045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x00007431bf09eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007431bf09eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007431bf09eb2c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007431bf04527e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007431bf0288ff abort ./stdlib/abort.c:81:7
#9 0x00007431bf02881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007431bf03b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#11 0x00005d9f251c9646 llvm::VPRecipeBuilder::getScaledReductions(llvm::Instruction*, llvm::Instruction*, llvm::VFRange&, llvm::SmallVectorImpl<std::pair<llvm::PartialReductionChain, unsigned int>>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x22ca646)
#12 0x00005d9f251f82ec llvm::VPRecipeBuilder::collectScaledReductions(llvm::VFRange&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x22f92ec)
#13 0x00005d9f252123aa llvm::LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(llvm::VFRange&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x23133aa)
#14 0x00005d9f25214812 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x2315812)
#15 0x00005d9f25214f2d llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x2315f2d)
#16 0x00005d9f25216ed5 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x2317ed5)
#17 0x00005d9f2521a2b1 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x231b2b1)
#18 0x00005d9f2521a877 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x231b877)
#19 0x00005d9f23ecce55 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0xfcde55)
#20 0x00005d9f261b33aa llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x32b43aa)
#21 0x00005d9f23ecf595 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0xfd0595)
#22 0x00005d9f261b1c84 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x32b2c84)
#23 0x00005d9f23ecb315 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0xfcc315)
#24 0x00005d9f261b229d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x32b329d)
#25 0x00005d9f2365ed61 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/scrat
ch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x75fd61)
#26 0x00005d9f2365089c optMain (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x75189c)
#27 0x00007431bf02a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#28 0x00007431bf02a28b call_init ./csu/../csu/libc-start.c:128:20
#29 0x00007431bf02a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#30 0x00005d9f23646ee5 _start (/scratch/ewlu/daily-upstream-build/build-gcv/build-llvm-linux/bin/opt+0x747ee5)
Aborted
```
Godbolt: https://godbolt.org/z/3Gaar59K5
Found via fuzzer (C program before reduction)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs