diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-03-16 22:34:09 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-03-16 22:34:09 +0000 |
commit | 545aa7a0f57d2bb2fc0eef83daa499300273d983 (patch) | |
tree | 1d445e16b1bd51159122c3f35ddd4c03d2e40750 | |
parent | 5e48bcfa7f43a48a7265583bd4adb29506001933 (diff) |
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
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 5 | ||||
-rw-r--r-- | 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); +} +} |