[PATCH] D9401: llvm.noalias - The AA implementaton

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 9 15:14:52 PDT 2016


majnemer added a subscriber: majnemer.

================
Comment at: lib/Analysis/ScopedNoAliasAA.cpp:282
@@ +281,3 @@
+  auto NAI =
+    std::find_if(NoAliasCalls.begin(), NoAliasCalls.end(),
+                 [&](Instruction *A) {
----------------
`llvm::find_if` ?

================
Comment at: lib/Analysis/ScopedNoAliasAA.cpp:304-307
@@ +303,6 @@
+  SmallVector<const Value *, 8> Children;
+  if (const SelectInst *SI = dyn_cast<SelectInst>(P)) {
+    Children.push_back(SI->getTrueValue());
+    Children.push_back(SI->getFalseValue());
+  } else if (const PHINode *PN = dyn_cast<PHINode>(P)) {
+    for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
----------------
`const auto *`

================
Comment at: lib/Analysis/ScopedNoAliasAA.cpp:308-309
@@ +307,4 @@
+  } else if (const PHINode *PN = dyn_cast<PHINode>(P)) {
+    for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
+      Children.push_back(PN->getIncomingValue(i));
+  }
----------------
The following would be a little more compact:

for (Value *IncommingValue : PN->incoming_values())
  Children.push_back(IncommingValue);

================
Comment at: lib/Analysis/ScopedNoAliasAA.cpp:355
@@ +354,3 @@
+    // lack of aliasing for all pointer arguments.
+    for (auto AI = CSA.arg_begin(), AE = CSA.arg_end(); AI != AE; ++AI) {
+      if (!(*AI)->getType()->isPointerTy())
----------------
Perhaps:
  for (Value *Arg : CSA.args())

================
Comment at: lib/Analysis/ScopedNoAliasAA.cpp:405
@@ +404,3 @@
+  if (CSB) {
+    for (auto AI = CSB.arg_begin(), AE = CSB.arg_end(); AI != AE; ++AI)
+      GetUnderlyingObjects(*AI, BObjs, DL, nullptr, 0, &BNoAliasCalls);
----------------
Ditto.

================
Comment at: lib/Analysis/ScopedNoAliasAA.cpp:437
@@ +436,3 @@
+    for (Use &U : MV->uses())
+      if (Instruction *UI = dyn_cast<Instruction>(U))
+        if (CompatibleSetMembers.insert(UI).second) {
----------------
`auto *`

================
Comment at: lib/Analysis/ScopedNoAliasAA.cpp:463
@@ +462,3 @@
+    // intrinsic call), and we can ignore it.
+    Instruction *I = dyn_cast<Instruction>(V);
+    if (!I)
----------------
Ditto.


http://reviews.llvm.org/D9401





More information about the llvm-commits mailing list