Skip to content

coalescing of redundant vector stores isn't preserving alignment correctly #89672

@regehr

Description

@regehr

https://alive2.llvm.org/ce/z/-qQphe

optimizing this code:

define i32 @f(ptr %0, i1 %1) {
  store <2 x i64> zeroinitializer, ptr %0, align 8
  br i1 %1, label %4, label %3

3:                                                ; preds = %2
  store <2 x i64> zeroinitializer, ptr %0, align 16
  br label %4

4:                                                ; preds = %3, %2
  ret i32 0
}

is mostly doing what we expect, but the coalesced store should retain the smaller alignnment value of the two, not the larger:

define noundef i32 @f(ptr nocapture writeonly %0, i1 %1) local_unnamed_addr #0 {
  store <2 x i64> zeroinitializer, ptr %0, align 16
  ret i32 0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }

cc @nunoplopes @Hatsunespica

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions