Skip to content

Commit

Permalink
[CIR][Lowering] Erase op through rewriter instead of directly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
smeenai committed Sep 18, 2024
1 parent 9e196ee commit a089102
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ class CIRPtrStrideOpLowering
index.getLoc(), index.getType(),
mlir::IntegerAttr::get(index.getType(), 0)),
index);
sub->erase();
rewriter.eraseOp(sub);
}
}

Expand Down

0 comments on commit a089102

Please sign in to comment.