diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-12-19 22:40:28 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-12-19 22:40:28 +0000 |
commit | ab0626e35f2bf7cde2d51ffd9bf20810404d7f0f (patch) | |
tree | 7471c21925b545cd136f0fd1344e552f77103afb /llvm/lib/Transforms/Utils | |
parent | b496834f8e4349bce6cbff390b0f72ac9b41164c (diff) | |
download | bcm5719-llvm-ab0626e35f2bf7cde2d51ffd9bf20810404d7f0f.tar.gz bcm5719-llvm-ab0626e35f2bf7cde2d51ffd9bf20810404d7f0f.zip |
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`.
llvm-svn: 256110
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index db2cacd4739..14574119b9a 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/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(); |