From 5e01f80bf85b9a68352d4c146caa9ddcf6af6dcf Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Thu, 11 Oct 2012 02:05:23 +0000 Subject: 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 --- lib/Transforms/InstCombine/InstCombineCalls.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/Transforms/InstCombine') diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index f92c4ba..04b7b21 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(M->getOperand(0)) && cast(M->getOperand(0))->isNullValue() && + M->getOperand(1) && isa(M->getOperand(1)) && cast(M->getOperand(1))->getValue() == Size && + M->getOperand(2) && isa(M->getOperand(2))) CopyMD = cast(M->getOperand(2)); } -- cgit v1.1