summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineCalls.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-10-11 02:05:23 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-10-11 02:05:23 +0000
commit5e01f80bf85b9a68352d4c146caa9ddcf6af6dcf (patch)
treeebe8bc0c8e44eace3c7765aa2a4509813222f515 /lib/Transforms/InstCombine/InstCombineCalls.cpp
parente0297196edbe6539e7d3269fa19f84e04dd0a9cd (diff)
downloadllvm-5e01f80bf85b9a68352d4c146caa9ddcf6af6dcf.tar.gz
llvm-5e01f80bf85b9a68352d4c146caa9ddcf6af6dcf.tar.bz2
llvm-5e01f80bf85b9a68352d4c146caa9ddcf6af6dcf.tar.xz
Don't crash when !tbaa.struct contents is invalid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCalls.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index f92c4baeba..04b7b2146f 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -111,10 +111,13 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) {
// get the TBAA tag describing our copy.
if (MDNode *M = MI->getMetadata(LLVMContext::MD_tbaa_struct)) {
if (M->getNumOperands() == 3 &&
+ M->getOperand(0) &&
isa<ConstantInt>(M->getOperand(0)) &&
cast<ConstantInt>(M->getOperand(0))->isNullValue() &&
+ M->getOperand(1) &&
isa<ConstantInt>(M->getOperand(1)) &&
cast<ConstantInt>(M->getOperand(1))->getValue() == Size &&
+ M->getOperand(2) &&
isa<MDNode>(M->getOperand(2)))
CopyMD = cast<MDNode>(M->getOperand(2));
}