[llvm] [SandboxIR] Remove incorrect assertion. (PR #115553)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 14:08:40 PST 2024
https://github.com/slackito created https://github.com/llvm/llvm-project/pull/115553
`insertBefore` can be called on a detached instruction, and we can't check that the underlying instructions are ordered because instructions without BB parents have no order.
This problem showed up as a different assertion failure in `llvm::Instruction::comesBefore` in one of the unit tests when `EXPENSIVE_CHECKS` are enabled.
>From a704eb75b4660e4e51dd0e4f3a48b3736be498a4 Mon Sep 17 00:00:00 2001
From: Jorge Gorbe Moya <jgorbe at google.com>
Date: Fri, 8 Nov 2024 13:52:47 -0800
Subject: [PATCH] [SandboxIR] Remove incorrect assertion.
insertBefore can be called on a detached instruction, and we can't check
that the underlying instructions are ordered because instructions
without BB parents have no order.
This problem showed up as a different assertion failure in
llvm::Instruction::comesBefore in one of the unit tests when
EXPENSIVE_CHECKS are enabled.
---
llvm/lib/SandboxIR/Instruction.cpp | 4 ----
1 file changed, 4 deletions(-)
diff --git a/llvm/lib/SandboxIR/Instruction.cpp b/llvm/lib/SandboxIR/Instruction.cpp
index 096b827541eeaf..df941b2fa81efe 100644
--- a/llvm/lib/SandboxIR/Instruction.cpp
+++ b/llvm/lib/SandboxIR/Instruction.cpp
@@ -124,10 +124,6 @@ void Instruction::moveBefore(BasicBlock &BB, const BBIterator &WhereIt) {
void Instruction::insertBefore(Instruction *BeforeI) {
llvm::Instruction *BeforeTopI = BeforeI->getTopmostLLVMInstruction();
- // TODO: Move this to the verifier of sandboxir::Instruction.
- assert(is_sorted(getLLVMInstrs(),
- [](auto *I1, auto *I2) { return I1->comesBefore(I2); }) &&
- "Expected program order!");
Ctx.getTracker().emplaceIfTracking<InsertIntoBB>(this);
More information about the llvm-commits
mailing list