[clang] [Clang][NFC] Remove incorrect SYCL tests (PR #109182)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 18 14:42:34 PDT 2024
elizabethandrews wrote:
> > > Instead of removing the test case altogether, does it not suffice to remove the SYCL reference / SYCL specific flag, which I interpret as the problem being addressed? SYCL per se is not a target, but rather a language? Apologies if I'm missing something.
> >
> >
> > I tried that but there was no address spaces then. I wasn't sure if the tests were relevant anymore in that case. I'll paste a snippet of what I saw below -
> > ```
> > ; Function Attrs: mustprogress noinline optnone
> > define spir_func noundef nonnull align 8 dereferenceable(8) ptr @_Z1fP1A(ptr noundef %a) #0 personality ptr @__gxx_personality_v0 {
> > entry:
> > %a.addr = alloca ptr, align 8
> > %exn.slot = alloca ptr, align 8
> > %ehselector.slot = alloca i32, align 4
> > store ptr %a, ptr %a.addr, align 8
> > %0 = load ptr, ptr %a.addr, align 8
> > %1 = call spir_func ptr @__dynamic_cast(ptr %0, ptr addrspace(1) @_ZTI1A, ptr addrspace(1) @_ZTI1B, i64 0) #3
> > %2 = icmp eq ptr %1, null
> > br i1 %2, label %dynamic_cast.bad_cast, label %dynamic_cast.end
> >
> > dynamic_cast.bad_cast: ; preds = %entry
> > invoke spir_func void @__cxa_bad_cast() #4
> > to label %invoke.cont unwind label %lpad
> >
> > invoke.cont: ; preds = %dynamic_cast.bad_cast
> > unreachable
> >
> > dynamic_cast.end: ; preds = %entry
> > br label %try.cont
> >
> > lpad: ; preds = %dynamic_cast.bad_cast
> > %3 = landingpad { ptr, i32 }
> > catch ptr null
> > %4 = extractvalue { ptr, i32 } %3, 0
> > store ptr %4, ptr %exn.slot, align 8
> > %5 = extractvalue { ptr, i32 } %3, 1
> > store i32 %5, ptr %ehselector.slot, align 4
> > br label %catch
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > vs what the test was checking
> > ```
> > // WITH-NONZERO-DEFAULT-AS-LABEL: define spir_func noundef align 8 dereferenceable(8) ptr addrspace(4) @_Z1fP1A(
> > // WITH-NONZERO-DEFAULT-AS-SAME: ptr addrspace(4) noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] personality ptr @__gxx_personality_v0 {
> > // WITH-NONZERO-DEFAULT-AS-NEXT: entry:
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[RETVAL:%.*]] = alloca ptr addrspace(4), align 8
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[A_ADDR:%.*]] = alloca ptr addrspace(4), align 8
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[EXN_SLOT:%.*]] = alloca ptr addrspace(4), align 8
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[EHSELECTOR_SLOT:%.*]] = alloca i32, align 4
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[RETVAL_ASCAST:%.*]] = addrspacecast ptr [[RETVAL]] to ptr addrspace(4)
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[A_ADDR_ASCAST:%.*]] = addrspacecast ptr [[A_ADDR]] to ptr addrspace(4)
> > // WITH-NONZERO-DEFAULT-AS-NEXT: store ptr addrspace(4) [[A]], ptr addrspace(4) [[A_ADDR_ASCAST]], align 8
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[TMP0:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[A_ADDR_ASCAST]], align 8
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[TMP1:%.*]] = call spir_func ptr addrspace(4) @__dynamic_cast(ptr addrspace(4) [[TMP0]], ptr addrspace(1) @_ZTI1A, ptr addrspace(1) @_ZTI1B, i64 0) #[[ATTR3:[0-9]+]]
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[TMP2:%.*]] = icmp eq ptr addrspace(4) [[TMP1]], null
> > // WITH-NONZERO-DEFAULT-AS-NEXT: br i1 [[TMP2]], label [[DYNAMIC_CAST_BAD_CAST:%.*]], label [[DYNAMIC_CAST_END:%.*]]
> > // WITH-NONZERO-DEFAULT-AS: dynamic_cast.bad_cast:
> > // WITH-NONZERO-DEFAULT-AS-NEXT: invoke spir_func void @__cxa_bad_cast() #[[ATTR4:[0-9]+]]
> > // WITH-NONZERO-DEFAULT-AS-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
> > // WITH-NONZERO-DEFAULT-AS: invoke.cont:
> > // WITH-NONZERO-DEFAULT-AS-NEXT: unreachable
> > // WITH-NONZERO-DEFAULT-AS: dynamic_cast.end:
> > // WITH-NONZERO-DEFAULT-AS-NEXT: br label [[TRY_CONT:%.*]]
> > // WITH-NONZERO-DEFAULT-AS: lpad:
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[TMP3:%.*]] = landingpad { ptr addrspace(4), i32 }
> > // WITH-NONZERO-DEFAULT-AS-NEXT: catch ptr addrspace(4) null
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[TMP4:%.*]] = extractvalue { ptr addrspace(4), i32 } [[TMP3]], 0
> > // WITH-NONZERO-DEFAULT-AS-NEXT: store ptr addrspace(4) [[TMP4]], ptr [[EXN_SLOT]], align 8
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[TMP5:%.*]] = extractvalue { ptr addrspace(4), i32 } [[TMP3]], 1
> > // WITH-NONZERO-DEFAULT-AS-NEXT: store i32 [[TMP5]], ptr [[EHSELECTOR_SLOT]], align 4
> > // WITH-NONZERO-DEFAULT-AS-NEXT: br label [[CATCH:%.*]]
> > // WITH-NONZERO-DEFAULT-AS: catch:
> > // WITH-NONZERO-DEFAULT-AS-NEXT: [[EXN:%.*]] = load ptr addrspace(4), ptr [[EXN_SLOT]], align
> > ```
>
> Ah, I remember now why the SYCL flag / mode was abused here (the default AS Map for SPIR-V is problematic in this case); I believe that using the `spirv64-amd-amdhsa` triple instead of `spirv64-unknown-unknown` will work, and allow for the removal of the SYCL references.
I'll try that. Thanks!
https://github.com/llvm/llvm-project/pull/109182
More information about the cfe-commits
mailing list