[PATCH] D38536: Improve lookThroughCast function.

Artur Gainullin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 12:40:07 PDT 2017


ArturGainullin added a comment.

I have checked that patch from https://reviews.llvm.org/D26556 doesn't work for the case described in this review. 
https://reviews.llvm.org/D26556 is about folding extension instruction into select.
I.e. in case of the following pattern:

  s = select Cond, C1, C2 
  sext s

sext operation is eliminated and C1, C2 constants are widened.

Also it perfroms the following folding when we have trunc before select and zext after select:

  zext (select Cond, C, (trunc X)) --> select Cond, C', (and X, Mask)
  zext (select Cond, (trunc X), C) --> select Cond, (and X, Mask), C'

While patch from this review  is intended to cover more cases when we can match min/max pattern and as a result of canonicalization move cast operation out of min/max.
So I think that we still need this.


https://reviews.llvm.org/D38536





More information about the llvm-commits mailing list