[PATCH] Add a speculative execution pass

hfinkel at anl.gov hfinkel at anl.gov
Thu May 14 11:41:58 PDT 2015


================
Comment at: include/llvm/Transforms/Scalar.h:426
@@ -425,1 +425,3 @@
 //
+// SpeculativeExecution - Speculatively execute instructions.
+//
----------------
Please reword like this:

  // SpeculativeExecution - Aggressively hoist instructions to enable speculatively execution on targets where branches are expensive.

(the import part here is that the verb is 'hoist', not 'execute').

================
Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:236
@@ +235,3 @@
+  if (RunSpeculation)
+    MPM.add(createSpeculativeExecutionPass());
+
----------------
How exactly do you intend this to work? There are two or three options:

 1. Don't put it in the standard pipeline (assuming that GPU-compilers have their own pipelines anyway and will use it in those custom pipelines only).

 2. Add some TTI hook to control whether or not the pass does anything.

 3. Add a variable to the pass manager controlling this (so that the frontend must decide).

I prefer (2), but just leaving it here, as a something intended to be dead (except for use of some command-line flag) is not a reasonable plan. The command-line flags are for debugging and testing, not for production pass-manager control.


================
Comment at: lib/Transforms/Scalar/SpeculativeExecution.cpp:10
@@ +9,3 @@
+//
+// This pass does speculative execution aimed at GPU targets where branches
+// are expensive. It currently works on simple if-then and if-then-else
----------------
Same problem here: the pass does not execute anything, it hoists instructions to cause speculative execution. Please reword.

http://reviews.llvm.org/D9360

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






More information about the llvm-commits mailing list