Skip to content

Commit bbe7e8f

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 874656e commit bbe7e8f

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
@@ -608,7 +608,7 @@ class CIRPtrStrideOpLowering
608608
index.getLoc(), index.getType(),
609609
mlir::IntegerAttr::get(index.getType(), 0)),
610610
index);
611-
sub->erase();
611+
rewriter.eraseOp(sub);
612612
}
613613
}
614614

0 commit comments

Comments
 (0)