[PATCH] Infer known bits from dominating conditions

hfinkel at anl.gov hfinkel at anl.gov
Thu Feb 19 05:47:38 PST 2015


Thanks for working on this!

I'd really like to see a compile-time comparison with an implementation that just walks up the dominator tree. It seems like that technique would be more powerful (because it could catch conditions where the variable is not a direct argument to the icmp). It might be manageable (with a cutoff for really deep trees, and noting that we can stop searching after we reach the definition of the variable itself).

Also, full-context patches please: http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface


================
Comment at: lib/Analysis/ValueTracking.cpp:42
@@ -41,1 +41,3 @@
 
+static cl::opt<bool> EnableDomConditions("value-tracking-dom-conditions", cl::init(false));
+
----------------
Line too long?

================
Comment at: lib/Analysis/ValueTracking.cpp:498
@@ +497,3 @@
+  // Avoid massive lists
+  if (V->hasNUsesOrMore(20))
+    return;
----------------
Please make this cutoff a command-line parameter.

================
Comment at: lib/Analysis/ValueTracking.cpp:510
@@ +509,3 @@
+    if (!Cmp ||
+        !Cmp->hasOneUse()) 
+      continue;
----------------
Why do you care that the cmp has only one use? Why not look at all of the branches that use the cmp result?

================
Comment at: lib/Analysis/ValueTracking.cpp:541
@@ +540,3 @@
+      // TODO: implement unsigned bound from below (known one bits)
+      // TODO: common condition check implementations with assumes
+      // TODO: implement other patterns from assume (e.g. V & B == A)
----------------
Indeed, can't you share all of that logic that is used by the assume implementation?

Although to really do that you'd have to start with the dominating branches, walking up?

http://reviews.llvm.org/D7708

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list