fix a crash on code that uses the result value of __builtin___memcpy_chk.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129892 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 51d9eeb..e553eb6 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -556,7 +556,7 @@
Value *Src = EmitScalarExpr(E->getArg(1));
Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
Builder.CreateMemCpy(Dest, Src, SizeVal, 1, false);
- return RValue::get(0);
+ return RValue::get(Dest);
}
case Builtin::BI__builtin_objc_memmove_collectable: {
@@ -581,7 +581,7 @@
Value *Src = EmitScalarExpr(E->getArg(1));
Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
Builder.CreateMemMove(Dest, Src, SizeVal, 1, false);
- return RValue::get(0);
+ return RValue::get(Dest);
}
case Builtin::BImemmove:
@@ -616,7 +616,7 @@
Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
Builder.CreateMemSet(Address, ByteVal, SizeVal, 1, false);
- return RValue::get(0);
+ return RValue::get(Address);
}
case Builtin::BI__builtin_dwarf_cfa: {
// The offset in bytes from the first argument to the CFA.