<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 - Failed assertion in LoopStrengthReduce DbgRewriteSalvageableDVIs when printing a SCEV"
   href="https://bugs.llvm.org/show_bug.cgi?id=52161">52161</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failed assertion in LoopStrengthReduce DbgRewriteSalvageableDVIs when printing a SCEV
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.stenberg@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25359" name="attach_25359" title="IR reproducer.">attachment 25359</a> <a href="attachment.cgi?id=25359&action=edit" title="IR reproducer.">[details]</a></span>
IR reproducer.

Commit: 444ec0957c58492ecce0569bb20b7d3ad59d37bb

$ opt -debug -S -loop-reduce foo.ll
[...]
scev-salvage: SCEV salvaging not possible. An IV could not be identified.
scev-salvage: Selected IV from loop header:   %iv = phi i16 [ %ivdec, %for.body
], [ undef, %for.body.preheader ] with SCEV: {undef,+,-1}<%for.body>
scev-salvage: IV SCEV: {undef,+,-1}<%for.body>
scev-salvage: value to recover SCEV: opt:
/llvm/include/llvm/Support/Casting.h:104: static bool llvm::isa_impl_cl<To,
const From*>::doit(const From*) [with To = llvm::ConstantExpr; From =
llvm::Value]: Assertion `Val && "isa<> used on a null pointer"' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: ./build/bin/opt -debug -S -loop-reduce foo.ll
1.      Running pass 'Function Pass Manager' on module 'foo.ll'.
2.      Running pass 'Loop Pass Manager' on function '@n'
3.      Running pass 'Loop Strength Reduction' on basic block '%m'
 #0 0x00007f8874c74f1f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00007f8874c726cd SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f887a84c980 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #3 0x00007f887436dfb7 raise
/build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #4 0x00007f887436f921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
 #5 0x00007f887435f48a __assert_fail_base
/build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
 #6 0x00007f887435f502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
 #7 0x00007f88759c99d4 bool llvm::isa<llvm::SCEVUnionPredicate,
llvm::SCEVPredicate const*>(llvm::SCEVPredicate const* const&)
(.isra.1181.part.1182) ScalarEvolution.cpp:0:0
 #8 0x00007f8875c98b4b llvm::SCEVUnknown::isSizeOf(llvm::Type*&) const
(/build/bin/../lib/libLLVMAnalysis.so.14git+0x373b4b)
 #9 0x00007f8875c98e10 llvm::SCEV::print(llvm::raw_ostream&) const
(/build/bin/../lib/libLLVMAnalysis.so.14git+0x373e10)
#10 0x00007f88771423a1 ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&,
llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&,
llvm::TargetTransformInfo const&, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::MemorySSA*) LoopStrengthReduce.cpp:0:0
#11 0x00007f887714356b (anonymous
namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
LoopStrengthReduce.cpp:0:0

It is the following debug printout that leads to the failed assertion:

 LLVM_DEBUG(dbgs() << "scev-salvage: value to recover SCEV: "
                   << *DVIRec.SCEV << '\n');</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>