[PATCH] D88851: InstCombine: Fix infinite loop in copy-constant-to-alloca transform
Guy Blank via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 17 09:15:29 PDT 2021
guyblank added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:268
} else {
- return;
+ LLVM_DEBUG(dbgs() << "Cannot handle pointer user: " << *U << '\n');
+ return false;
----------------
arsenm wrote:
> guyblank wrote:
> > Hi,
> > Encountered an issue with this in an out-of-tree target. Is this missing handling of lifetime start/end?
> >
> Yes. Do you have a testcase?
adding lifetime start/end to the AMDGPU tests reproduces this.
```
declare void @llvm.lifetime.start.p5i8(i64, i8 addrspace(5)* )
declare void @llvm.lifetime.end.p5i8(i64, i8 addrspace(5)* )
; Simple memcpy to alloca from constant address space argument.
define i8 @memcpy_constant_arg_ptr_to_alloca([32 x i8] addrspace(4)* noalias readonly align 4 dereferenceable(32) %arg, i32 %idx) {
%alloca = alloca [32 x i8], align 4, addrspace(5)
%alloca.cast = bitcast [32 x i8] addrspace(5)* %alloca to i8 addrspace(5)*
call void @llvm.lifetime.start.p5i8(i64 32, i8 addrspace(5)* %alloca.cast)
%arg.cast = bitcast [32 x i8] addrspace(4)* %arg to i8 addrspace(4)*
call void @llvm.memcpy.p5i8.p4i8.i64(i8 addrspace(5)* %alloca.cast, i8 addrspace(4)* %arg.cast, i64 32, i1 false)
call void @llvm.lifetime.end.p5i8(i64 32, i8 addrspace(5)* %alloca.cast)
%gep = getelementptr inbounds [32 x i8], [32 x i8] addrspace(5)* %alloca, i32 0, i32 %idx
%load = load i8, i8 addrspace(5)* %gep
ret i8 %load
}
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88851/new/
https://reviews.llvm.org/D88851
More information about the llvm-commits
mailing list