[llvm-dev] Should `AnalyzeLoadAvailability` return true after the lifetime of the load has ended?

Shreyansh Chouhan via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 21 21:04:05 PDT 2019

According to bug 20811, the GVN pass should replace a call to a load with
`undef` if the load has been made after the lifetime of a pointer has
ended. But, according to the documentation of `AnalyzeLoadAvailability`
function in the GVN class, the function returns true if there is a value to
load and populates the result with the value. If the load is made
immediately after the start of the lifetime of a pointer, the function
returns true and populates `Res` with `undef`.

If the load is made after the lifetime of a pointer has been over the
function considers it to have a clobbered instruction dependency and
returns false, not populating Res with anything.

So in order to fix the issue, should I make the case of lifetime end the
same as lifetime start? i.e. return true and populate Res with undef? That
does seem to fix the issue, but I don't know if it is the correct way of
handling it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190822/38216a32/attachment.html>

More information about the llvm-dev mailing list