[llvm-bugs] [Bug 26207] New: Assertion failure in ScalarEvolution::getBackedgeTakenInfo

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 19 04:13:29 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26207

            Bug ID: 26207
           Summary: Assertion failure in
                    ScalarEvolution::getBackedgeTakenInfo
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mattias.v.eriksson at ericsson.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15661
  --> https://llvm.org/bugs/attachment.cgi?id=15661&action=edit
reduced input file

I am getting a crash in "indvars":

opt -S -indvars bugpoint-reduced-simplified.ll
Attempt to use a SCEVCouldNotCompute object!
UNREACHABLE executed at ../lib/Analysis/ScalarEvolution.cpp:9287!
0  opt             0x000000000190453e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1  opt             0x0000000001904949
2  opt             0x0000000001903253 llvm::sys::RunSignalHandlers() + 131
3  opt             0x0000000001904d8f
4  libpthread.so.0 0x00007effc7f64340
5  libc.so.6       0x00007effc718ccc9 gsignal + 57
6  libc.so.6       0x00007effc71900d8 abort + 328
7  opt             0x0000000001895e16
8  opt             0x0000000000c3678d
llvm::ScalarEvolution::computeLoopDisposition(llvm::SCEV const*, llvm::Loop
const*) + 1085
9  opt             0x0000000000c3622f
llvm::ScalarEvolution::getLoopDisposition(llvm::SCEV const*, llvm::Loop const*)
+ 239
10 opt             0x0000000000c178b5
llvm::ScalarEvolution::isLoopInvariant(llvm::SCEV const*, llvm::Loop const*) +
37
11 opt             0x0000000000c24dd9
llvm::ScalarEvolution::getBackedgeTakenInfo(llvm::Loop const*) + 377
12 opt             0x0000000000c2523f
llvm::ScalarEvolution::getBackedgeTakenCount(llvm::Loop const*) + 47
13 opt             0x00000000016c6534
14 opt             0x0000000000ba7122
llvm::LPPassManager::runOnFunction(llvm::Function&) + 1138
15 opt             0x000000000134d260
llvm::FPPassManager::runOnFunction(llvm::Function&) + 416
16 opt             0x000000000134d595
llvm::FPPassManager::runOnModule(llvm::Module&) + 117
17 opt             0x000000000134dd81
18 opt             0x000000000134d87b
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 347
19 opt             0x000000000134e2c1
llvm::legacy::PassManager::run(llvm::Module&) + 33
20 opt             0x00000000007de450 main + 8576
21 libc.so.6       0x00007effc7177ec5 __libc_start_main + 245
22 opt             0x00000000007b8a48
Stack dump:
0.      Program arguments: build/bin/opt -S -indvars
bugpoint-reduced-simplified.ll 
1.      Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.ll'.
2.      Running pass 'Loop Pass Manager' on function '@main'
3.      Running pass 'Induction Variable Simplification' on basic block
'%bb1.i'
Aborted


input file:
; ModuleID = 'bugpoint-reduced-simplified.bc'
target triple = "x86_64-unknown-linux-gnu"

define void @main() {
  br label %bb2

bb2:                                              ; preds = %bb1.i, %bb2, %0
  %_tmp44.i = icmp slt i16 undef, 2
  br i1 %_tmp44.i, label %bb1.i, label %bb2

bb1.i:                                            ; preds = %bb1.i, %bb2
  %_tmp25.i = phi i16 [ undef, %bb2 ], [ %_tmp6.i, %bb1.i ]
  %_tmp6.i = add nsw i16 %_tmp25.i, 1
  %_tmp10.i = icmp sge i16 %_tmp6.i, 2
  %exitcond.i = icmp eq i16 %_tmp6.i, 2
  %or.cond = and i1 %_tmp10.i, %exitcond.i
  br i1 %or.cond, label %bb2, label %bb1.i
}



This check in ScalarEvolution.cpp looks suspicious:

  if (Result.getExact(this) != getCouldNotCompute()) {
    assert(isLoopInvariant(Result.getExact(this), L) &&
           isLoopInvariant(Result.getMax(this), L) &&
           "Computed backedge-taken count isn't loop invariant for loop!");
    ++NumTripCountsComputed;
  }

The assertion is guarded for the getExact() case, but not for the getMax()
case. It is Result.getMax() that returns the SCEVCouldNotCompute here.

-- 
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/20160119/ff42d7f4/attachment.html>


More information about the llvm-bugs mailing list