[llvm] c95a9f4 - [Loads] Handle addrspacecast constant expressions when determining dereferenceability
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 16 11:20:47 PST 2021
Author: Arthur Eubanks
Date: 2021-11-16T11:17:57-08:00
New Revision: c95a9f46c9cff8377232466e9bb6f097893fc860
URL: https://github.com/llvm/llvm-project/commit/c95a9f46c9cff8377232466e9bb6f097893fc860
DIFF: https://github.com/llvm/llvm-project/commit/c95a9f46c9cff8377232466e9bb6f097893fc860.diff
LOG: [Loads] Handle addrspacecast constant expressions when determining dereferenceability
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D114015
Added:
Modified:
llvm/lib/Analysis/Loads.cpp
llvm/test/Transforms/SROA/addrspacecast.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 1882e31a246a..0fbf1db0685d 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -147,7 +147,7 @@ static bool isDereferenceableAndAlignedPointer(
Alignment, Size, DL, CtxI, DT,
TLI, Visited, MaxDepth);
- if (const AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(V))
+ if (const AddrSpaceCastOperator *ASC = dyn_cast<AddrSpaceCastOperator>(V))
return isDereferenceableAndAlignedPointer(ASC->getOperand(0), Alignment,
Size, DL, CtxI, DT, TLI,
Visited, MaxDepth);
diff --git a/llvm/test/Transforms/SROA/addrspacecast.ll b/llvm/test/Transforms/SROA/addrspacecast.ll
index d35f0e1d28d3..60015bc1af5a 100644
--- a/llvm/test/Transforms/SROA/addrspacecast.ll
+++ b/llvm/test/Transforms/SROA/addrspacecast.ll
@@ -303,10 +303,8 @@ define void @select_addrspacecast_gv(i1 %a, i1 %b) {
define void @select_addrspacecast_gv_constexpr(i1 %a, i1 %b) {
; CHECK-LABEL: @select_addrspacecast_gv_constexpr(
-; CHECK-NEXT: [[C:%.*]] = alloca i64, align 8
-; CHECK-NEXT: [[C_0_ASC_SROA_CAST:%.*]] = addrspacecast i64* [[C]] to i64 addrspace(2)*
-; CHECK-NEXT: [[COND_IN:%.*]] = select i1 undef, i64 addrspace(2)* [[C_0_ASC_SROA_CAST]], i64 addrspace(2)* addrspacecast (i64 addrspace(1)* @gv to i64 addrspace(2)*)
-; CHECK-NEXT: [[COND:%.*]] = load i64, i64 addrspace(2)* [[COND_IN]], align 8
+; CHECK-NEXT: [[COND_SROA_SPECULATE_LOAD_FALSE:%.*]] = load i64, i64 addrspace(2)* addrspacecast (i64 addrspace(1)* @gv to i64 addrspace(2)*), align 8
+; CHECK-NEXT: [[COND_SROA_SPECULATED:%.*]] = select i1 undef, i64 undef, i64 [[COND_SROA_SPECULATE_LOAD_FALSE]]
; CHECK-NEXT: ret void
;
%c = alloca i64, align 8
More information about the llvm-commits
mailing list