llvm/unittests/IR
David Stenberg 11ef6e19fe Allow null-valued function operands in getCalledFunction()
Summary:
Change the dynamic cast in CallBase::getCalledFunction() to allow
null-valued function operands.

This patch fixes a crash that occurred when a funtion operand of a
call instruction was dropped, and later on a metadata-carrying
instruction was printed out. When allocating the metadata slot numbers,
getCalledFunction() would be invoked on the call with the dropped
operand, resulting in a failed non-null assertion in isa<>.

This fixes PR38924, in which a printout in DBCE crashed due to this.

This aligns getCalledFunction() with getCalledValue(), as the latter
allows the operand to be null.

Reviewers: vsk, dexonsmith, hfinkel

Reviewed By: dexonsmith

Subscribers: hfinkel, llvm-commits

Differential Revision: https://reviews.llvm.org/D52537

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345966 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-02 11:46:24 +00:00
..
AsmWriterTest.cpp
AttributesTest.cpp
BasicBlockTest.cpp
CFGBuilder.cpp
CFGBuilder.h
CMakeLists.txt [NewPM] teach -passes= to emit meaningful error messages 2018-10-17 10:36:23 +00:00
ConstantRangeTest.cpp
ConstantsTest.cpp
DebugInfoTest.cpp
DebugTypeODRUniquingTest.cpp
DominatorTreeBatchUpdatesTest.cpp [DomTree] Cleanup Update and LegalizeUpdate API moved to Support header. 2018-08-14 17:12:30 +00:00
DominatorTreeTest.cpp [TI removal] Make getTerminator() return a generic Instruction. 2018-10-15 10:42:50 +00:00
DomTreeUpdaterTest.cpp
FunctionTest.cpp
InstructionsTest.cpp [IR] add shuffle query for vector concatenation 2018-09-20 15:21:52 +00:00
IntrinsicsTest.cpp
IRBuilderTest.cpp [TI removal] Make getTerminator() return a generic Instruction. 2018-10-15 10:42:50 +00:00
LegacyPassManagerTest.cpp
ManglerTest.cpp
MDBuilderTest.cpp
MetadataTest.cpp Allow null-valued function operands in getCalledFunction() 2018-11-02 11:46:24 +00:00
ModuleTest.cpp
PassBuilderCallbacksTest.cpp [NewPM] teach -passes= to emit meaningful error messages 2018-10-17 10:36:23 +00:00
PassManagerTest.cpp [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
PatternMatch.cpp
TypeBuilderTest.cpp
TypesTest.cpp
UserTest.cpp
UseTest.cpp
ValueHandleTest.cpp
ValueMapTest.cpp
ValueTest.cpp
VerifierTest.cpp
WaymarkTest.cpp