r363088 - Remove redundant check for whether a DeclRefExpr that names a capture

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 10:50:37 PDT 2019


Author: rsmith
Date: Tue Jun 11 10:50:37 2019
New Revision: 363088

URL: http://llvm.org/viewvc/llvm-project?rev=363088&view=rev
Log:
Remove redundant check for whether a DeclRefExpr that names a capture
constitutes an odr-use.

We now track this accurately on the DeclRefExpr.

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=363088&r1=363087&r2=363088&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Jun 11 10:50:37 2019
@@ -2463,16 +2463,7 @@ LValue CodeGenFunction::EmitDeclRefLValu
     // A DeclRefExpr for a reference initialized by a constant expression can
     // appear without being odr-used. Directly emit the constant initializer.
     VD->getAnyInitializer(VD);
-    const auto *BD = dyn_cast_or_null<BlockDecl>(CurCodeDecl);
-    if (E->isNonOdrUse() == NOUR_Constant && VD->getType()->isReferenceType() &&
-        // Do not emit if it is private OpenMP variable.
-        // FIXME: This should be handled in odr-use marking, not here.
-        !(E->refersToEnclosingVariableOrCapture() &&
-          ((CapturedStmtInfo &&
-            (LocalDeclMap.count(VD->getCanonicalDecl()) ||
-             CapturedStmtInfo->lookup(VD->getCanonicalDecl()))) ||
-           LambdaCaptureFields.lookup(VD->getCanonicalDecl()) ||
-           (BD && BD->capturesVariable(VD))))) {
+    if (E->isNonOdrUse() == NOUR_Constant && VD->getType()->isReferenceType()) {
       llvm::Constant *Val =
         ConstantEmitter(*this).emitAbstract(E->getLocation(),
                                             *VD->evaluateValue(),




More information about the cfe-commits mailing list