[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 14:04:33 PST 2017


sanjoy created this revision.
Herald added a subscriber: mcrosier.

Previously we used to return a bogus result, 0, for IR like `ashr %val,
-1`.

I've also added an assert checking that `ComputeNumSignBits` at least
returns 1.  That assert found an already checked in test case where we
were returning a bad result for `ashr %val, -1`.

Fixes PR32045.


https://reviews.llvm.org/D30311

Files:
  lib/Analysis/ValueTracking.cpp
  test/Transforms/IndVarSimplify/pr32045.ll
  unittests/Analysis/ValueTrackingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30311.89562.patch
Type: text/x-patch
Size: 3505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170223/31073608/attachment.bin>


More information about the llvm-commits mailing list