vrp: Handle pointers in maybe_set_nonzero_bits [PR108253]
authorJakub Jelinek <jakub@redhat.com>
Wed, 4 Jan 2023 11:16:22 +0000 (12:16 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 4 Jan 2023 11:16:22 +0000 (12:16 +0100)
commitebc449119442501c927ede0e83697eaece72223e
tree229d0671534b2446b2ae1b945a01e99d580c95fd
parent345dffd0d4ebff7e705dfff1a8a72017a167120a
vrp: Handle pointers in maybe_set_nonzero_bits [PR108253]

maybe_set_nonzero_bits calls set_nonzero_bits which asserts that
var doesn't have pointer type.  While we could punt for those
cases, I think we can handle at least some easy cases.
Earlier in maybe_set_nonzero_bits we've checked this is on
(var & cst) == 0
edge and the other edge is __builtin_unreachable, so if cst
is say 3 as in the testcase, we want to turn it into 4 byte alignment
of the pointer.

2023-01-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/108253
* tree-vrp.cc (maybe_set_nonzero_bits): Handle var with pointer
types.

* g++.dg/opt/pr108253.C: New test.
gcc/testsuite/g++.dg/opt/pr108253.C [new file with mode: 0644]
gcc/tree-vrp.cc