[PATCH] D38536: Improve lookThroughCast function.

Artur Gainullin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 01:48:25 PDT 2017


ArturGainullin added a comment.

I have read more carefully your comment. As far as I understood in https://reviews.llvm.org/D26556 you want to change the process of decision making for function that folds cast operation into select.  
According to suggestion from Eli you should try to match the size of a select to a cmp of its condition operand as a final result.
Necessary to mention that this function doesn't make cast folding when select is min/max and it is called only when select is an operand of cast operation.

Current differential revision try to solve this case:

  p = cmp i32 x, a
  x' = trunc i32 x to i8
  select i1 p, i8 x', i8 a'

where select is not an operand of the cast and where we have min/max operation as a result.
So here we try to match min/max pattern with further canonicalization (sinking of trunc). Reverse hoisting will not be performed because foldCastIntoSelect doesn't touch min/max idioms.


https://reviews.llvm.org/D38536





More information about the llvm-commits mailing list