ConstantFolding: Guard use of getFunction
authorDavid Stuttard <david.stuttard@amd.com>
Wed, 23 Nov 2022 15:53:36 +0000 (15:53 +0000)
committerDavid Stuttard <david.stuttard@amd.com>
Wed, 30 Nov 2022 14:09:40 +0000 (14:09 +0000)
commit62498962e42dc53975e8fea11cb54bce44082649
tree714464b7b4aeef517e72a292364e4e3490666d1a
parent8fa2e93538595e1ff973110cb3f301b65bc9d2eb
ConstantFolding: Guard use of getFunction

Add additional guards for a use of getFunction on an Instruction
In some cases constanfFoldCanonicalize can be called with a cloned instruction
that doesn't have a parent (or associated function), causing a seg fault.

Differential Revision: https://reviews.llvm.org/D138642
llvm/lib/Analysis/ConstantFolding.cpp