[PATCH] Add a speculative execution pass

Jingyue Wu jingyue at google.com
Wed May 6 10:15:19 PDT 2015


================
Comment at: lib/Transforms/Scalar/SpeculativeExecution.cpp:69
@@ +68,3 @@
+  static char ID;
+  SpeculativeExecution(): FunctionPass(ID) {}
+
----------------
broune wrote:
> jingyue wrote:
> > Add a constructor that takes `spec-exec-max-speculation-cost` and `spec-exec-max-not-hoisted` as parameters. This allows embedded uses of LLVM (e.g., users can programmatically create these passes with their desired thresholds). 
> This doesn't seem to be common for the other passes that I looked at in Scalar/ that have flags and it seems like it would be hard to maintain when options are added or removed, so I'd prefer to postpone adding that until someone uses it. I could add it now if you'll be using it right away?
Fine with me. I've seen CFGSimplifyPass, JumpThreading and LoopUnrolling have pass parameters. 

================
Comment at: lib/Transforms/Scalar/SpeculativeExecution.cpp:159
@@ +158,3 @@
+    case Instruction::ZExt:
+    case Instruction::SExt:
+      return 1; // These are all cheap.
----------------
broune wrote:
> meheff wrote:
> > Instruction::And?  Can you use TTI instruction costs here?
> Since the speculated instructions can be sunk back or optimized later, the optimal score isn't necessarily the time it would take to execute the instructions, it's more propensity to cause good things and not cause bad things when speculated. Though TTI could still be a better approximation to that than what I've got here, so I'll try it both ways and get back to you.
If TTI's cost model works for you, I'd prefer using that. No need to invent another cost model if an existing one already works.

http://reviews.llvm.org/D9360

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






More information about the llvm-commits mailing list