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

            Bug ID: 36302
           Summary: Assertion "cast<Ty>() argument of incompatible type!"
                    in 'Unroll loops' pass
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: ilia.tara...@intel.com
                CC: llvm-bugs@lists.llvm.org

This test fails at "Unroll loops" with "cast<Ty>() argument of incompatible
type!" :

================= nice.c ==============
unsigned int m = 0;
unsigned int a [192];
int main ()
{
    unsigned int j = 0;
    unsigned int i = 0;
    for (i = 0; i <= 7; i++)
        for (j = i; j > 1; j--) {
            if (i == 96)
                m++;
            if (i == 0)
                a[0] = j;

            a[2 * j]++;
        }
    return 0;
}


=======================================

>>> clang -v
clang version 7.0.0 (trunk 324592)
Target: x86_64-unknown-linux-gnu
Thread model: posix

...


>>> clang -c -O3 -march=skx nice.c
clang-7.0: .../llvm/include/llvm/Support/Casting.h:255: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantInt; Y
= llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type =
llvm::ConstantInt*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
...
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'nice.c'.
4.      Running pass 'Loop Pass Manager' on function '@main'
5.      Running pass 'Unroll loops' on basic block '%vector.body'


This is a small ll reproducer for opt:
================= fine.ll =============
@a = external local_unnamed_addr global [4 x i64], align 16

; Function Attrs: norecurse nounwind uwtable
define void @main() local_unnamed_addr #0 {
entry:
  br label %vector.body

vector.body:                                      ; preds = %vector.body,
%entry
  %vec.ind = phi <2 x i64> [ <i64 2, i64 1>, %entry ], [ undef, %vector.body ]
  %0 = shl <2 x i64> %vec.ind, <i64 1, i64 1>
  %1 = getelementptr inbounds [4 x i64], [4 x i64]* @a, i64 0, <2 x i64> %0
  br i1 undef, label %middle.block, label %vector.body

middle.block:                                     ; preds = %vector.body
  unreachable
}

=======================================

>>> opt -loop-unroll fine.ll
opt: .../llvm/include/llvm/Support/Casting.h:255: typename llvm::cast_retty<X,
Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantInt; Y = llvm::Value;
typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantInt*]: Assertion
`isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

...

Stack dump:
0.      Program arguments: opt -loop-unroll fine.ll
1.      Running pass 'Function Pass Manager' on module 'fine.ll'.
2.      Running pass 'Loop Pass Manager' on function '@main'
3.      Running pass 'Unroll loops' on basic block '%vector.body'
Aborted (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to