<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 - opt -separate-const-offset-from-gep fails with Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=45371">45371</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt -separate-const-offset-from-gep fails with Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
          </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>Scalar Optimizations
          </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>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23296" name="attach_23296" title="bbi-40415_aarch64.ll reproducer">attachment 23296</a> <a href="attachment.cgi?id=23296&action=edit" title="bbi-40415_aarch64.ll reproducer">[details]</a></span>
bbi-40415_aarch64.ll reproducer

Reproduce with:
 opt -mtriple aarch64-unknown-linux-gnu -separate-const-offset-from-gep -S -o -
bbi-40415_aarch64.ll

Result:

opt: ../include/llvm/Support/Casting.h:263: typename cast_retty<X, Y
*>::ret_type llvm::cast(Y *) [X = llvm::BinaryOperator, Y = llvm::User]:
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
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: ../../master/llvm/build-all-builtins/bin/opt
-mtriple aarch64-unknown-linux-gnu -separate-const-offset-from-gep -S -o -
bbi-40415_aarch64.ll 
1.      Running pass 'Function Pass Manager' on module 'bbi-40415_aarch64.ll'.
2.      Running pass 'Split GEPs to a variadic base and a constant offset for
better CSE' on function '@g'
 #0 0x000000000429aa64 PrintStackTraceSignalHandler(void*)
(../../master/llvm/build-all-builtins/bin/opt+0x429aa64)
 #1 0x000000000429862e llvm::sys::RunSignalHandlers()
(../../master/llvm/build-all-builtins/bin/opt+0x429862e)
 #2 0x000000000429ae6c SignalHandler(int)
(../../master/llvm/build-all-builtins/bin/opt+0x429ae6c)
 #3 0x00007f06058ce890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f0604377e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f0604379801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f060436939a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f0604369412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x000000000418c322 (anonymous
namespace)::ConstantOffsetExtractor::distributeExtsAndCloneChain(unsigned int)
(../../master/llvm/build-all-builtins/bin/opt+0x418c322)
 #9 0x000000000418c1dc (anonymous
namespace)::ConstantOffsetExtractor::distributeExtsAndCloneChain(unsigned int)
(../../master/llvm/build-all-builtins/bin/opt+0x418c1dc)
#10 0x0000000004189ae8 (anonymous
namespace)::SeparateConstOffsetFromGEP::splitGEP(llvm::GetElementPtrInst*)
(../../master/llvm/build-all-builtins/bin/opt+0x4189ae8)
#11 0x0000000004188638 (anonymous
namespace)::SeparateConstOffsetFromGEP::runOnFunction(llvm::Function&)
(../../master/llvm/build-all-builtins/bin/opt+0x4188638)
#12 0x0000000003af5374 llvm::FPPassManager::runOnFunction(llvm::Function&)
(../../master/llvm/build-all-builtins/bin/opt+0x3af5374)
#13 0x0000000003af5628 llvm::FPPassManager::runOnModule(llvm::Module&)
(../../master/llvm/build-all-builtins/bin/opt+0x3af5628)
#14 0x0000000003af5c7d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(../../master/llvm/build-all-builtins/bin/opt+0x3af5c7d)
#15 0x0000000002370d9f main
(../../master/llvm/build-all-builtins/bin/opt+0x2370d9f)
#16 0x00007f060435ab97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#17 0x000000000235b02a _start
(../../master/llvm/build-all-builtins/bin/opt+0x235b02a)
Abort (core dumped)</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>