10 Commits

Author SHA1 Message Date
vporpo
79cbad188a
[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`.
2025-01-28 18:28:08 -08:00
vporpo
334a1cdbfa
[SandboxIR] createFunction() should always create a function (#124665)
This patch removes the assertion that checks for an existing function.
If one exists it will remove it and create a new one. This helps remove
a crash when a function declaration object already exists and we are
about to create a SandboxIR object for the definition.
2025-01-27 20:16:30 -08:00
Tyler Lanphear
4c0a0f7241
[SandboxVectorizer][NFCI] Fix use of possibly-uninitialized scalar. (#122201)
The `EraseCallbackID` field is not always initialized in the ctor for
SeedCollector; if not, it will be used uninitialized by its dtor. This
could potentially lead to the erasure of a random callback, leading to a
bug.

Fixed by making `CallbackID` an opaque type, which is always
default-initialized to an invalid ID.
2025-01-09 22:43:30 -08:00
Kazu Hirata
c79827cd15 [SandboxIR] Fix a warning
This patch fixes:

  llvm/lib/SandboxIR/Context.cpp:684:22: error: unused variable
  'MaxRegisteredCallbacks' [-Werror,-Wunused-const-variable]
2024-10-29 12:05:18 -07:00
Jorge Gorbe Moya
4df71ab78e
[SandboxIR] Add callbacks for instruction insert/remove/move ops (#112965) 2024-10-29 09:25:51 -07:00
vporpo
ed5088a271
[SandboxIR] Switch more Instruction::create() to InsertPosition (#111213)
Also moves CmpInst definitions from Context.cpp to Instruction.cpp
2024-10-04 15:06:55 -07:00
vporpo
e22b07e766
[SandboxIR][NFC] Move Function class to a separate file (#110526) 2024-09-30 10:12:47 -07:00
vporpo
eba106d461
[SandboxIR][NFC] Move Instruction classes into a separate file (#110294) 2024-09-27 10:54:11 -07:00
vporpo
7a2c5c69ce
[SandboxIR][NFC] Move User into a separate file (#110157) 2024-09-26 14:25:59 -07:00
vporpo
165a912807
[SandboxIR][NFC] Move Context class into a separate file (#110049) 2024-09-25 17:04:20 -07:00