[llvm] 7a6a52a - [SandboxIR] Remove incorrect assertion. (#115553)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 14:14:33 PST 2024


Author: Jorge Gorbe Moya
Date: 2024-11-08T14:14:28-08:00
New Revision: 7a6a52a2f0c6af63f210562d4a0345232d30d54d

URL: https://github.com/llvm/llvm-project/commit/7a6a52a2f0c6af63f210562d4a0345232d30d54d
DIFF: https://github.com/llvm/llvm-project/commit/7a6a52a2f0c6af63f210562d4a0345232d30d54d.diff

LOG: [SandboxIR] Remove incorrect assertion. (#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.

Added: 
    

Modified: 
    llvm/lib/SandboxIR/Instruction.cpp

Removed: 
    


################################################################################
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