[PATCH] llvm.noalias - isSafeToLoadUnconditionally can look through them

hfinkel at anl.gov hfinkel at anl.gov
Thu Apr 30 08:47:24 PDT 2015


Hi chandlerc, reames,

This is part of the series started by D9375, and teaches isSafeToLoadUnconditionally to look through them.

I don't have a test case for this, but as a general utility, it makes sense.

http://reviews.llvm.org/D9388

Files:
  lib/Analysis/Loads.cpp

Index: lib/Analysis/Loads.cpp
===================================================================
--- lib/Analysis/Loads.cpp
+++ lib/Analysis/Loads.cpp
@@ -116,7 +116,7 @@
 
   // We can at least always strip pointer casts even though we can't use the
   // base here.
-  V = V->stripPointerCasts();
+  V = V->stripPointerCasts(/*LookThroughNoAlias*/true);
 
   while (BBI != E) {
     --BBI;
@@ -140,7 +140,7 @@
       return true;
 
     auto *AccessedTy = cast<PointerType>(AccessedPtr->getType());
-    if (AreEquivalentAddressValues(AccessedPtr->stripPointerCasts(), V) &&
+    if (AreEquivalentAddressValues(AccessedPtr->stripPointerCasts(true), V) &&
         LoadSize <= DL.getTypeStoreSize(AccessedTy->getElementType()))
       return true;
   }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9388.24722.patch
Type: text/x-patch
Size: 755 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150430/e56d48f9/attachment.bin>


More information about the llvm-commits mailing list