[LLVMbugs] [Bug 13244] New: Assertion `isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not loop-invariant!"' failed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 30 04:46:55 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13244

             Bug #: 13244
           Summary: Assertion `isLoopInvariant(Operands[i], L) &&
                    "SCEVAddRecExpr operand is not loop-invariant!"'
                    failed
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: merkil at savhon.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following testcase makes Clang 3.2 r159419 (at -O2 and higher) fail. I also
noticed a pretty high compilation time (10 seconds on my low-end laptop). Clang
3.1 doesn't fail but is even slower (15 seconds).

$ cat file.c
int g;

void func(void)
{
    int a, i, j;
    char c = !g;

    for(i = 0; i < 5; i++)
    {
        for(j = 0; j < 19; j++)
            g = ((a *= 2) > 0) + c--;

        c *= g;
    }
}

$ clang -w -O2 file.c
clang: /home/merkil/git/clang/llvm/lib/Analysis/ScalarEvolution.cpp:2277: const
llvm::SCEV *llvm::ScalarEvolution::getAddRecExpr(SmallVectorImpl<const
llvm::SCEV *> &, const llvm::Loop *, SCEV::NoWrapFlags): Assertion
`isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not
loop-invariant!"' failed.
0  clang           0x0000000001be75bf
1  clang           0x0000000001be7a84
2  libpthread.so.0 0x000000344d410970
3  libc.so.6       0x000000344d037c15 gsignal + 53
4  libc.so.6       0x000000344d038f27 abort + 327
5  libc.so.6       0x000000344d030d22
6  libc.so.6       0x000000344d030dd2
7  clang           0x0000000001a536ae
llvm::ScalarEvolution::getAddRecExpr(llvm::SmallVectorImpl<llvm::SCEV const*>&,
llvm::Loop const*, llvm::SCEV::NoWrapFlags) + 494
8  clang           0x0000000001a577c1
llvm::ScalarEvolution::getAddRecExpr(llvm::SCEV const*, llvm::SCEV const*,
llvm::Loop const*, llvm::SCEV::NoWrapFlags) + 145
9  clang           0x00000000018aa433
10 clang           0x00000000018aa412
11 clang           0x00000000018aa3ef
12 clang           0x00000000018aa3ef
13 clang           0x00000000018aa3ef
14 clang           0x00000000018aa3ef
15 clang           0x0000000001896ab3
16 clang           0x0000000001892b8e
17 clang           0x0000000001a07e29
llvm::LPPassManager::runOnFunction(llvm::Function&) + 841
18 clang           0x0000000001b8db5b
llvm::FPPassManager::runOnFunction(llvm::Function&) + 443
19 clang           0x0000000001b8ddbb
llvm::FPPassManager::runOnModule(llvm::Module&) + 155
20 clang           0x0000000001b8e033
llvm::MPPassManager::runOnModule(llvm::Module&) + 419
21 clang           0x0000000001b8e5b8 llvm::PassManagerImpl::run(llvm::Module&)
+ 408
22 clang           0x0000000001b8e71a llvm::PassManager::run(llvm::Module&) +
10
23 clang           0x0000000000790c47
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 5143
24 clang           0x000000000078ea3a
25 clang           0x00000000008b79e4 clang::ParseAST(clang::Sema&, bool, bool)
+ 516
26 clang           0x000000000078da98 clang::CodeGenAction::ExecuteAction() +
184
27 clang           0x000000000066f685 clang::FrontendAction::Execute() + 101
28 clang           0x000000000065225d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 973
29 clang           0x0000000000639f84
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3316
30 clang           0x000000000062ebbb cc1_main(char const**, char const**, char
const*, void*) + 731
31 clang           0x00000000006364b6 main + 3542
32 libc.so.6       0x000000344d024695 __libc_start_main + 245
33 clang           0x000000000062e7fd
Stack dump:
0.    Program arguments: /home/merkil/git/clang/build/Release+Asserts/bin/clang
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
file.c -mrelocation-model static -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.22 -momit-leaf-frame-pointer -resource-dir
/home/merkil/git/clang/build/Release+Asserts/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/local/include -internal-isystem
/home/merkil/git/clang/build/Release+Asserts/bin/../lib/clang/3.2/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-w -fdebug-compilation-dir /home/merkil -ferror-limit 19 -fmessage-length 0
-mstackrealign -fobjc-runtime=gnu-fragile -fdiagnostics-show-option -o
/tmp/file-ninIg2.o -x c file.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'file.c'.
4.    Running pass 'Loop Pass Manager' on function '@func'
5.    Running pass 'Loop Strength Reduction' on basic block '%for.body5'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 159419)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list