From: Hans Wennborg Date: Tue, 17 Mar 2015 16:38:58 +0000 (+0000) Subject: Revert r232454 and r232456: "Fix the LLVM type used when lowering initializer list... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e957a38433f459ed39d983b124ffa361c2a2e0c;p=clang Revert r232454 and r232456: "Fix the LLVM type used when lowering initializer list reference temporaries to global variables." This caused PR22940. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232496 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 92098752cb..35275e58e9 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -316,16 +316,13 @@ createReferenceTemporary(CodeGenFunction &CGF, GV->setAlignment( CGF.getContext().getTypeAlignInChars(M->getType()).getQuantity()); // FIXME: Should we put the new global into a COMDAT? - return llvm::ConstantExpr::getBitCast( - GV, CGF.ConvertTypeForMem(Inner->getType())->getPointerTo()); + return GV; } return CGF.CreateMemTemp(Inner->getType(), "ref.tmp"); case SD_Thread: case SD_Static: - return llvm::ConstantExpr::getBitCast( - CGF.CGM.GetAddrOfGlobalTemporary(M, Inner), - CGF.ConvertTypeForMem(Inner->getType())->getPointerTo()); + return CGF.CGM.GetAddrOfGlobalTemporary(M, Inner); case SD_Dynamic: llvm_unreachable("temporary can't have dynamic storage duration"); diff --git a/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp b/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp index 3f92d7636c..382694ec03 100644 --- a/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -482,27 +482,3 @@ namespace ConstExpr { f({C(1), C(2), C(3)}); } } - -namespace B19773010 { - template struct pair { - T1 first; - T2 second; - constexpr pair(T1 a, T2 b) : first(a), second(b) {} - }; - - enum E { ENUM_CONSTANT }; - struct testcase { - testcase(std::initializer_list>); - }; - void f1() { - // CHECK-LABEL: @_ZN9B197730102f1Ev - testcase a{{"", ENUM_CONSTANT}}; - // CHECK: store %"struct.B19773010::pair"* getelementptr inbounds ([1 x %"struct.B19773010::pair"], [1 x %"struct.B19773010::pair"]* bitcast ([1 x { i8*, i32 }]* @.ref.tmp{{.*}} to [1 x %"struct.B19773010::pair"]*), i64 0, i64 0), %"struct.B19773010::pair"** %{{.*}}, align 8 - } - void f2() { - // CHECK-LABEL: @_ZN9B197730102f2Ev - // CHECK: store %"struct.B19773010::pair"* getelementptr inbounds ([1 x %"struct.B19773010::pair"], [1 x %"struct.B19773010::pair"]* bitcast ([1 x { i8*, i32 }]* @_ZGRZN9B197730102f2EvE1p_ to [1 x %"struct.B19773010::pair"]*), i64 0, i64 0), %"struct.B19773010::pair"** getelementptr inbounds ([2 x %"class.std::initializer_list.10"], [2 x %"class.std::initializer_list.10"]* @_ZZN9B197730102f2EvE1p, i64 0, i64 1, i32 0), align 8 - static std::initializer_list> a, p[2] = - {a, {{"", ENUM_CONSTANT}}}; - } -}