From d98f975089e3dd8a2a0dc298d3f76b0463610d2c Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Wed, 21 Aug 2019 21:48:56 +0000 Subject: [Attributor] Fix: Gracefully handle non-instruction users Function can have users that are not instructions, e.g., bitcasts. For now, we simply give up when we see them. llvm-svn: 369588 --- llvm/lib/Transforms/IPO/Attributor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 71daf79a04d..6caa0275c7d 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -2321,7 +2321,11 @@ bool Attributor::checkForAllCallSites(const function_ref &Pred, } for (const Use &U : AssociatedFunction->uses()) { - Instruction *I = cast(U.getUser()); + Instruction *I = dyn_cast(U.getUser()); + // TODO: Deal with abstract call sites here. + if (!I) + return false; + Function *Caller = I->getFunction(); const auto &LivenessAA = -- cgit v1.2.3