Skip to content

[SandboxVec] Boilerplate #107431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024
Merged

[SandboxVec] Boilerplate #107431

merged 1 commit into from
Sep 5, 2024

Conversation

vporpo
Copy link
Contributor

@vporpo vporpo commented Sep 5, 2024

This patch implements the new pass and registers it with the pass manager. For context, this is a vectorizer that operates on Sandbox IR, which is a transactional IR on top of LLVM IR.

@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2024

@llvm/pr-subscribers-llvm-transforms

Author: vporpo (vporpo)

Changes

This patch implements the new pass and registers it with the pass manager. For context, this is a vectorizer that operates on Sandbox IR, which is a transactional IR on top of LLVM IR.


Full diff: https://github.com/llvm/llvm-project/pull/107431.diff

8 Files Affected:

  • (added) llvm/include/llvm/Transforms/Vectorize/SandboxVec/SandboxVectorizer.h (+35)
  • (modified) llvm/lib/Passes/CMakeLists.txt (+1)
  • (modified) llvm/lib/Passes/PassBuilder.cpp (+1)
  • (modified) llvm/lib/Passes/PassRegistry.def (+1)
  • (modified) llvm/lib/Transforms/Vectorize/CMakeLists.txt (+3)
  • (added) llvm/lib/Transforms/Vectorize/SandboxVec/CMakeLists.txt (+16)
  • (added) llvm/lib/Transforms/Vectorize/SandboxVec/SandboxVectorizer.cpp (+63)
  • (added) llvm/test/Transforms/SandboxVec/boilerplate.ll (+11)
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVec/SandboxVectorizer.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVec/SandboxVectorizer.h
new file mode 100644
index 00000000000000..0f7e43112d2d88
--- /dev/null
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVec/SandboxVectorizer.h
@@ -0,0 +1,35 @@
+//===- SandboxVectorizer.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVEC_SANDBOXVECTORIZER_H
+#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVEC_SANDBOXVECTORIZER_H
+
+#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/ScalarEvolution.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/SandboxIR/SandboxIR.h"
+
+namespace llvm {
+
+class SandboxVectorizerPass : public PassInfoMixin<SandboxVectorizerPass> {
+  DenseSet<sandboxir::Value *> Visited;
+  ScalarEvolution *SE = nullptr;
+  const DataLayout *DL = nullptr;
+  TargetTransformInfo *TTI = nullptr;
+  AliasAnalysis *AA = nullptr;
+
+public:
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+
+  bool runImpl(Function &F);
+};
+
+} // namespace llvm
+
+#endif // LLVM_TRANSFORMS_VECTORIZE_SANDBOXVEC_SANDBOXVECTORIZER_H
diff --git a/llvm/lib/Passes/CMakeLists.txt b/llvm/lib/Passes/CMakeLists.txt
index 6425f4934b2103..a90b196b0b0292 100644
--- a/llvm/lib/Passes/CMakeLists.txt
+++ b/llvm/lib/Passes/CMakeLists.txt
@@ -26,6 +26,7 @@ add_llvm_component_library(LLVMPasses
   InstCombine
   IRPrinter
   ObjCARC
+  SandboxVec
   Scalar
   Support
   Target
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index a22abed8051a11..80916b8a9502a0 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -321,6 +321,7 @@
 #include "llvm/Transforms/Vectorize/LoopIdiomVectorize.h"
 #include "llvm/Transforms/Vectorize/LoopVectorize.h"
 #include "llvm/Transforms/Vectorize/SLPVectorizer.h"
+#include "llvm/Transforms/Vectorize/SandboxVec/SandboxVectorizer.h"
 #include "llvm/Transforms/Vectorize/VectorCombine.h"
 #include <optional>
 
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index d6067089c6b5c1..a1324e81705669 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -453,6 +453,7 @@ FUNCTION_PASS("reassociate", ReassociatePass())
 FUNCTION_PASS("redundant-dbg-inst-elim", RedundantDbgInstEliminationPass())
 FUNCTION_PASS("reg2mem", RegToMemPass())
 FUNCTION_PASS("safe-stack", SafeStackPass(TM))
+FUNCTION_PASS("sandbox-vectorizer", SandboxVectorizerPass())
 FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass())
 FUNCTION_PASS("scalarizer", ScalarizerPass())
 FUNCTION_PASS("sccp", SCCPPass())
diff --git a/llvm/lib/Transforms/Vectorize/CMakeLists.txt b/llvm/lib/Transforms/Vectorize/CMakeLists.txt
index 5c88d94d96622d..cabddd7a8a8e0d 100644
--- a/llvm/lib/Transforms/Vectorize/CMakeLists.txt
+++ b/llvm/lib/Transforms/Vectorize/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_subdirectory(SandboxVec)
+
 add_llvm_component_library(LLVMVectorize
   LoadStoreVectorizer.cpp
   LoopIdiomVectorize.cpp
@@ -27,4 +29,5 @@ add_llvm_component_library(LLVMVectorize
   Core
   Support
   TransformUtils
+  SandboxVec
   )
diff --git a/llvm/lib/Transforms/Vectorize/SandboxVec/CMakeLists.txt b/llvm/lib/Transforms/Vectorize/SandboxVec/CMakeLists.txt
new file mode 100644
index 00000000000000..ccf0c8c2d5da2d
--- /dev/null
+++ b/llvm/lib/Transforms/Vectorize/SandboxVec/CMakeLists.txt
@@ -0,0 +1,16 @@
+add_llvm_component_library(LLVMSandboxVec
+  SandboxVectorizer.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms/Vectorize/SandboxVec
+
+  DEPENDS
+  intrinsics_gen
+
+  LINK_COMPONENTS
+  Analysis
+  Core
+  SandboxIR
+  Support
+  TransformUtils
+)
diff --git a/llvm/lib/Transforms/Vectorize/SandboxVec/SandboxVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SandboxVec/SandboxVectorizer.cpp
new file mode 100644
index 00000000000000..d113f02d7fa978
--- /dev/null
+++ b/llvm/lib/Transforms/Vectorize/SandboxVec/SandboxVectorizer.cpp
@@ -0,0 +1,63 @@
+//===- SandboxVectorizer.cpp - Vectorizer based on Sandbox IR -------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Transforms/Vectorize/SandboxVec/SandboxVectorizer.h"
+#include "llvm/Support/CommandLine.h"
+
+using namespace llvm;
+
+#define SV_NAME "sandbox-vectorizer"
+#define DEBUG_TYPE "SBVec"
+
+cl::opt<bool>
+    SBVecDisable("sbvec-disable", cl::init(false), cl::Hidden,
+                 cl::desc("Disable the Sandbox Vectorization passes"));
+
+PreservedAnalyses SandboxVectorizerPass::run(Function &F,
+                                             FunctionAnalysisManager &AM) {
+  TTI = &AM.getResult<TargetIRAnalysis>(F);
+  SE = &AM.getResult<ScalarEvolutionAnalysis>(F);
+  DL = &F.getParent()->getDataLayout();
+  AA = &AM.getResult<AAManager>(F);
+
+  bool Changed = runImpl(F);
+  if (!Changed)
+    return PreservedAnalyses::all();
+
+  PreservedAnalyses PA;
+  PA.preserveSet<CFGAnalyses>();
+  return PA;
+}
+
+bool SandboxVectorizerPass::runImpl(Function &F) {
+  if (SBVecDisable)
+    return false;
+
+  // If the target claims to have no vector registers don't attempt
+  // vectorization.
+  if (!TTI->getNumberOfRegisters(TTI->getRegisterClassForType(true))) {
+    LLVM_DEBUG(dbgs() << "SBVec: Target has no vector registers, abort.\n");
+    return false;
+  }
+
+  // Don't vectorize when the attribute NoImplicitFloat is used.
+  if (F.hasFnAttribute(Attribute::NoImplicitFloat))
+    return false;
+
+  sandboxir::Context Ctx(F.getContext());
+
+  LLVM_DEBUG(dbgs() << "SBVec: Analyzing blocks in " << F.getName() << ".\n");
+
+  // Create SandboxIR for `F`.
+  sandboxir::Function &SBF = *Ctx.createFunction(&F);
+
+  // TODO: Initialize SBVec Pass Manager
+  (void)SBF;
+
+  return false;
+}
diff --git a/llvm/test/Transforms/SandboxVec/boilerplate.ll b/llvm/test/Transforms/SandboxVec/boilerplate.ll
new file mode 100644
index 00000000000000..353659d41485fc
--- /dev/null
+++ b/llvm/test/Transforms/SandboxVec/boilerplate.ll
@@ -0,0 +1,11 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes=sandbox-vectorizer %s -S | FileCheck %s
+
+; This test checks that the pass was registered with the pass manager.
+; TODO: Remove this test once actual tests land.
+define void @boilerplate() {
+; CHECK-LABEL: define void @boilerplate() {
+; CHECK-NEXT:    ret void
+;
+  ret void
+}

Copy link
Contributor

@aeubanks aeubanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't shorten "Vec" in the directory name

@@ -1,3 +1,5 @@
add_subdirectory(SandboxVec)

add_llvm_component_library(LLVMVectorize
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we list the sources here we avoid a new component

#define DEBUG_TYPE "SBVec"

cl::opt<bool>
SBVecDisable("sbvec-disable", cl::init(false), cl::Hidden,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we basically already have this with -fno-slp-vectorize, I don't think we need a separate option?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as you are not using the pass in production, opt should suffice for use it or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not being added to any pipelines, so this option isn't useful right now. and once it is added to the pipelines, it'll be controlled by PipelineTuningOptions::SLPVectorization anyway

PreservedAnalyses SandboxVectorizerPass::run(Function &F,
FunctionAnalysisManager &AM) {
TTI = &AM.getResult<TargetIRAnalysis>(F);
SE = &AM.getResult<ScalarEvolutionAnalysis>(F);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this is dead code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess I can drop these for now and add them when needed.

@tschuett
Copy link

tschuett commented Sep 5, 2024

The vectorizer is going to be spread of several files and some files will be added to the generic sandbox directory?
E.g., the pass manager could be used for other optimizers on top of sandbox.

@vporpo
Copy link
Contributor Author

vporpo commented Sep 5, 2024

The vectorizer is going to be spread of several files and some files will be added to the generic sandbox directory?

Not sure what you mean by generic sandbox directory.

There will be a number of SandboxVectorizer-specific files living in Vectorize/SandboxVectorizer. This will include several components of the vectorizer, and a list of vectorization passes which will be called by the sandbox-vectorizer speicific pass manager.

@tschuett
Copy link

tschuett commented Sep 5, 2024

Sorry for being slow. Could the pass manager be used for other optimizations on top of SandboxIR or is it tied to the vectorizer?

@vporpo
Copy link
Contributor Author

vporpo commented Sep 5, 2024

Could the pass manager be used for other optimizations on top of SandboxIR or is it tied to the vectorizer?

The pass manager will be launched by the vectorizer pass, so in that sense it is tied to the vectorizer. But I see your point. Ideally there should be a generic pass manager for Sandbox IR passes. I think we could accommodate for that if Sandbox IR ended up being used by other transformations too. In that case we could move the Pass/PassManager files to a generic directory.

@tschuett
Copy link

tschuett commented Sep 5, 2024

My dream would be a loop optimizer on top of SandboxIR. It would also have passes and a pass manager.

@tschuett
Copy link

tschuett commented Sep 5, 2024

Neither worry nor hurry.

@vporpo
Copy link
Contributor Author

vporpo commented Sep 5, 2024

My dream would be a loop optimizer on top of SandboxIR. It would also have passes and a pass manager.

Yeah, loop transformations would be a great fit. I think the pass-manager infrastructure is generic enough that we could reuse most of it.

@vporpo
Copy link
Contributor Author

vporpo commented Sep 5, 2024

I accidentally force-pushed, but I think I addressed all comments.

@vporpo
Copy link
Contributor Author

vporpo commented Sep 5, 2024

Ah I still need to rename the test directory from SandboxVec to SandboxVectorizer


// If the target claims to have no vector registers don't attempt
// vectorization.
if (!TTI->getNumberOfRegisters(TTI->getRegisterClassForType(true))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add this (and below) logic alongside tests later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

#define DEBUG_TYPE "SBVec"

cl::opt<bool>
SBVecDisable("sbvec-disable", cl::init(false), cl::Hidden,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not being added to any pipelines, so this option isn't useful right now. and once it is added to the pipelines, it'll be controlled by PipelineTuningOptions::SLPVectorization anyway

@vporpo
Copy link
Contributor Author

vporpo commented Sep 5, 2024

it's not being added to any pipelines, so this option isn't useful right now. and once it is added to the pipelines, it'll be controlled by PipelineTuningOptions::SLPVectorization anyway

Done.

using namespace llvm;

#define SV_NAME "sandbox-vectorizer"
#define DEBUG_TYPE "SBVec"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SBVectorizer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change it to #define DEBUG_TYPE SV_NAME like it's done in LoopVectorize.cpp. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM.

This patch implements the new pass and registers it with the pass manager.
For context, this is a vectorizer that operates on Sandbox IR, which is a
transactional IR on top of LLVM IR.
@vporpo vporpo merged commit 52dca6f into llvm:main Sep 5, 2024
4 of 6 checks passed
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/PassManager.h"
#include "llvm/SandboxIR/SandboxIR.h"
Copy link
Contributor

@nikic nikic Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these includes are either (currently) unused or should be forward declarations. (You should only need PassManager.h).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I removed the objects themselves and forgot to remove the header files. Let me remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed them here: 7ea9f0d

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 6, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/1079

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/43/86' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-2900-43-86.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=86 GTEST_SHARD_INDEX=43 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


@mikaelholmen
Copy link
Collaborator

Hi,
I've no idea what to be expected but I noticed that

opt -passes=sandbox-vectorizer bbi-98907.ll -o /dev/null

crashes with

opt: ../lib/SandboxIR/SandboxIR.cpp:2542: llvm::sandboxir::Value *llvm::sandboxir::Context::registerValue(std::unique_ptr<Value> &&): Assertion `Pair.second && "Already exists!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: build-all/bin/opt -passes=sandbox-vectorizer bbi-98907.ll -o /dev/null
1.	Running pass "function(sandbox-vectorizer)" on module "bbi-98907.ll"
2.	Running pass "sandbox-vectorizer" on function "get"
 #0 0x000055ee9d6fb447 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/opt+0x419b447)
 #1 0x000055ee9d6f8f2e llvm::sys::RunSignalHandlers() (build-all/bin/opt+0x4198f2e)
 #2 0x000055ee9d6fbc6f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f128e35fcf0 __restore_rt (/lib64/libpthread.so.0+0x12cf0)
 #4 0x00007f128bf18acf raise (/lib64/libc.so.6+0x4eacf)
 #5 0x00007f128beebea5 abort (/lib64/libc.so.6+0x21ea5)
 #6 0x00007f128beebd79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
 #7 0x00007f128bf11426 (/lib64/libc.so.6+0x47426)
 #8 0x000055eea0de61e7 llvm::sandboxir::Context::registerValue(std::unique_ptr<llvm::sandboxir::Value, std::default_delete<llvm::sandboxir::Value>>&&) (build-all/bin/opt+0x78861e7)
 #9 0x000055eea0de7971 llvm::sandboxir::Context::createBasicBlock(llvm::BasicBlock*) (build-all/bin/opt+0x7887971)
#10 0x000055eea0de8861 llvm::sandboxir::Context::createFunction(llvm::Function*) (build-all/bin/opt+0x7888861)
#11 0x000055ee9f394dab llvm::SandboxVectorizerPass::runImpl(llvm::Function&) (build-all/bin/opt+0x5e34dab)
#12 0x000055ee9f3949fc llvm::SandboxVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x5e349fc)
#13 0x000055ee9f249f4d llvm::detail::PassModel<llvm::Function, llvm::SandboxVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilder.cpp:0:0
#14 0x000055ee9d904d6a llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x43a4d6a)
#15 0x000055ee9ea8a2dd llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
#16 0x000055ee9d909901 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x43a9901)
#17 0x000055ee9ea837fd llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilderPipelines.cpp:0:0
#18 0x000055ee9d9039fa llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x43a39fa)
#19 0x000055ee9ea2d1fb llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (build-all/bin/opt+0x54cd1fb)
#20 0x000055ee9d6c2bbd optMain (build-all/bin/opt+0x4162bbd)
#21 0x00007f128bf04d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#22 0x000055ee9d6bc72e _start (build-all/bin/opt+0x415c72e)
Abort (core dumped)

bbi-98907.ll.gz

@mikaelholmen
Copy link
Collaborator

Hi, I've no idea what to be expected but I noticed that

opt -passes=sandbox-vectorizer bbi-98907.ll -o /dev/null

crashes with

opt: ../lib/SandboxIR/SandboxIR.cpp:2542: llvm::sandboxir::Value *llvm::sandboxir::Context::registerValue(std::unique_ptr<Value> &&): Assertion `Pair.second && "Already exists!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.

And this crash goes away with d14a600

[SandboxIR] Implement BlockAddress (#107940)

@vporpo
Copy link
Contributor Author

vporpo commented Sep 11, 2024

And this crash goes away with d14a600 [SandboxIR] Implement BlockAddress (#107940)

@mikaelholmen Just curious how did you run into that issue?

@mikaelholmen
Copy link
Collaborator

mikaelholmen commented Sep 12, 2024

And this crash goes away with d14a600 [SandboxIR] Implement BlockAddress (#107940)

@mikaelholmen Just curious how did you run into that issue?

We run some tests with randomized opt pass pipelines, and when sandbox-vectorizer was created we threw that pass into the mix as well.

@vporpo
Copy link
Contributor Author

vporpo commented Sep 12, 2024

We run some tests with randomized opt pass pipelines, and when sandbox-vectorizer was created we threw that pass into the mix as well.

Ah makes sense, thanks.

@gulfemsavrun
Copy link
Contributor

We started seeing a CMake error after this patch.

CMake Error: install(EXPORT "LLVMExports" ...) includes target "LLVMVectorize" which requires target "LLVMSandboxIR" that is not in any export set.

https://luci-milo.appspot.com/ui/p/fuchsia/builders/prod/llvm-linux-arm64/b8737544888773099041/overview

@vporpo
Copy link
Contributor Author

vporpo commented Sep 16, 2024

We started seeing a CMake error after this patch.

Isn't this a downstream issue?

@gulfemsavrun
Copy link
Contributor

We started seeing a CMake error after this patch.

Isn't this a downstream issue?

Ok, you're right, and I'll fix it on our end. Sorry for the false alarm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants