[llvm-bugs] [Bug 34880] New: [ConstantFold] llvm crashes when folding a GEP with vector index

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 8 14:40:06 PDT 2017


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

            Bug ID: 34880
           Summary: [ConstantFold] llvm crashes when folding a GEP with
                    vector index
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Core LLVM classes
          Assignee: unassignedbugs at nondot.org
          Reporter: haicheng at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171008/bb223fe0/attachment.html>


More information about the llvm-bugs mailing list