[llvm] [SandboxVec] Add a simple pack reuse pass (PR #141848)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 17:10:31 PDT 2025


vporpo wrote:

The issue was that the region pass manager was not returning true even though the IR was changed by the region pass. This was caught by `LLVM_ENABLE_EXPENSIVE_CHECKS`.

This is the fix:
```
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.cpp
@@ -20,10 +20,11 @@ RegionsFromMetadata::RegionsFromMetadata(StringRef Pipeline)
 bool RegionsFromMetadata::runOnFunction(Function &F, const Analyses &A) {
   SmallVector<std::unique_ptr<sandboxir::Region>> Regions =
       sandboxir::Region::createRegionsFromMD(F, A.getTTI());
+  bool Change = false;
   for (auto &R : Regions) {
-    RPM.runOnRegion(*R, A);
+    Change |= RPM.runOnRegion(*R, A);
   }
-  return false;
+  return Change;
 }

 } // namespace llvm::sandboxir
```

https://github.com/llvm/llvm-project/pull/141848


More information about the llvm-commits mailing list