Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not copy immarg attribute in LowerAddrSpaceCast #1351

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bmanga
Copy link
Contributor

@bmanga bmanga commented May 14, 2024

Closes #1350

Copy link
Collaborator

@rjodinchr rjodinchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered moving ReplaceLLVMIntrinsicsPass earlier in the flow (before first LowerAddrSpaceCastPass) to get rid of those memcpy?
It might not be possible if memcpy gets generated by other passes (instcombine?).

; RUN: clspv-opt %s -o %t.ll --passes=lower-addrspacecast
; RUN: FileCheck %s < %t.ll

; CHECK: declare void @_Z21llvm.memcpy.p0.p4.i32PPU3AS1memcpy.p0.p4.i32(ptr noalias nocapture writeonly, ptr addrspace(1) noalias nocapture readonly, i32, i1) #0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is clspv really able to deal with such a function to emit anything valid?
Maybe because it contains llvm.memcpy it works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the replace intrinsics pass seems prepared for this, as it looks at the function name containing "llvm.memcpy".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Addrspace cast lowering pass creates invalid IR for intrinsic calls
3 participants