[llvm] r363711 - [SROA] Enhance SROA to handle `addrspacecast`ed allocas
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 11:42:13 PDT 2019
Hi Michael,
I reverted this in r363718 due to some stage2 failures. Some examples can
be seen on buildbots here:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/132/steps/stage%202%20build/logs/stdio
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/87/steps/build-stage2-unified-tree/logs/stdio
On Tue, Jun 18, 2019 at 10:55 AM Michael Liao via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: hliao
> Date: Tue Jun 18 10:58:49 2019
> New Revision: 363711
>
> URL: http://llvm.org/viewvc/llvm-project?rev=363711&view=rev
> Log:
> [SROA] Enhance SROA to handle `addrspacecast`ed allocas
>
> Summary:
> - After `addrspacecast` is allowed to be eliminated in SROA, the
> adjusting of storage pointer (from `alloca) needs to handle the
> potential different address spaces between the storage pointer (from
> alloca) and the pointer being used.
>
> Reviewers: arsenm
>
> Subscribers: wdng, hiraditya, llvm-commits
>
> Tags: #llvm
>
> Differential Revision: https://reviews.llvm.org/D63501
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> llvm/trunk/test/Transforms/SROA/addrspacecast.ll
>
> Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=363711&r1=363710&r2=363711&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Tue Jun 18 10:58:49 2019
> @@ -1589,6 +1589,12 @@ static Value *getAdjustedPtr(IRBuilderTy
> PointerType *TargetPtrTy = cast<PointerType>(PointerTy);
> Type *TargetTy = TargetPtrTy->getElementType();
>
> + // As `addrspacecast` is , `Ptr` (the storage pointer) may have
> different
> + // address space from the expected `PointerTy` (the pointer to be used).
> + // Adjust the pointer type based the original storage pointer.
> + auto AS = cast<PointerType>(Ptr->getType())->getAddressSpace();
> + PointerTy = PointerTy->getPointerTo(AS);
> +
> do {
> // First fold any existing GEPs into the offset.
> while (GEPOperator *GEP = dyn_cast<GEPOperator>(Ptr)) {
>
> Modified: llvm/trunk/test/Transforms/SROA/addrspacecast.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SROA/addrspacecast.ll?rev=363711&r1=363710&r2=363711&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/Transforms/SROA/addrspacecast.ll (original)
> +++ llvm/trunk/test/Transforms/SROA/addrspacecast.ll Tue Jun 18 10:58:49
> 2019
> @@ -299,6 +299,21 @@ define void @select_addrspacecast_gv(i1
> ret void
> }
>
> +; CHECK-LABEL: @select_addrspacecast_i8(
> +; CHECK: [[SEL:%.*]] = select i1 undef, i8 undef, i8 undef
> +; CHECK-NEXT: ret i8 [[SEL]]
> +define i8 @select_addrspacecast_i8() {
> + %a = alloca i8
> + %b = alloca i8
> +
> + %a.ptr = addrspacecast i8* %a to i8 addrspace(1)*
> + %b.ptr = addrspacecast i8* %b to i8 addrspace(1)*
> +
> + %ptr = select i1 undef, i8 addrspace(1)* %a.ptr, i8 addrspace(1)* %b.ptr
> + %ret = load i8, i8 addrspace(1)* %ptr
> + ret i8 %ret
> +}
> +
> !0 = !{!1, !1, i64 0, i64 1}
> !1 = !{!2, i64 1, !"type_0"}
> !2 = !{!"root"}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190618/f12054d5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4849 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190618/f12054d5/attachment.bin>
More information about the llvm-commits
mailing list