[PATCH] D105002: [InferAddressSpaces] NFC: For noop IntToPtr/PtrToInt pair cast to operator instead of PtrToInt
Reshabh Sharma via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 28 06:54:54 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGae983de6cce2: [InferAddressSpaces] NFC: For noop IntToPtr/PtrToInt pair cast to operator… (authored by rksharma).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105002/new/
https://reviews.llvm.org/D105002
Files:
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
llvm/test/Transforms/InferAddressSpaces/AMDGPU/noop-ptrint-pair.ll
Index: llvm/test/Transforms/InferAddressSpaces/AMDGPU/noop-ptrint-pair.ll
===================================================================
--- llvm/test/Transforms/InferAddressSpaces/AMDGPU/noop-ptrint-pair.ll
+++ llvm/test/Transforms/InferAddressSpaces/AMDGPU/noop-ptrint-pair.ll
@@ -69,6 +69,16 @@
ret i32* inttoptr (i64 ptrtoint (i32 addrspace(1)* @g to i64) to i32*)
}
+; COMMON-LABEL: @noop_ptrint_pair_ce3(
+; AMDGCN-NEXT: %i = inttoptr i64 ptrtoint (i32 addrspace(1)* @g to i64) to i32*
+; AMDGCN-NEXT: ret void
+; NOTTI-NEXT: %i = inttoptr i64 ptrtoint (i32 addrspace(1)* @g to i64) to i32*
+; NOTTI-NEXT: ret void
+define void @noop_ptrint_pair_ce3() {
+ %i = inttoptr i64 ptrtoint (i32 addrspace(1)* @g to i64) to i32*
+ ret void
+}
+
; COMMON-LABEL: @non_noop_ptrint_pair_ce(
; AMDGCN-NEXT: store i32 0, i32* inttoptr (i64 ptrtoint (i32 addrspace(3)* @l to i64) to i32*)
; AMDGCN-NEXT: ret void
Index: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
+++ llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
@@ -471,7 +471,7 @@
} else if (auto *I2P = dyn_cast<IntToPtrInst>(&I)) {
if (isNoopPtrIntCastPair(cast<Operator>(I2P), *DL, TTI))
PushPtrOperand(
- cast<PtrToIntInst>(I2P->getOperand(0))->getPointerOperand());
+ cast<Operator>(I2P->getOperand(0))->getOperand(0));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105002.354886.patch
Type: text/x-patch
Size: 1474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210628/0b66620f/attachment.bin>
More information about the llvm-commits
mailing list