From 545aa7a0f57d2bb2fc0eef83daa499300273d983 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 16 Mar 2011 22:34:09 +0000 Subject: [PATCH] PR9494: Get rid of bitcast which was both unnecessary and written incorrectly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127768 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 5 ++--- test/CodeGenCXX/references.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index e23d6107c0..99ea773fa0 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -328,9 +328,8 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E, } } - - const llvm::Type *ResultPtrTy = CGF.ConvertType(ResultTy)->getPointerTo(); - return CGF.Builder.CreateBitCast(Object, ResultPtrTy, "temp"); + + return Object; } } diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp index d2ad980135..25bc8d8017 100644 --- a/test/CodeGenCXX/references.cpp +++ b/test/CodeGenCXX/references.cpp @@ -258,3 +258,14 @@ void f() { } } +// PR9494 +namespace N5 { +struct AnyS { bool b; }; +void f(const bool&); +AnyS g(); +void h() { + // CHECK: call i8 @_ZN2N51gEv() + // CHECK: call void @_ZN2N51fERKb(i8* + f(g().b); +} +} -- 2.40.0