Skip to content

[GVN] missed load elimination when multiple stores contribute to a single value #61814

Open
@Colton1skees

Description

@Colton1skees

Both GVN and NewGVN fail to perform load elimination in cases where multiple stores contribute to a single constant value.

; Function Attrs: nofree norecurse nosync nounwind
define i16 @SampleFunc() local_unnamed_addr #0 {
entry:
  %0 = load ptr, ptr @memory, align 8
  %foo = getelementptr inbounds i8, ptr %0, i64 0
  %foo1 = getelementptr inbounds i8, ptr %0, i64 1
  store i8 7, ptr %foo, align 1
  store i8 -53, ptr %foo1, align 1
  %load158490 = load i16, ptr %foo, align 1
  ret i16 %load158490
}

Compiler explorer link

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm:GVNGVN and NewGVN stages (Global value numbering)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions