Skip to content

Commit 98a02fe

Browse files
smeenailanza
authored andcommitted
[CIR][Lowering] Erase op through rewriter instead of directly (llvm#853)
Directly erasing the op causes a use after free later on, presumably because the lowering framework isn't aware of the op being deleted. This fixes `clang/test/CIR/CodeGen/pointer-arith-ext.c` with ASAN.
1 parent c8d4b0f commit 98a02fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ class CIRPtrStrideOpLowering
612612
index.getLoc(), index.getType(),
613613
mlir::IntegerAttr::get(index.getType(), 0)),
614614
index);
615-
sub->erase();
615+
rewriter.eraseOp(sub);
616616
}
617617
}
618618

0 commit comments

Comments
 (0)