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

    <tr>
        <th>Summary</th>
        <td>
            `clang-17`: Assertion `IterCnt++ < 1000 && "Iterative simplification didn't converge!"' failed.
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          wierton
      </td>
    </tr>
</table>

<pre>
    Below is the testing program:
```
#define C(a, b) if (a > b) return; if (a < b)  return;

#define C4(x, b) C((x)[0], b) C((x)[1], b) C((x)[2], b) C((x)[3], b)
#define C16(x, y) C4(x, (y)[0]) C4(x, (y)[1]) C4(x, (y)[2]) C4(x, (y)[3])
#define C64(x, y) C16(x, y) C16(x + 4, y) C16(x + 8, y) C16(x + 12, y)
#define C256(x, y) C64(x, y) C64(x, y + 4) C64(x, y + 8) C64(x, y + 12)
#define C1024(x, y) C256(x, y) C256(x + 16, y) C256(x + 32, y) C256(x + 48, y)

void foo(int x[64], int y[64]) {
  C1024(x, y);
}
```

When compiling it using Clang with option `clang-17 -O1 small.c`, Clang triggers an assertion failure:
```
clang: /root/llvm-project/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp:240: bool iterativelySimplifyCFG(llvm::Function&, const llvm::TargetTransformInfo&, llvm::DomTreeUpdater*, const llvm::SimplifyCFGOptions&): Assertion `IterCnt++ < 1000 && "Iterative simplification didn't converge!"' 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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O1 <source>
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x00005608a752423f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c4223f)
 #1 0x00005608a7521fac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c3ffac)
 #2 0x00005608a746c608 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fd080814420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fd0802e100b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007fd0802c0859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007fd0802c0729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007fd0802d1fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x00005608a74015b4 iterativelySimplifyCFG(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&) SimplifyCFGPass.cpp:0:0
 #9 0x00005608a7402cf0 simplifyFunctionCFGImpl(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DominatorTree*, llvm::SimplifyCFGOptions const&) SimplifyCFGPass.cpp:0:0
#10 0x00005608a7403495 simplifyFunctionCFG(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DominatorTree*, llvm::SimplifyCFGOptions const&) SimplifyCFGPass.cpp:0:0
#11 0x00005608a740362a llvm::SimplifyCFGPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b2162a)
#12 0x00005608a555f7c6 llvm::detail::PassModel<llvm::Function, llvm::SimplifyCFGPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1c7d7c6)
#13 0x00005608a4da8c4d 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>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x14c6c4d)
#14 0x00005608a6ed2acd llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35f0acd)
#15 0x00005608a4d8c476 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x14aa476)
#16 0x00005608a6ed0a4d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35eea4d)
#17 0x00005608a77a1837 (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
#18 0x00005608a77a4899 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>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ec2899)
#19 0x00005608a87ad6fd clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ecb6fd)
#20 0x00005608a9cd7279 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63f5279)
#21 0x00005608a87abeb8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ec9eb8)
#22 0x00005608a7fee2f9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x470c2f9)
#23 0x00005608a7f735d6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x46915d6)
#24 0x00005608a80d3646 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47f1646)
#25 0x00005608a49f48b4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x11128b4)
#26 0x00005608a49f05da ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x00005608a7dcd53d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#28 0x00005608a746cb10 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b8ab10)
#29 0x00005608a7dcdb5f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#30 0x00005608a7d9473c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44b273c)
#31 0x00005608a7d951cd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44b31cd)
#32 0x00005608a7d9d2ad clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44bb2ad)
#33 0x00005608a49f2b2a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1110b2a)
#34 0x00005608a48f8625 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1016625)
#35 0x00007fd0802c2083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#36 0x00005608a49eb3be _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x11093be)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```

The version of testing clang (associated with 9e362e5e3fe0b7f85160c3a06e9c646e1c75e8e0):
```
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 9e362e5e3fe0b7f85160c3a06e9c646e1c75e8e0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-assertions-trunk/bin
```

The behavior mentioned above can be verified at link https://gcc.godbolt.org/z/54f6vhhKq
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl9z46iy_zTKC2UXQv8f8uA4k93Zu1uTmmTvfXQhaNnckUEHkBOfT38LSbaFYmczc7xb95ytyh8bUPevf900DYIaI9YS4DZI7oLk_oa2dqP07YsAbZW8KRXf395BrV6QMMhuAFkwVsg1arRaa7oNokWA7wO8CFI8_PRfScShEhLQMiA5DcgSlQEpkKiQ-46C6FPfoMG2WgbR3ahrGHvqG2ROJccByV-Pop2ivqEIkjscJPcXusLLXeRyVzTqeoMkTA9Q9t2TR2QByfdjQOf7wnf6yDt9Paa3cNLYhzOF139HAblD8dnW_GxrSA7NbzS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