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.