Skip to content

[AMDGPU] GPU Load and Store vectorizer creates faulty code with opaque pointers #54896

@jdoerfert

Description

@jdoerfert

The issue arises only if the geps use opaque pointers, here is a working version and a broken one, both run with: --load-store-vectorizer -mtriple=amdgcn-amd-amdhsa
(https://godbolt.org/z/74oqP3Ks5)

  %S = type { i64, i64 }
  @S = external global %S
  
  define i64 @order() {
    %idx1 = getelementptr inbounds %S, %S* @S, i32 0, i32 1
    %l1 = load i64, i64* %idx1, align 8
    %idx0 = getelementptr inbounds %S, %S* @S, i32 0, i32 0                                                                                                                                    
    %l0 = load i64, i64* %idx0, align 8
    %add = add i64 %l0, %l1
    ret i64 %add
  }
  %S = type { i64, i64 }
  @S = external global %S
  
  define i64 @order() {
    %idx1 = getelementptr inbounds %S, ptr @S, i32 0, i32 1
    %l1 = load i64, i64* %idx1, align 8
    %idx0 = getelementptr inbounds %S, ptr @S, i32 0, i32 0                                                                                                                                    
    %l0 = load i64, i64* %idx0, align 8
    %add = add i64 %l0, %l1
    ret i64 %add
  }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions