[PATCH] D84949: [JumpThreading] Don't limit the type of an operand

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 04:25:55 PDT 2020


aqjune added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:685
   // Handle Cast instructions.  Only see through Cast when the source operand is
   // PHI, Cmp, or Freeze to save the compilation time.
   if (CastInst *CI = dyn_cast<CastInst>(I)) {
----------------
lebedev.ri wrote:
> aqjune wrote:
> > efriedma wrote:
> > > Oh, hmm, I misintepreted this comment, and didn't read the code carefully enough.  The "if" is actually a heuristic that suppresses potential optimizations.
> > > 
> > > Do you have any idea what the actual compile-time impact would be if we just recursed over all casts?
> > I ran a test, and actually it brought a slight speedup when compiled with -O3 (without LTO):
> > ```
> > 
> > +-----------------------------------------------+-------+-------+------------+
> > |                   unit:sec.                   | base  | cast  | speedup(%) |
> > +-----------------------------------------------+-------+-------+------------+
> > | CTMark/7zip/7zip-benchmark.test               | 90.18 | 89.83 | 0.39%      |
> > | CTMark/Bullet/bullet.test                     | 63.11 | 62.92 | 0.31%      |
> > | CTMark/ClamAV/clamscan.test                   | 27.00 | 26.98 | 0.05%      |
> > | CTMark/SPASS/SPASS.test                       | 26.27 | 26.14 | 0.52%      |
> > | CTMark/consumer-typeset/consumer-typeset.test | 19.73 | 19.74 | -0.02%     |
> > | CTMark/kimwitu++/kc.test                      | 26.60 | 26.51 | 0.37%      |
> > | CTMark/lencod/lencod.test                     | 34.64 | 34.65 | -0.03%     |
> > | CTMark/mafft/pairlocalalign.test              | 16.24 | 16.24 | 0.00%      |
> > | CTMark/sqlite3/sqlite3.test                   | 24.61 | 24.68 | -0.27%     |
> > | CTMark/tramp3d-v4/tramp3d-v4.test             | 49.35 | 49.24 | 0.22%      |
> > +-----------------------------------------------+-------+-------+------------+
> > 
> > ```
> > 
> > Would it be a right direction if I remove this condition in a separate patch?
> Compile time != run time
The table depicts compile time.

Compilation becomes slightly faster (or almost equivalent, assuming that they are errors) if the conditions are removed, interestingly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84949/new/

https://reviews.llvm.org/D84949



More information about the llvm-commits mailing list