[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
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 71daf79..6caa027 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -2321,7 +2321,11 @@
}
for (const Use &U : AssociatedFunction->uses()) {
- Instruction *I = cast<Instruction>(U.getUser());
+ Instruction *I = dyn_cast<Instruction>(U.getUser());
+ // TODO: Deal with abstract call sites here.
+ if (!I)
+ return false;
+
Function *Caller = I->getFunction();
const auto &LivenessAA =