This patch fixes https://bugs.llvm.org/show_bug.cgi?id=44388 which incorrectly assigns an ABI alignment to memset when there was no explicit alignment given.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 45804 Build 47885: arc lint + arc unit
Event Timeline
Comment Actions
define void @test(i32* nocapture %P) nounwind ssp { entry: store i32 0, i32* %P %add.ptr = getelementptr inbounds i32, i32* %P, i64 1 %0 = bitcast i32* %add.ptr to i8* tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i1 false) ret void } declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg)
This example no longer preserves the alignment (align 4 from ABI alignment on the store) after your patch. Possibly you need to capture that when populating Range.Alignment.
Comment Actions
LG
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | ||
---|---|---|
178 | I'd suggest moving the findStoreAlignment() helper below higher up in the file and use that, as it implements the same logic. |
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | ||
---|---|---|
149 |
I believe this can now be written as