[all-commits] [llvm/llvm-project] 79cbad: [SandboxVec] Clear Context's state within runOnFun...

vporpo via All-commits all-commits at lists.llvm.org
Tue Jan 28 18:28:30 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 79cbad188afd5268235b00267d37ce39544dbd3c
      https://github.com/llvm/llvm-project/commit/79cbad188afd5268235b00267d37ce39544dbd3c
  Author: vporpo <vporpodas at google.com>
  Date:   2025-01-28 (Tue, 28 Jan 2025)

  Changed paths:
    M llvm/include/llvm/SandboxIR/Context.h
    M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.h
    M llvm/lib/SandboxIR/Context.cpp
    M llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.cpp
    M llvm/unittests/Transforms/Vectorize/SandboxVectorizer/CMakeLists.txt
    A llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerTest.cpp

  Log Message:
  -----------
  [SandboxVec] Clear Context's state within runOnFunction() (#124842)

`sandboxir::Context` is defined at a pass-level scope with the
`SandboxVectorizerPass` class because the function pass manager `FPM`
object depends on it, and that is in pass-level scope to avoid
recreating the pass pipeline every single time `runOnFunction()` is
called.

This means that the Context's state lives on across function passes. The
problem is twofold:
(i) the LLVM IR to Sandbox IR map can grow very large including objects
from different functions, which is of no use to the vectorizer, as it's
a function-level pass.
(ii) this can result in stale data in the LLVM IR to Sandbox IR object
map, as other passes may delete LLVM IR objects.

To fix both issues this patch introduces a `Context::clear()` function
that clears the `LLVMValueToValueMap`.



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