<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Crash in Loop Strength Reduction pass"
   href="https://bugs.llvm.org/show_bug.cgi?id=48708">48708</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash in Loop Strength Reduction pass
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>lorenz@brun.one
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I got the following crash in the Loop Strength Reduction pass when
cross-compiling gRPC for Windows x86_64:

```
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module
'../src/core/ext/xds/xds_bootstrap.cc'.
4.      Running pass 'Loop Pass Manager' on function
'@"??$EmplaceBack@$$V@?$Storage@UXdsServer@XdsBootstrap@grpc_core@@$00V?$allocator@UXdsServer@XdsBootstrap@grpc_core@@@std@@@inlined_vector_internal@lts_2020_09_23@absl@@QEAAAEAUXdsServer@XdsBootstrap@grpc_core@@XZ"'
5.      Running pass 'Loop Strength Reduction' on basic block '%59'
 #0 0x0000560cef17bec1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x3038ec1)
 #1 0x0000560cef179c94 llvm::sys::RunSignalHandlers()
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x3036c94)
 #2 0x0000560cef179f31 llvm::sys::CleanupOnSignal(unsigned long)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x3036f31)
 #3 0x0000560cef0e2068 CrashRecoverySignalHandler(int)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x2f9f068)
 #4 0x00007fbeb04273c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x0000560cee9590b8
llvm::ReplaceableMetadataImpl::getOrCreate(llvm::Metadata&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x28160b8)
 #6 0x0000560cee95dab9 llvm::MetadataTracking::track(void*, llvm::Metadata&,
llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x281aab9)
 #7 0x0000560ceef7925b (anonymous namespace)::LSRInstance::Expand((anonymous
namespace)::LSRUse const&, (anonymous namespace)::LSRFixup const&, (anonymous
namespace)::Formula const&,
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false,
false, void>, false, false>, llvm::SCEVExpander&,
llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) const
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x2e3625b)
 #8 0x0000560ceef86e9f (anonymous
namespace)::LSRInstance::RewriteForPHI(llvm::PHINode*, (anonymous
namespace)::LSRUse const&, (anonymous namespace)::LSRFixup const&, (anonymous
namespace)::Formula const&, llvm::SCEVExpander&,
llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) const
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x2e43e9f)
 #9 0x0000560ceef8c1f4 ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&,
llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&,
llvm::TargetTransformInfo const&, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::MemorySSA*)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x2e491f4)
#10 0x0000560ceef8ddf8 (anonymous
namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x2e4adf8)
#11 0x0000560cee2a87cb llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x21657cb)
#12 0x0000560cee950470 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x280d470)
#13 0x0000560cee952279 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x280f279)
#14 0x0000560cee94fe80 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x280ce80)
#15 0x0000560cef459715 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x3316715)
#16 0x0000560cf0150669
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x400d669)
#17 0x0000560cf0dbf3a9 clang::ParseAST(clang::Sema&, bool, bool)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x4c7c3a9)
#18 0x0000560cf014f256 clang::CodeGenAction::ExecuteAction()
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x400c256)
#19 0x0000560cefaa8d81 clang::FrontendAction::Execute()
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x3965d81)
#20 0x0000560cefa4631b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x390331b)
#21 0x0000560cefb79560
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x3a36560)
#22 0x0000560cecfc4991 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/lorenz/programs/llvm-project/build/bin/clang-12+0xe81991)
#23 0x0000560cecfc206b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0xe7f06b)
#24 0x0000560cef8f5d59 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const::'lambda'()>(long)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x37b2d59)
#25 0x0000560cef0e2167
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x2f9f167)
#26 0x0000560cef8f6835
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const (.part.0)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x37b3835)
#27 0x0000560cef8cb04c
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x378804c)
#28 0x0000560cef8cba56
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x3788a56)
#29 0x0000560cef8d2ea2
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0x378fea2)
#30 0x0000560cecf115b3 main
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0xdce5b3)
#31 0x00007fbeafea80b3 __libc_start_main
/build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#32 0x0000560cecfc1bfe _start
(/home/lorenz/programs/llvm-project/build/bin/clang-12+0xe7ebfe)
clang-12: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
clang version 12.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
47991a15d1925cba4687c5077cc9c81c8fcd00bd)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: /home/lorenz/programs/llvm-project/build/bin
clang-12: note: diagnostic msg: 
```

Reproduces on trunk with:
`clang-12 -cc1 -triple x86_64-pc-windows-msvc19.11.0 -emit-obj
-mincremental-linker-compatible --mrelax-relocations -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name xds_bootstrap.cc
-mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno
-fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64
-tune-cpu generic -sys-header-deps -D _CRT_USE_BUILTIN_OFFSETOF=1 -D
CARES_STATICLIB -D NDEBUG -D _DLL -D _MT -O3 -Wno-unused-command-line-argument
-std=c++14 -fdeprecated-macro -ferror-limit 19 -fno-use-cxa-atexit
-fms-extensions -fms-compatibility -fms-compatibility-version=19.11
-fdelayed-template-parsing -fcxx-exceptions -fexceptions -vectorize-loops
-vectorize-slp --dependent-lib=msvcrt -faddrsig -x c++
xds_bootstrap-2f1236.cpp`

This does seem to be a regression as with my distro clang 10 this works.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>