<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Crash in LoopVectorizer/ScalarEvolution"
   href="https://llvm.org/bugs/show_bug.cgi?id=31900">31900</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash in LoopVectorizer/ScalarEvolution
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>karl-johan.karlsson@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17949" name="attach_17949" title="Reproducer: opt -mtriple=aarch64-apple-ios -loop-vectorize -enable-interleaved-mem-accesses -o /dev/null loopvectorize_crash.ll">attachment 17949</a> <a href="attachment.cgi?id=17949&action=edit" title="Reproducer: opt -mtriple=aarch64-apple-ios -loop-vectorize -enable-interleaved-mem-accesses -o /dev/null loopvectorize_crash.ll">[details]</a></span>
Reproducer: opt -mtriple=aarch64-apple-ios -loop-vectorize
-enable-interleaved-mem-accesses -o /dev/null loopvectorize_crash.ll

The fault was detected in a out of tree backend, but I was able to reproduce
the fault in the aarch64 architecture by adding different sized addresspace
pointers to the aarch64 datalayout (see reproducer).

$ opt -mtriple=aarch64-apple-ios -loop-vectorize
-enable-interleaved-mem-accesses -o /dev/null loopvectorize_crash.ll
opt: ../lib/Analysis/ScalarEvolution.cpp:2118: const llvm::SCEV
*llvm::ScalarEvolution::getAddExpr(SmallVectorImpl<const llvm::SCEV *> &,
SCEV::NoWrapFlags, unsigned int): Assertion
`getEffectiveSCEVType(Ops[i]->getType()) == ETy && "SCEVAddExpr operand types
don't match!"' failed.
#0 0x0000000001b09bf4 PrintStackTraceSignalHandler(void*) (opt+0x1b09bf4)
#1 0x0000000001b0a366 SignalHandler(int) (opt+0x1b0a366)
#2 0x00007f5e7223c330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007f5e70e2fc37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007f5e70e33028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007f5e70e28bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#6 0x00007f5e70e28ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x00000000012373c9
llvm::ScalarEvolution::getAddExpr(llvm::SmallVectorImpl<llvm::SCEV const*>&,
llvm::SCEV::NoWrapFlags, unsigned int) (opt+0x12373c9)
#8 0x0000000001246202 llvm::ScalarEvolution::getMinusSCEV(llvm::SCEV const*,
llvm::SCEV const*, llvm::SCEV::NoWrapFlags) (opt+0x1246202)
#9 0x0000000001c22a3b (anonymous
namespace)::LoopVectorizationLegality::canVectorize() (opt+0x1c22a3b)
#10 0x0000000001c1822b llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(opt+0x1c1822b)
#11 0x0000000001c27ef3 llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&) (opt+0x1c27ef3)
#12 0x0000000001c472db (anonymous
namespace)::LoopVectorize::runOnFunction(llvm::Function&) (opt+0x1c472db)
#13 0x000000000165f4d8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(opt+0x165f4d8)
#14 0x000000000165f718 llvm::FPPassManager::runOnModule(llvm::Module&)
(opt+0x165f718)
#15 0x000000000165fbf5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(opt+0x165fbf5)
#16 0x00000000006ce24d main (opt+0x6ce24d)
#17 0x00007f5e70e1af45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#18 0x00000000006bfbf9 _start (opt+0x6bfbf9)
Stack dump:
0.      Program arguments: opt -mtriple=aarch64-apple-ios -loop-vectorize
-enable-interleaved-mem-accesses -o /dev/null loopvectorize_crash.ll
1.      Running pass 'Function Pass Manager' on module
'loopvectorize_crash.ll'.
2.      Running pass 'Loop Vectorization' on function '@foo'
Aborted (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>