[clang] [clang][dataflow] Discard unneeded `ExprToLoc` and `ExprToVal` entries. (PR #72850)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 20 13:30:04 PST 2023


================
@@ -311,7 +318,10 @@ computeBlockInputState(const CFGBlock &Block, AnalysisContext &AC) {
     }
   }
 
-  JoinedStateBuilder Builder(AC);
+  // When performing the join, only retain state for those expressions that are
+  // consumed by this block. This avoids performing joins and potentially
+  // extending the flow condition for expressions that we won't need anyway.
+  JoinedStateBuilder Builder(AC, AC.CFCtx.getExprConsumedByBlock(&Block));
----------------
Xazax-hun wrote:

What about expressions that are consumed by a successor of this block?  Is it OK to drop those?
Also, depending on the answer to these questions, this almost sounds like "live expressions analysis".
In case this is related, we might want to use terminology from that as opposed to "consumed". 

https://github.com/llvm/llvm-project/pull/72850


More information about the cfe-commits mailing list