<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63970>63970</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang crash: Assertion `isAvailableAtLoopEntry(LHS, L) && "LHS is not available at Loop Entry"' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          shao-hua-li
      </td>
    </tr>
</table>

<pre>
    Looks like the fix in https://github.com/llvm/llvm-project/issues/63368 is not complete?

Compiler explorer: https://godbolt.org/z/f18anqdao

```console
% cat a.c
long a, b;
static char c;
long *d;
static long **e = &d;
int f, g;
long h[1];
void i() {
  c = 0;
  for (; c <= 0; c--)
 ;
}
void j(long);
void k() {
  j(a);
  i();
}
void j(long l) {
  short m = 67;
  long ***n[] = {&e, &e};
  for (; m; m--)
    g = *d = l + (int)a;
  f = 1;
  for (; g + f <= 4; f++)
 *e = &h[f];
}
int main() {}
%
% clang-tk -O2 a.c
clang-17: /zdata/shaoli/compilers/ccbuilder-repos/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:11431: bool llvm::ScalarEvolution::isLoopEntryGuardedByCond(const llvm::Loop*, llvm::CmpInst::Predicate, const llvm::SCEV*, const llvm::SCEV*): Assertion `isAvailableAtLoopEntry(LHS, L) && "LHS is not available at Loop Entry"' 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: /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name crash.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/zdata/shaoli/realsmith/debug -resource-dir /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17 -internal-isystem /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/zdata/shaoli/realsmith/debug -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/crash-f37609.o -x c crash.c
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x000055eba3c2d7bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3bb27bf)
 #1 0x000055eba3c2af14 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fceca441420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fcec9e9200b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fcec9e71859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007fcec9e71729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007fcec9e82fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x000055eba2d2f9cf llvm::ScalarEvolution::isLoopEntryGuardedByCond(llvm::Loop const*, llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x2cb49cf)
 #8 0x000055eba2d53b65 llvm::ScalarEvolution::getTripCountFromExitCount(llvm::SCEV const*, llvm::Type*, llvm::Loop const*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x2cd8b65)
 #9 0x000055eba52eb691 llvm::LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(llvm::VFRange&, llvm::SmallPtrSetImpl<llvm::Instruction*>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x5270691)
#10 0x000055eba52ee00f llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x527300f)
#11 0x000055eba52fe8f9 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x52838f9)
#12 0x000055eba530b5d1 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x52905d1)
#13 0x000055eba530e62d llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AssumptionCache&, llvm::LoopAccessInfoManager&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x529362d)
#14 0x000055eba530f870 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x5294870)
#15 0x000055eba4f19026 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4e9e026)
#16 0x000055eba14b00dd llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x14350dd)
#17 0x000055eba35da87d llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x355f87d)
#18 0x000055eba1493906 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x1418906)
#19 0x000055eba35d87fd llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x355d7fd)
#20 0x000055eba3eaaef6 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) BackendUtil.cpp:0:0
#21 0x000055eba3eae119 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3e33119)
#22 0x000055eba4eb76ed clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4e3c6ed)
#23 0x000055eba60659c9 clang::ParseAST(clang::Sema&, bool, bool) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x5fea9c9)
#24 0x000055eba4eb5eb8 clang::CodeGenAction::ExecuteAction() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4e3aeb8)
#25 0x000055eba46f81e9 clang::FrontendAction::Execute() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x467d1e9)
#26 0x000055eba467d216 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4602216)
#27 0x000055eba47dd586 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4762586)
#28 0x000055eba10fbcb4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x1080cb4)
#29 0x000055eba10f79da ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x000055eba10f8fac clang_main(int, char**, llvm::ToolContext const&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x107dfac)
#31 0x000055eba100e1f5 main (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0xf931f5)
#32 0x00007fcec9e73083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x000055eba10f27be _start (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x10777be)
clang-tk: error: unable to execute command: Aborted
clang-tk: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 46333f71f8e0d6444a9b2c9e063aedb83ebb9735)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
clang-tk: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-tk: note: diagnostic msg: /tmp/crash-9ee2f5.c
clang-tk: note: diagnostic msg: /tmp/crash-9ee2f5.sh
clang-tk: note: diagnostic msg: 

********************
%
% clang-tk -v
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 46333f71f8e0d6444a9b2c9e063aedb83ebb9735)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW1tv27iz_zTMCyFDou4PeXDsuC2QPQ2abPfRoMiRwy1FakkqTfbTH1CSHclxu2m3Cc754w84N3I4nPnNRUNqQq0VOwVwjtILlK7PaOfutDm3d1QHdx0NpDirNH88v9L6i8VSfAHs7gDX4gELhe-cay2Kl4hsENnshLvrqgXTDSIbKe_3P4LW6D-BOUQ2wtoOLCKbLI6zAguLlXaY6aaV4ADFGxSuUbgcvq900woJBsNDK7UBg-Ll8ZaaV1q6hTY7RDZ_I7Kpo4KqvzjVU04oC4cP08pqCeMoSTGjDtMFGwakVjtMEVnhCsUXw5h11AmG2R01mB1Ge0pElvyYbj-ByBIwitcYkeyJSCiHa89_N-d0h9KLCKXrw-i9FhwLRApESozycRRj1vMMD3QY19pgTxdf9JOr_TxmQYBIOZIdFqB8PdnhT0QKL4An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