Author: Sam McCall Date: 2023-06-22T21:08:57+02:00 New Revision: 51717c93e74936a7d22f262b8c5f63efae3f8d11
URL: https://github.com/llvm/llvm-project/commit/51717c93e74936a7d22f262b8c5f63efae3f8d11 DIFF: https://github.com/llvm/llvm-project/commit/51717c93e74936a7d22f262b8c5f63efae3f8d11.diff LOG: [dataflow] Avoid copying environment This appears to be just an accidental copy rather than move from a scratch variable. As well as doing redundant work, these copies introduce extra SAT variables which make debugging harder (each Enviroment has a unique FC token). Example flow condition before: ``` (B0:1 = V15) (B1:1 = V8) (B2:1 = V10) (B3:1 = (V4 & (!V7 => V6))) (V10 = (B3:1 & !V7)) (V12 = B1:1) (V13 = B2:1) (V15 = (V12 | V13)) (V3 = V2) (V4 = V3) (V8 = (B3:1 & !!V7)) B0:1 V2 ``` after: ``` (B0:1 = (V9 | V10)) (B1:1 = (B3:1 & !!V6)) (B2:1 = (B3:1 & !V6)) (B3:1 = (V3 & (!V6 => V5))) (V10 = B2:1) (V3 = V2) (V9 = B1:1) B0:1 V2 ``` (with labelling from D153488) There are also some more copies that can be avoided here (when multiple blocks without terminating statements are joined), but they're less trivial, so I'll put those in another patch. Differential Revision: https://reviews.llvm.org/D153491 Added: Modified: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp Removed: ################################################################################ diff --git a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp index 37dd7081ae986..38853c4d75429 100644 --- a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -269,7 +269,7 @@ computeBlockInputState(const CFGBlock &Block, AnalysisContext &AC) { // initialize the state of each basic block diff erently. MaybeState.emplace(Analysis.typeErasedInitialElement(), AC.InitEnv); } - return *MaybeState; + return std::move(*MaybeState); } /// Built-in transfer function for `CFGStmt`. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits