Use WeakVH to keep track of calls with operand bundles in CloneCodeInfo
[oota-llvm.git] / lib / Transforms / Utils / InlineFunction.cpp
index 52bde6797dbea0cd3e16baff3ae66b1f94df5a2c..9a0aabc38a5912c4e073ec3133d751bf4d7ad9c4 100644 (file)
@@ -1162,7 +1162,9 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
       SmallVector<OperandBundleDef, 2> OpDefs;
 
       for (auto &VH : InlinedFunctionInfo.OperandBundleCallSites) {
-        Instruction *I = VH;
+        if (!VH) continue;  // instruction was DCE'd after being cloned
+
+        Instruction *I = cast<Instruction>(VH);
 
         OpDefs.clear();