<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 - "Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch> Changed!" with verify<scalar-evolution>"
   href="https://bugs.llvm.org/show_bug.cgi?id=51179">51179</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch>  Changed!" with verify<scalar-evolution>
          </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>mikael.holmen@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>listmail@philipreames.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>listmail@philipreames.com
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch>  Changed!" with verify<scalar-evolution>
          </td>
        </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch> Changed!" with verify<scalar-evolution>"
   href="https://bugs.llvm.org/show_bug.cgi?id=51179#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch> Changed!" with verify<scalar-evolution>"
   href="https://bugs.llvm.org/show_bug.cgi?id=51179">bug 51179</a>
              from <span class="vcard"><a class="email" href="mailto:listmail@philipreames.com" title="listmail@philipreames.com">listmail@philipreames.com</a>
</span></b>
        <pre>This one is tricky and subtle.  I'm leaning towards calling this a verifier
bug.  It's definitely not specific to the triggering patch though.

We've proven that the code is unreachable, and any transformation is legal on
unreachable code.  The transformation being done here *wouldn't* be legal if
the loop in question was reachable, but since it's dead, all bets are off.

Unfortunately, it's hard to see a small fix for the verifier here.  In this
case, the fact the loop is unreachable is "obvious", but in general, it could
be hidden in an arbitrarily complex way that SCEV happened to understand.  So,
it's not as simple as trying to restrict the verifier to reachable loops.

We could probably mask this particular false positive easily enough, but I
don't see a good general solution here.</pre>
        </div>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch> Changed!" with verify<scalar-evolution>"
   href="https://bugs.llvm.org/show_bug.cgi?id=51179#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch> Changed!" with verify<scalar-evolution>"
   href="https://bugs.llvm.org/show_bug.cgi?id=51179">bug 51179</a>
              from <span class="vcard"><a class="email" href="mailto:mikael.holmen@ericsson.com" title="Mikael Holmén <mikael.holmen@ericsson.com>"> <span class="fn">Mikael Holmén</span></a>
</span></b>
        <pre>*** <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - "Trip Count for Loop at depth 1 containing: %for.cond1415<header><exiting>,%for.body1419<latch> Changed!" with opt -passes='function(loop-mssa(indvars),verify<scalar-evolution>)'"
   href="show_bug.cgi?id=51180">Bug 51180</a> has been marked as a duplicate of this bug. ***</pre>
        </div>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25051" name="attach_25051" title="bbi-58443.ll">attachment 25051</a> <a href="attachment.cgi?id=25051&action=edit" title="bbi-58443.ll">[details]</a></span>
bbi-58443.ll

llvm commit: 989bedec7a6a

Reproduce with:
 opt -passes='function(loop-mssa(indvars),verify<scalar-evolution>)' -o
/dev/null bbi-58443.ll

Result:
Trip Count for Loop at depth 1 containing:
%for.cond1415<header><exiting>,%for.body1419<latch>
 Changed!
Old: 1
New: 0
Delta: 1
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-all-builtins/bin/opt
-passes=function(loop-mssa(indvars),verify<scalar-evolution>) -o /dev/null
bbi-58443.ll
 #0 0x0000000002aabec3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(build-all-builtins/bin/opt+0x2aabec3)
 #1 0x0000000002aa9b3e llvm::sys::RunSignalHandlers()
(build-all-builtins/bin/opt+0x2aa9b3e)
 #2 0x0000000002aac246 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fc5aaae9630 __restore_rt sigaction.c:0:0
 #4 0x00007fc5a821c387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007fc5a821da78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x0000000001b81b95 llvm::ScalarEvolution::verify() const
(build-all-builtins/bin/opt+0x1b81b95)
 #7 0x0000000001b830e1 llvm::ScalarEvolutionVerifierPass::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) (build-all-builtins/bin/opt+0x1b830e1)
 #8 0x0000000002dab4ed llvm::detail::PassModel<llvm::Function,
llvm::ScalarEvolutionVerifierPass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) crtstuff.c:0:0
 #9 0x0000000002293065 llvm::PassManager<llvm::Function,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) (build-all-builtins/bin/opt+0x2293065)
#10 0x0000000000ac733d llvm::detail::PassModel<llvm::Function,
llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >,
llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>
<span class="quote">>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) crtstuff.c:0:0</span >
#11 0x0000000002297346 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) (build-all-builtins/bin/opt+0x2297346)
#12 0x00000000007952bd llvm::detail::PassModel<llvm::Module,
llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) crtstuff.c:0:0
#13 0x0000000002292258 llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) (build-all-builtins/bin/opt+0x2292258)
#14 0x000000000078d620 llvm::runPassPipeline(llvm::StringRef, llvm::Module&,
llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*,
llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef,
llvm::ArrayRef<llvm::StringRef>, llvm::opt_tool::OutputKind,
llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool)
(build-all-builtins/bin/opt+0x78d620)
#15 0x000000000079ff05 main (build-all-builtins/bin/opt+0x79ff05)
#16 0x00007fc5a8208555 __libc_start_main (/lib64/libc.so.6+0x22555)
#17 0x000000000078843c _start (build-all-builtins/bin/opt+0x78843c)
Abort

This starts happening with commit fff1363ba0ae5
    [SCEV] Add false->any implication

    By definition of Implication operator, `false -> true` and `false ->
false`. It means that
    `false` implies any predicate, no matter true or false. We don't need to go
any further
    trying to prove the statement we need and just always say that `false`
implies it in this case.

    In practice it means that we are trying to prove something guarded by
`false` condition,
    which means that this code is unreachable, and we can safely prove any fact
or perform any
    transform in this code.

    Differential Revision: <a href="https://reviews.llvm.org/D98706">https://reviews.llvm.org/D98706</a>
    Reviewed By: lebedev.ri</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>