Issue 148431
Summary [LV] VPlan cost model and legacy cost model disagreed
Labels new issue
Assignees
Reporter sjoerdmeijer
    Compile this:

```
bool a;
extern long b[][1][16];
int e;
char c;
void d(char p1[][6]) {
#pragma clang loop vectorize_predicate(enable)
  for (char f = 0; f < (signed char)-c - 15;
 f += (2147483647 >> 8672 - 8643) + 1)
    a = b[f][f][1] = p1[e][1] + 1;
}
```

with `clang++    -Ofast  -mcpu=grace` results in:

```
clang++: llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7086: VectorizationFactor llvm::LoopVectorizationPlanner::computeBestVF(): Assertion `(BestFactor.Width == LegacyVF.Width || BestPlan.hasEarlyExit() || planContainsAdditionalSimplifications(getPlanFor(BestFactor.Width), CostCtx, OrigLoop, BestFactor.Width) || planContainsAdditionalSimplifications( getPlanFor(LegacyVF.Width), CostCtx, OrigLoop, LegacyVF.Width)) && " VPlan cost model and legacy cost model disagreed"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: llvm-project/build/bin/clang++ -std=c++11 -w -fPIC -Ofast -mllvm -enable-loopinterchange -mcpu=grace -o clang_ofast_func.o -c func.cpp
1.      <eof> parser at end of file
2.      Optimizer
3. Running pass "function<eager-inv>(float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,infer-alignment,loop-load-elim,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>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)" on module "func.cpp"
4.      Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "_Z1dPA6_c"
 #0 0x0000ae0ece921150 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /mnt/scratch.grco_devs2/smeijer/llvm-project/llvm/lib/Support/Unix/Signals.inc:834:13
 #1 0x0000ae0ece91ebe8 std::atomic<CallbackAndCookie::Status>::store(CallbackAndCookie::Status, std::memory_order) /usr/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/atomic:271:2
 #2 0x0000ae0ece91ebe8 llvm::sys::RunSignalHandlers() llvm-project/llvm/lib/Support/Signals.cpp:106:16
 #3 0x0000ae0ece88f6d8 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:73:5
 #4 0x0000ae0ece88f6d8 CrashRecoverySignalHandler(int) /mnt/scratch.grco_devs2/smeijer/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:390:51
 #5 0x0000e1f6987609d0 (linux-vdso.so.1+0x9d0)
 #6 0x0000e1f6981df200 __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
 #7 0x0000e1f69819a67c gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x0000e1f698187130 abort ./stdlib/./stdlib/abort.c:81:7
 #9 0x0000e1f698193fd0 __assert_fail_base ./assert/./assert/assert.c:89:7
#10 0x0000e1f698194040 __assert_perror_fail ./assert/./assert/assert-perr.c:31:1
#11 0x0000ae0ecfa5e64c planContainsAdditionalSimplifications(llvm::VPlan&, llvm::VPCostContext&, llvm::Loop*, llvm::ElementCount) llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6901:0
#12 0x0000ae0ecfa6fff0 llvm::LoopVectorizePass::processLoop(llvm::Loop*) llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10079:7
```

@fhahn : what is the plan with this? 
This has has caused so many issues, so many issues were raised against this? 
The problem is that this triggers so much in fuzzing, it is creating a lot of noise.
Can this be hidden behind on option?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to