[ValueTracking] Loads with !dereferenceable metadata cannot be undef/poison
authorNikita Popov <npopov@redhat.com>
Tue, 24 May 2022 13:20:01 +0000 (15:20 +0200)
committerNikita Popov <npopov@redhat.com>
Wed, 25 May 2022 07:54:04 +0000 (09:54 +0200)
commit8a6698b5238228876e7e5eb20ed82167ab1b04db
tree0b59fe87857247a63541a79626d494d78fe9411c
parent643df8fa8ef58d883cbb554c7e71910dc8a8673c
[ValueTracking] Loads with !dereferenceable metadata cannot be undef/poison

A load with !dereferenceable or !dereferenceable_or_null metadata
must return a well-defined (non-undef/poison) value. Effectively
they imply !noundef. This is the same as we do for the
dereferenceable(N) attribute.

This should fix https://github.com/llvm/llvm-project/issues/55672,
or at least the specific case discussed there.

Differential Revision: https://reviews.llvm.org/D126296
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/freeze.ll