[llvm-dev] Shift-by-signext - sext is bad for analysis - ignore it's use count?

Roman Lebedev via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 27 13:40:41 PDT 2019


In https://reviews.llvm.org/D68103 the InstCombine learned that shift-by-sext
is simply a shift-by-zext. But the transform is limited to single-use sext.
We can quite trivially get a case where there are two shifts by the same sext:
https://godbolt.org/z/j6mO3t  <- We should handle those cases.

In https://reviews.llvm.org/D68103#1686130 Sanjay Patel notes that this
sext is intrusive for analysis, that we will gain far better analysis with zext,
so we should just ignore forego of the one-use check,
and simply replace all shift-by-sext with shift-by-zext.

I implemented this proposed suggestion here:
https://reviews.llvm.org/D68150

Does anyone see any problems with that trade-off?

Roman.


More information about the llvm-dev mailing list