Index: lib/CodeGen/CGBuiltin.cpp =================================================================== --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -1431,7 +1431,7 @@ EmitNonNullArgCheck(RValue::get(Dest.getPointer()), E->getArg(0)->getType(), E->getArg(0)->getExprLoc(), FD, 0); Builder.CreateMemSet(Dest, Builder.getInt8(0), SizeVal, false); - return RValue::get(Dest.getPointer()); + return RValue::get(nullptr); } case Builtin::BImemcpy: case Builtin::BI__builtin_memcpy: { Index: test/CodeGen/bzero.c =================================================================== --- test/CodeGen/bzero.c +++ test/CodeGen/bzero.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm < %s| FileCheck %s + +typedef __SIZE_TYPE__ size_t; +void bzero(void*, size_t); +void foo(void); + // CHECK: @test_bzero + // CHECK: call void @llvm.memset + // CHECK: call void @llvm.memset + // CHECK-NOT: phi +void test_bzero() { + char dst[20]; + int _sz = 20, len = 20; + return (_sz + ? ((_sz >= len) + ? bzero(dst, len) + : foo()) + : bzero(dst, len)); +}