[PATCH] D28200: [BypassSlowDivision] Do not bypass division of hash-like values

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 31 10:38:00 PST 2016


sanjoy added a comment.

Some minor drop-by comments inline



================
Comment at: lib/Transforms/Utils/BypassSlowDivision.cpp:93
+/// instructions.
+static bool isHashLikeValue(Value *V, unsigned width, int depth = 0) {
+  if (depth++ > 2)
----------------
LLVM style is `Width`, `Depth`.


================
Comment at: lib/Transforms/Utils/BypassSlowDivision.cpp:118
+    const PHINode *P = cast<PHINode>(I);
+    int NumVal = P->getNumIncomingValues();
+    for (int i = 0; i < NumVal; ++i)
----------------
Why not:

```
bool Found = llvm::any_of(P->incoming_values(), [&](Value *V) {
  return isHashLineValue(V, Width, Depth);
});

if (Found)
  return true;
```


https://reviews.llvm.org/D28200





More information about the llvm-commits mailing list