[all-commits] [llvm/llvm-project] 51717c: [dataflow] Avoid copying environment

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Jun 22 12:09:14 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 51717c93e74936a7d22f262b8c5f63efae3f8d11
      https://github.com/llvm/llvm-project/commit/51717c93e74936a7d22f262b8c5f63efae3f8d11
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2023-06-22 (Thu, 22 Jun 2023)

  Changed paths:
    M clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list