[PATCH] [ValueTracking] do not overwrite analysis results already computed

David Majnemer david.majnemer at gmail.com
Wed Jun 10 23:35:57 PDT 2015


In http://reviews.llvm.org/D10283#186475, @jingyue wrote:

> How about this patch? It is equivalent to the old patch but requires much less
>  source code modification.
>
> The old patch writes the known bits computed from arithmetics (the big switch
>  starting from around L1080) to KnownZero1/2 and KnownOne1/2 locally, and updates
>  KnownZero and KnownOne afterwards.
>
> The new patch saves KnownOne and KnownZero before the switch, and later merges
>  the saved results with the known bits computed from arithmetics.
>
> I am fine with either approach. I slightly prefer the first one because
>  KnownOne and KnownZero consistently holds everything ValueTracking knows so
>  far. But the second approach requires less source code change.


OK, so the issue is that `computeKnownBitsFromAssume` and `computeKnownBitsFromDominatingCondition` compute a result which is clobbered by the subsequent calls to `computeKnownBits` on the value operands?

It seems to me that `computeKnownBitsFromAssume` and `computeKnownBitsFromDominatingCondition` strictly refines their input.  Could we just call them on line 1530?


http://reviews.llvm.org/D10283

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list