EricWF marked an inline comment as done. EricWF added inline comments.
================ Comment at: lib/CodeGen/CGExprAgg.cpp:971 + auto EmitCmpRes = [&](const VarDecl *VD) { + return CGF.CGM.GetAddrOfGlobalVar(VD); + }; ---------------- rsmith wrote: > Perhaps directly emit the constant value here rather than the address of the > global? I think we should consider what IR we want to see coming out of > Clang, and I don't think that IR should contain loads from globals to get the > small constant integer that is the value of the conversion result. > > I think it would be reasonable for us to say that we require the standard > library types to contain exactly one non-static data member of integral type, > and for us to form a select between the relevant integer values here. We > really have no need to support all possible implementations of these types, > and we can revisit this if some other standard library implementation ships > types that don't follow that pattern. (If we find such a standard library, we > could emit multiple selects, or a first-class aggregate select, or whatever > generates the best code at -O0.) I agree emitting the value would be better, and that most STL implementations should implement the types using only one non-static member. However, note that the specification for `partial_ordering` is described in terms of two non-static data members, so it seems possible an STL implementation might implement in that way. Would it be appropriate to do this as a smaller follow up patch? https://reviews.llvm.org/D45476 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits