[PATCH] D119047: [OpaquePtr][LAA] Don't use getPointerElementType()

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 17:15:26 PST 2022


aeubanks created this revision.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The instructions per Idx are stored in InstMap, which are the stores and
loads we care about.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119047

Files:
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  llvm/test/Analysis/LoopAccessAnalysis/opaque-ptr.ll


Index: llvm/test/Analysis/LoopAccessAnalysis/opaque-ptr.ll
===================================================================
--- /dev/null
+++ llvm/test/Analysis/LoopAccessAnalysis/opaque-ptr.ll
@@ -0,0 +1,15 @@
+; RUN: opt -passes=print-access-info --opaque-pointers --disable-output %s 2>&1 | FileCheck %s
+
+; CHECK: Loop access info in function 'f'
+
+define void @f(ptr %p) {
+  br label %loop
+
+loop:
+  store ptr null, ptr %p
+  %l = load i8, ptr %p
+  br i1 true, label %exit, label %loop
+
+exit:
+  ret void
+}
Index: llvm/lib/Analysis/LoopAccessAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1518,8 +1518,8 @@
   Value *BPtr = B.getPointer();
   bool AIsWrite = A.getInt();
   bool BIsWrite = B.getInt();
-  Type *ATy = APtr->getType()->getPointerElementType();
-  Type *BTy = BPtr->getType()->getPointerElementType();
+  Type *ATy = getLoadStoreType(InstMap[AIdx]);
+  Type *BTy = getLoadStoreType(InstMap[BIdx]);
 
   // Two reads are independent.
   if (!AIsWrite && !BIsWrite)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119047.406129.patch
Type: text/x-patch
Size: 1123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220205/50edb863/attachment.bin>


More information about the llvm-commits mailing list