]> granicus.if.org Git - llvm/commitdiff
Revert [SROA] Enhance SROA to handle `addrspacecast`ed allocas
authorJordan Rupprecht <rupprecht@google.com>
Tue, 18 Jun 2019 18:40:04 +0000 (18:40 +0000)
committerJordan Rupprecht <rupprecht@google.com>
Tue, 18 Jun 2019 18:40:04 +0000 (18:40 +0000)
This reverts r363711 (git commit 76a149ef8187310a60fd20481fdb2a10c8ba968e)

This causes stage2 build failures, e.g.:
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363718 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/addrspacecast.ll

index 627199a27e6c3a2cd07fe8a0d5cbccf52ecae1c0..6454f1ea1eb19217e37d560cb7ba529f250224cb 100644 (file)
@@ -1589,12 +1589,6 @@ static Value *getAdjustedPtr(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr,
   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)) {
index d2a1cef81aef5213a3f5157de3982a4b319dfcaa..5edef89e8cd624ba06173f4cdfb45110f9efff0c 100644 (file)
@@ -299,21 +299,6 @@ define void @select_addrspacecast_gv(i1 %a, i1 %b) {
   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"}