[PATCH] D30311: [ValueTracking] Don't do an unchecked shift in ComputeNumSignBits

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 16:11:17 PST 2017


sanjoy added a comment.

In https://reviews.llvm.org/D30311#685140, @efriedma wrote:

> > why not be maximally aggressive?
>
> This is not how undef works... unlike poison, you can't assert sign bits you don't actually have.


Not sure I fully understand you, but I interpreted `ashr` 's "If op2 is (statically or dynamically) equal to or larger than the number of bits in op1, the result is undefined" rule as meaning `ashr i32 %V, 32` is `undef`.  This would mean I can pretend `ashr i32 %V, 32` is `0`, which has 32 sign bits.


https://reviews.llvm.org/D30311





More information about the llvm-commits mailing list