[llvm] [DSE] Fold malloc/store pair into calloc (PR #87048)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 29 06:33:07 PDT 2024
dtcxzyw wrote:
Should we revert the transform when the memory region allocated by calloc will be overridden by other stores?
Example:
```
define void @test(i1 %cond, i64 %x, i64 %y) {
%ptr = call ptr @malloc(i64 8)
store i64 0, ptr %ptr, align 8
br i1 %cond, label %if.then, label %if.else
if.then:
store i64 %x, ptr %ptr, align 8 ; It will be created in later passes
ret void
if.else:
store i64 %y, ptr %ptr, align 8
ret void
}
```
See also https://github.com/dtcxzyw/llvm-opt-benchmark/pull/461#discussion_r1544493084
https://github.com/llvm/llvm-project/pull/87048
More information about the llvm-commits
mailing list