summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-12-19 22:40:28 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-12-19 22:40:28 +0000
commit1d8492ee7dc43304d92ffc91209f68d5b536d415 (patch)
tree1c4636d76a4882ba33af74b00110fc3996cd6bbf /lib/Transforms/Utils/InlineFunction.cpp
parent269b8a6713b2bf8feac57f3b34456153b483f3c8 (diff)
Nonnull elements in OperandBundleCallSites are not all Instructions
`CloneAndPruneIntoFromInst` sometimes RAUW's dead instructions with `undef` before erasing them (to avoid deleting instructions that still have uses). This changes the `WeakVH` in `OperandBundleCallSites` to hold an `undef`, and we need to guard for this situation in eventuality in `llvm::InlineFunction`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256110 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index db2cacd4739..14574119b9a 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -1196,9 +1196,8 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
SmallVector<OperandBundleDef, 2> OpDefs;
for (auto &VH : InlinedFunctionInfo.OperandBundleCallSites) {
- if (!VH) continue; // instruction was DCE'd after being cloned
-
- Instruction *I = cast<Instruction>(VH);
+ Instruction *I = dyn_cast_or_null<Instruction>(VH);
+ if (!I) continue; // instruction was DCE'd or RAUW'ed to undef
OpDefs.clear();