Only use instructions as insert locations for SCEVExpander
SCEVExpander, which we are using during code generation, only allows instructions as insert locations, but breaks in case BasicBlock->end() iterators are passed to it due to it trying to obtain the basic block in which code should be generated by calling Instruction->getParent(), which is not defined for ->end() iterators. This change adds an assert to Polly that ensures we only pass valid instructions to SCEVExpander and it fixes one case, where we used IRBuilder->SetInsertBlock() to set an ->end() insert location which was later passed to SCEVExpander. In general, Polly is always trying to build up the CFG first, before we actually insert instructions into the CFG sceleton. As a result, each basic block should already have at least one branch instruction before we start adding code. Hence, always requiring the IRBuilder insert location to be set to a real instruction should always be possible. Thanks Utpal Bora <cs14mtech11017@iith.ac.in> for his help with test case reduction. llvm-svn: 243830
Loading
Please register or sign in to comment