-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[InstCombine]PtrReplacer: Correctly handle select with unavailable operands #148829
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=instcombine < %s | FileCheck %s | ||
|
|
||
| ; Crashed in IC PtrReplacer because an invalid select was generated with addrspace(4) and addrspace(5) | ||
| ; operands. | ||
|
|
||
| define amdgpu_kernel void @eggs(ptr addrspace(4) byref([12 x i8]) align 16 %arg) { | ||
|
||
| ; CHECK-LABEL: define amdgpu_kernel void @eggs( | ||
| ; CHECK-SAME: ptr addrspace(4) byref([12 x i8]) align 16 [[ARG:%.*]]) { | ||
| ; CHECK-NEXT: [[BB:.*:]] | ||
| ; CHECK-NEXT: ret void | ||
| ; | ||
| bb: | ||
| %alloca = alloca i32, i32 0, align 8, addrspace(5) | ||
| %alloca1 = alloca [12 x i8], align 16, addrspace(5) | ||
| call void @llvm.memcpy.p5.p4.i64(ptr addrspace(5) %alloca1, ptr addrspace(4) %arg, i64 0, i1 false) | ||
| %select = select i1 false, ptr addrspace(5) %alloca1, ptr addrspace(5) %alloca | ||
| call void @llvm.memcpy.p0.p5.i64(ptr null, ptr addrspace(5) %select, i64 0, i1 false) | ||
| ret void | ||
| } | ||
Pierre-vh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| define amdgpu_kernel void @milk(ptr addrspace(4) byref([12 x i8]) align 16 %arg) { | ||
|
||
| ; CHECK-LABEL: define amdgpu_kernel void @milk( | ||
| ; CHECK-SAME: ptr addrspace(4) byref([12 x i8]) align 16 [[ARG:%.*]]) { | ||
| ; CHECK-NEXT: [[BB:.*:]] | ||
| ; CHECK-NEXT: ret void | ||
| ; | ||
| bb: | ||
| %alloca = alloca i32, i32 0, align 8, addrspace(5) | ||
| %alloca1 = alloca [12 x i8], align 16, addrspace(5) | ||
| call void @llvm.memcpy.p5.p4.i64(ptr addrspace(5) %alloca1, ptr addrspace(4) %arg, i64 0, i1 false) | ||
| %select = select i1 false, ptr addrspace(5) %alloca, ptr addrspace(5) %alloca1 | ||
| call void @llvm.memcpy.p0.p5.i64(ptr null, ptr addrspace(5) %select, i64 0, i1 false) | ||
| ret void | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a NFC and is already being tested in AMDGPU/ptr-replace-alloca.ll