[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 23 07:01:46 PDT 2017
arphaman added inline comments.
Comment at: lib/CodeGen/CGExprComplex.cpp:163
+ return *Constant;
> rjmccall wrote:
> > There's an EmitIgnoredExpr you could use.
> > Also, I think it would be fine to add a generic tryEmitMemberExprAsConstant that takes a MemberExpr and does this DRE stuff behind the scenes; it's not at all different for the different emitters.
> Well, actually, now I see why it's different for the complex emitter, but I think you could probably extract out a function that forms a complex pair from a constant output without too much trouble.
> Also, as long as you're working with this, I think it's likely that the Agg emitter needs to handle this, too. I'm not sure I accept the claim there that constant r-value emission never applies to aggregates, but at the very least you need to handle references just as the DRE case does.
It looks like that constant reference code in Agg emitter is dead, so I removed it.
The static constant variables that were references to aggregates were still inconsistent between DREs and MEs, so I now try to emit MEs as DREs in CodeGenFunction's Lvalue emitter now.
More information about the cfe-commits