[PATCH] D40390: [InstCombine] Don't crash on out of bounds index in the insertelement
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 09:48:45 PST 2017
spatel added a comment.
I may be confused by the incremental diffs in these reviews, but we can minimize the insertelement test to just one line and still crash trunk:
> $ cat inselt.ll
>
> define <4 x double> @inselt_bad_index(<4 x double> %a) {
> %I = insertelement <4 x double> %a, double 0.0, i64 4294967296
> ret <4 x double> %I
> }
>
> $ ./opt -instcombine inselt.ll -S
> Assertion failed: (idx < size()), function operator[], file /Users/spatel/myllvm/llvm/include/llvm/ADT/SmallVector.h, line 149.
> 0 opt 0x0000000112a576bc llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
> 1 opt 0x0000000112a57cb9 PrintStackTraceSignalHandler(void*) + 25
> 2 opt 0x0000000112a53749 llvm::sys::RunSignalHandlers() + 425
> 3 opt 0x0000000112a58072 SignalHandler(int) + 354
> 4 libsystem_platform.dylib 0x00007fff5d2eaf5a _sigtramp + 26
> 5 libsystem_platform.dylib 000000000000000000 _sigtramp + 2731626688
> 6 libsystem_c.dylib 0x00007fff5d11630a abort + 127
> 7 libsystem_c.dylib 0x00007fff5d0de360 basename_r + 0
> 8 opt 0x00000001122abdeb foldInsSequenceIntoBroadcast(llvm::InsertElementInst&) + 603
> 9 opt 0x00000001122a94e0 llvm::InstCombiner::visitInsertElementInst(llvm::InsertElementInst&) + 1664
> 10 opt 0x00000001121e82a8 llvm::InstVisitor<llvm::InstCombiner, llvm::Instruction*>::visitInsertElement(llvm::InsertElementInst&) + 40
> 11 opt 0x00000001121d9872 llvm::InstVisitor<llvm::InstCombiner, llvm::Instruction*>::visit(llvm::Instruction&) + 1762
> 12 opt 0x00000001121d8b19 llvm::InstCombiner::run() + 2569
> 13 opt 0x00000001121da07f combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, bool, llvm::LoopInfo*) + 1007
> 14 opt 0x00000001121da306 llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) + 342
> 15 opt 0x0000000111e7bf8f llvm::FPPassManager::runOnFunction(llvm::Function&) + 399
> 16 opt 0x0000000111e7c495 llvm::FPPassManager::runOnModule(llvm::Module&) + 117
> 17 opt 0x0000000111e7d264 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) + 2196
> 18 opt 0x0000000111e7c756 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 342
> 19 opt 0x0000000111e7dfb1 llvm::legacy::PassManager::run(llvm::Module&) + 33
> 20 opt 0x000000010f8f58fc main + 27756
> 21 libdyld.dylib 0x00007fff5d06a145 start + 1
> Stack dump:
> 0. Program arguments: ./opt -instcombine inselt.ll -S
>
> 1. Running pass 'Function Pass Manager' on module 'inselt.ll'.
> 2. Running pass 'Combine redundant instructions' on function '@inselt_bad_index' Abort trap: 6
https://reviews.llvm.org/D40390
More information about the llvm-commits
mailing list