<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 - [ConstantFold] llvm crashes when folding a GEP with vector index"
   href="https://bugs.llvm.org/show_bug.cgi?id=34880">34880</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ConstantFold] llvm crashes when folding a GEP with vector index
          </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>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>haicheng@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>opt -instsimplify -S crashes with following IRs

target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"

@block = global [64 x [8192 x i8]] zeroinitializer, align 1

define <2 x i8*> @foo() {
  %1 = getelementptr inbounds [64 x [8192 x i8]], [64 x [8192 x i8]]* @block,
i64 0, <2 x i64> <i64 0, i64 1>, i64 8192
  ret <2 x i8*> %1
}

The llvm output is

opt: /local/mnt/workspace/tools/clean/llvm/include/llvm/Support/Casting.h:255:
typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::IntegerType, Y
= const llvm::Type]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
#0 0x0000000001d01a94 PrintStackTraceSignalHandler(void*)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x1d01a94)
#1 0x0000000001d01db6 SignalHandler(int)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x1d01db6)
#2 0x00007fe5538f9330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007fe553556c37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37)
#4 0x00007fe55355a028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028)
#5 0x00007fe55354fbf6 (/lib/x86_64-linux-gnu/libc.so.6+0x2fbf6)
#6 0x00007fe55354fca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x000000000170df60 llvm::ConstantFoldGetElementPtr(llvm::Type*,
llvm::Constant*, bool, llvm::Optional<unsigned int>,
llvm::ArrayRef<llvm::Value*>)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x170df60)
#8 0x0000000001726580 llvm::ConstantExpr::getGetElementPtr(llvm::Type*,
llvm::Constant*, llvm::ArrayRef<llvm::Value*>, bool, llvm::Optional<unsigned
int>, llvm::Type*) (/local/mnt/workspace/tools/clean/install/bin/opt+0x1726580)
#9 0x000000000129287a llvm::SimplifyGEPInst(llvm::Type*,
llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x129287a)
#10 0x00000000012956c8 llvm::SimplifyInstruction(llvm::Instruction*,
llvm::SimplifyQuery const&, llvm::OptimizationRemarkEmitter*)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x12956c8)
#11 0x0000000001dd6e2e runImpl(llvm::Function&, llvm::SimplifyQuery const&,
llvm::OptimizationRemarkEmitter*)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x1dd6e2e)
#12 0x0000000001dd75cc (anonymous
namespace)::InstSimplifier::runOnFunction(llvm::Function&)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x1dd75cc)
#13 0x00000000017d44ef llvm::FPPassManager::runOnFunction(llvm::Function&)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x17d44ef)
#14 0x00000000017d4743 llvm::FPPassManager::runOnModule(llvm::Module&)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x17d4743)
#15 0x00000000017d4c45 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/local/mnt/workspace/tools/clean/install/bin/opt+0x17d4c45)
#16 0x0000000000704678 main
(/local/mnt/workspace/tools/clean/install/bin/opt+0x704678)
#17 0x00007fe553541f45 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21f45)
#18 0x00000000006f60ed _start
/local/mnt/workspace/sysroots/.build/x86_64-dcg-linux-gnu/build/src/glibc/csu/../sysdeps/x86_64/elf/start.S:116:0
Stack dump:
0.      Program arguments: /local/mnt/workspace/tools/clean/install/bin/opt
-instsimplify -S 
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'Remove redundant instructions' on function '@foo'
Aborted (core dumped)


It is reduced from a real application.</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>