[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-25 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL311772: [IRGen] Evaluate constant static variables referenced through member (authored by arphaman). Changed prior to commit: https://reviews.llvm.org/D36876?vs=112360=112675#toc Repository: rL LLVM

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-23 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Looks great, thanks. Repository: rL LLVM https://reviews.llvm.org/D36876 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-23 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 112360. arphaman marked 2 inline comments as done. arphaman added a comment. - Create `tryEmitAsConstant` for MemberExprs and `emitConstant` helper for complex values as suggested by John. - Remove dead constant emission code from CGExprAggregate.cpp - Emit

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-23 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments. Comment at: lib/CodeGen/CGExprComplex.cpp:163 +else + CGF.EmitLValue(ME->getBase()); +return *Constant; rjmccall wrote: > rjmccall wrote: > > There's an EmitIgnoredExpr you could use. > > > > Also, I

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGExprComplex.cpp:163 +else + CGF.EmitLValue(ME->getBase()); +return *Constant; rjmccall wrote: > There's an EmitIgnoredExpr you could use. > > Also, I think it would be fine to

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGExprComplex.cpp:163 +else + CGF.EmitLValue(ME->getBase()); +return *Constant; There's an EmitIgnoredExpr you could use. Also, I think it would be fine to add a generic

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-22 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 112149. arphaman added a comment. Revert most of the changes and use temporary DREs as suggested by John. Repository: rL LLVM https://reviews.llvm.org/D36876 Files: lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprScalar.cpp

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-22 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments. Comment at: lib/CodeGen/CGExpr.cpp:1323 + if (result.HasSideEffects && !AllowSideEffects) { +assert(!isa(E) && "declrefs should not have side effects"); return ConstantEmission(); rjmccall wrote: > The side effects here

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGExpr.cpp:1323 + if (result.HasSideEffects && !AllowSideEffects) { +assert(!isa(E) && "declrefs should not have side effects"); return ConstantEmission(); The side effects here are those

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 111956. arphaman marked an inline comment as done. arphaman added a comment. - Get rid of the `AllowSideEffects` argument. - Get rid of the old integer field evaluation code. Repository: rL LLVM https://reviews.llvm.org/D36876 Files:

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments. Comment at: lib/CodeGen/CGExprComplex.cpp:156 +auto Constant = tryEmitDeclRefOrMemberExprAsConstant( +ME, ME->getMemberDecl(), /*AllowSideEffects=*/true); +if (Constant) { rsmith wrote: > If we can (correctly)

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-18 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/CodeGen/CGExprComplex.cpp:156 +auto Constant = tryEmitDeclRefOrMemberExprAsConstant( +ME, ME->getMemberDecl(), /*AllowSideEffects=*/true); +if (Constant) { If we can (correctly) allow side-effects in

[PATCH] D36876: [IRGen] Evaluate constant static variables referenced through member expressions

2017-08-18 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman created this revision. C++ allows us to reference static variables through member expressions. Prior to this patch, non-integer static variables that were referenced using a member expression were always emitted using lvalue loads. The old behaviour introduced an inconsistency between