Shreyansh Chouhan via llvm-dev
2019-Aug-22 04:04 UTC
[llvm-dev] Should `AnalyzeLoadAvailability` return true after the lifetime of the load has ended?
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>
Philip Reames via llvm-dev
2019-Aug-22 18:47 UTC
[llvm-dev] Should `AnalyzeLoadAvailability` return true after the lifetime of the load has ended?
Sounds like it from your description. On 8/21/19 9:04 PM, Shreyansh Chouhan via llvm-dev wrote:> 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. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190822/4192dd27/attachment.html>