mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-02 23:26:31 +00:00
[NVPTX] fix a crash bug in NVPTXFavorNonGenericAddrSpaces
Summary: We used to assume V->RAUW only modifies the operand list of V's user. However, if V and V's user are Constants, RAUW may replace and invalidate V's user entirely. This patch fixes the above issue by letting the caller replace the operand instead of calling RAUW on Constants. Test Plan: @nested_const_expr and @rauw in access-non-generic.ll Reviewers: broune, jholewinski Reviewed By: broune, jholewinski Subscribers: jholewinski, llvm-commits Differential Revision: http://reviews.llvm.org/D10345 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239435 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -101,6 +101,28 @@ define i32 @ld_int_from_global_float(float addrspace(1)* %input, i32 %i, i32 %j)
|
||||
ret i32 %5
|
||||
}
|
||||
|
||||
define void @nested_const_expr() {
|
||||
; PTX-LABEL: nested_const_expr(
|
||||
; store 1 to bitcast(gep(addrspacecast(array), 0, 1))
|
||||
store i32 1, i32* bitcast (float* getelementptr ([10 x float], [10 x float]* addrspacecast ([10 x float] addrspace(3)* @array to [10 x float]*), i64 0, i64 1) to i32*), align 4
|
||||
; PTX: mov.u32 %r1, 1;
|
||||
; PTX-NEXT: st.shared.u32 [array+4], %r1;
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rauw(float addrspace(1)* %input) {
|
||||
%generic_input = addrspacecast float addrspace(1)* %input to float*
|
||||
%addr = getelementptr float, float* %generic_input, i64 10
|
||||
%v = load float, float* %addr
|
||||
store float %v, float* %addr
|
||||
ret void
|
||||
; IR-LABEL: @rauw(
|
||||
; IR-NEXT: %1 = getelementptr float, float addrspace(1)* %input, i64 10
|
||||
; IR-NEXT: %v = load float, float addrspace(1)* %1
|
||||
; IR-NEXT: store float %v, float addrspace(1)* %1
|
||||
; IR-NEXT: ret void
|
||||
}
|
||||
|
||||
declare void @llvm.cuda.syncthreads() #3
|
||||
|
||||
attributes #3 = { noduplicate nounwind }
|
||||
|
Reference in New Issue
Block a user