[PATCH] D10571: Allow InstCombiner to eliminate truncates even if it will require inserting additional instructions

Igor Laevsky via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 06:28:41 PDT 2015


igor-laevsky added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:488
@@ +487,3 @@
+  // instructions required.
+  const int CostThreshold = 1;
+  return CanTruncate && Cost < CostThreshold;
----------------
reames wrote:
> You might consider passing the CostThreshold in to CanEvaluateTruncated and return early if the running cost estimate ever gets too high above CostThreshold.  We want to allow analysis of cases close to the threshold, but not burn a lot of compile time.  Having said that, I'm just being pedantic.  I don't think this is an actual issue.  
Thanks for taking a look.

I think it would be easier to just bailout on the number of visited instruction. It would give direct control on the maximum number of iterations which directly affects compile time. 

Anyway I am not changing iteration count for this method. I guess if no one ever got a problem with it, I should not address it either. At least not in this change.


Repository:
  rL LLVM

http://reviews.llvm.org/D10571





More information about the llvm-commits mailing list