[cfe-commits] r127768 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenCXX/references.cpp

Eli Friedman eli.friedman at gmail.com
Wed Mar 16 15:34:09 PDT 2011


Author: efriedma
Date: Wed Mar 16 17:34:09 2011
New Revision: 127768

URL: http://llvm.org/viewvc/llvm-project?rev=127768&view=rev
Log:
PR9494: Get rid of bitcast which was both unnecessary and written incorrectly.


Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/test/CodeGenCXX/references.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=127768&r1=127767&r2=127768&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Mar 16 17:34:09 2011
@@ -328,9 +328,8 @@
 
         }
       }
-      
-      const llvm::Type *ResultPtrTy = CGF.ConvertType(ResultTy)->getPointerTo();
-      return CGF.Builder.CreateBitCast(Object, ResultPtrTy, "temp");
+
+      return Object;
     }
   }
 

Modified: cfe/trunk/test/CodeGenCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/references.cpp?rev=127768&r1=127767&r2=127768&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/references.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/references.cpp Wed Mar 16 17:34:09 2011
@@ -258,3 +258,14 @@
 }
 }
 
+// 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);
+}
+}





More information about the cfe-commits mailing list