-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
| Bugzilla Link | 34880 |
| Resolution | FIXED |
| Resolved on | Dec 05, 2017 14:41 |
| Version | trunk |
| OS | Linux |
| Blocks | #33840 |
| Reporter | LLVM Bugzilla Contributor |
| CC | @majnemer,@tstellar |
| Fixed by commit(s) | r316824 r318096 |
Extended Description
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(Val) && "cast() 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, llvm::ArrayRefllvm::Value*) (/local/mnt/workspace/tools/clean/install/bin/opt+0x170df60)
#8 0x0000000001726580 llvm::ConstantExpr::getGetElementPtr(llvm::Type*, llvm::Constant*, llvm::ArrayRefllvm::Value*, bool, llvm::Optional, llvm::Type*) (/local/mnt/workspace/tools/clean/install/bin/opt+0x1726580)
#9 0x000000000129287a llvm::SimplifyGEPInst(llvm::Type*, llvm::ArrayRefllvm::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
- Running pass 'Function Pass Manager' on module ''.
- Running pass 'Remove redundant instructions' on function '@foo'
Aborted (core dumped)
It is reduced from a real application.