llvm/lib/CodeGen/SelectionDAG
Pete Cooper 185a992dcf Check for dynamic alloca's when selecting lifetime intrinsics.
TL;DR: Indexing maps with [] creates missing entries.

The long version:

When selecting lifetime intrinsics, we index the *static* alloca map with the AllocaInst we find for that lifetime.  Trouble is, we don't first check to see if this is a dynamic alloca.

On the attached example, this causes a dynamic alloca to create an entry in the static map, and returns 0 (the default) as the frame index for that lifetime.  0 was used for the frame index of the stack protector, which given that it now has a lifetime, is coloured, and merged with other stack slots.

PEI would later trigger an assert because it expects the stack protector to not be dead.

This fix ensures that we only get frame indices for static allocas, ie, those in the map.  Dynamic ones are effectively dropped, which is suboptimal, but at least isn't completely broken.

rdar://problem/18672951

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220099 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17 22:59:33 +00:00
..
CMakeLists.txt
DAGCombiner.cpp SelectionDAG: Add sext_inreg optimizations 2014-10-17 14:45:25 +00:00
FastISel.cpp
FunctionLoweringInfo.cpp
InstrEmitter.cpp
InstrEmitter.h
LegalizeDAG.cpp
LegalizeFloatTypes.cpp
LegalizeIntegerTypes.cpp
LegalizeTypes.cpp
LegalizeTypes.h
LegalizeTypesGeneric.cpp
LegalizeVectorOps.cpp
LegalizeVectorTypes.cpp
LLVMBuild.txt
Makefile
ResourcePriorityQueue.cpp
ScheduleDAGFast.cpp
ScheduleDAGRRList.cpp Remove more calls to getSubtargetImpl from the schedulers and 2014-10-09 06:28:06 +00:00
ScheduleDAGSDNodes.cpp Remove more calls to getSubtargetImpl from the schedulers and 2014-10-09 06:28:06 +00:00
ScheduleDAGSDNodes.h
ScheduleDAGVLIW.cpp Remove more calls to getSubtargetImpl from the schedulers and 2014-10-09 06:28:06 +00:00
SDNodeDbgValue.h constify the getters in SDNodeDbgValue. 2014-10-13 20:43:47 +00:00
SelectionDAG.cpp Modernize old-style static asserts. NFC. 2014-10-12 17:56:40 +00:00
SelectionDAGBuilder.cpp Check for dynamic alloca's when selecting lifetime intrinsics. 2014-10-17 22:59:33 +00:00
SelectionDAGBuilder.h [Stackmaps] Enable invoking the patchpoint intrinsic. 2014-10-17 17:39:00 +00:00
SelectionDAGDumper.cpp
SelectionDAGISel.cpp
SelectionDAGPrinter.cpp
TargetLowering.cpp
TargetSelectionDAGInfo.cpp