[llvm-bugs] [Bug 37651] New: Assertion `SE->DT.dominates(ENT.ExitingBlock, Latch) && "We should only have known counts for exiting blocks that dominate " "latch!"' failed. with -iv-users -simple-loop-unswitch -indvars

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 1 01:54:30 PDT 2018


            Bug ID: 37651
           Summary: Assertion `SE->DT.dominates(ENT.ExitingBlock, Latch)
                    && "We should only have known counts for exiting
                    blocks that dominate " "latch!"' failed. with
                    -iv-users -simple-loop-unswitch -indvars
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20381
  --> https://bugs.llvm.org/attachment.cgi?id=20381&action=edit
reduced reproducer

opt -iv-users -simple-loop-unswitch -indvars -S -o - bbi-14845.ll


opt: ../lib/Analysis/ScalarEvolution.cpp:6728: const llvm::SCEV
*llvm::ScalarEvolution::BackedgeTakenInfo::getExact(const llvm::Loop *,
llvm::ScalarEvolution *, llvm::SCEVUnionPredicate *) const: Assertion
`SE->DT.dominates(ENT.ExitingBlock, Latch) && "We should only have known counts
for exiting blocks that dominate " "latch!"' failed.
Stack dump:
0.      Program arguments: build-all/bin/opt -iv-users -simple-loop-unswitch
-indvars -S -o - bbi-14845.ll 
1.      Running pass 'Function Pass Manager' on module 'bbi-14845.ll'.
2.      Running pass 'Loop Pass Manager' on function '@f1'
3.      Running pass 'Induction Variable Simplification' on basic block '%bb3'
#0 0x00000000021a48a4 PrintStackTraceSignalHandler(void*)
#1 0x00000000021a2b80 llvm::sys::RunSignalHandlers()
#2 0x00000000021a4c08 SignalHandler(int) (build-all/bin/opt+0x21a4c08)
#3 0x00007f44eec51330 __restore_rt
#4 0x00007f44ed840c37 gsignal
#5 0x00007f44ed844028 abort
#6 0x00007f44ed839bf6 __assert_fail_base
#7 0x00007f44ed839ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x00000000017475b6
llvm::ScalarEvolution::BackedgeTakenInfo::getExact(llvm::Loop const*,
llvm::ScalarEvolution*, llvm::SCEVUnionPredicate*) const
#9 0x0000000001f9ef1a (anonymous namespace)::IndVarSimplify::run(llvm::Loop*)
#10 0x0000000001fa44fc (anonymous
llvm::LPPassManager&) (build-all/bin/opt+0x1fa44fc)
#11 0x00000000016d0885 llvm::LPPassManager::runOnFunction(llvm::Function&)
#12 0x0000000001c2567a llvm::FPPassManager::runOnFunction(llvm::Function&)
#13 0x0000000001c258d8 llvm::FPPassManager::runOnModule(llvm::Module&)
#14 0x0000000001c25e0d llvm::legacy::PassManagerImpl::run(llvm::Module&)
#15 0x000000000077058c main (build-all/bin/opt+0x77058c)
#16 0x00007f44ed82bf45 __libc_start_main
#17 0x0000000000759a5d _start (build-all/bin/opt+0x759a5d)

This started happening with commit r328611:

    [SCEV] Make exact taken count calculation more optimistic

    Currently, `getExact` fails if it sees two exit counts in different blocks.
There is
    no solid reason to do so, given that we only calculate exact non-taken
    for exiting blocks that dominate latch. Using this fact, we can simply take
    out of all exits of all blocks to get the exact taken count.

    This patch makes the calculation more optimistic with enforcing our
    with asserts. It allows us to calculate exact backedge taken count in
trivial loops

      for (int i = 0; i < 100; i++) {
        if (i > 50) break;
        . . .

    Differential Revision: https://reviews.llvm.org/D44676
    Reviewed By: fhahn

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328611

Found when running random passes on random input. We don't normally use
-iv-users -simple-loop-unswitch.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180601/6a4325e9/attachment-0001.html>

More information about the llvm-bugs mailing list