[all-commits] [llvm/llvm-project] 3b4ba7: [analyzer] Fix performance of getTaintedSymbolsImp...

NagyDonat via All-commits all-commits at lists.llvm.org
Wed Apr 24 20:26:01 PDT 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b4ba7277bd735ebea489d94c4ae771427283e6e
      https://github.com/llvm/llvm-project/commit/3b4ba7277bd735ebea489d94c4ae771427283e6e
  Author: NagyDonat <donat.nagy at ericsson.com>
  Date:   2024-04-24 (Wed, 24 Apr 2024)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/Taint.cpp

  Log Message:
  -----------
  [analyzer] Fix performance of getTaintedSymbolsImpl() (#89606)

Previously the function
```
std::vector<SymbolRef> taint::getTaintedSymbolsImpl(ProgramStateRef State,
                                                    const MemRegion *Reg,
                                                    TaintTagType K,
                                                    bool returnFirstOnly)
```
(one of the 4 overloaded variants under this name) was handling element
regions in a highly inefficient manner: it performed the "also examine
the super-region" step twice. (Once in the branch for element regions,
and once in the more general branch for all `SubRegion`s -- note that
`ElementRegion` is a subclass of `SubRegion`.)

As pointer arithmetic produces `ElementRegion`s, it's not too difficult
to get a chain of N nested element regions where this inefficient
recursion would produce 2^N calls.

This commit is essentially NFC, apart from the performance improvements
and the removal of (probably irrelevant) duplicate entries from the
return value of `getTaintedSymbols()` calls.

Fixes #89045

(cherry picked from commit ce763bff081f8e97c7c3610ed0f15f14d60e875f)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list