This is an archive of the discontinued LLVM Phabricator instance.

[SafepointIRVerifier] Avoid false positives in GC verifier for compare between pointers
ClosedPublic

Authored by anna on Jul 6 2017, 7:34 AM.

Details

Summary

Today the safepoint IR verifier catches some unrelocated uses of base pointers
that are actually valid.
With this change, we narrow down the set of false positives. Specifically, the
verifier knows about compares to null and compares between 2 unrelocated
pointers.

Event Timeline

anna created this revision.Jul 6 2017, 7:34 AM
skatkov added inline comments.Jul 6 2017, 10:43 AM
lib/IR/SafepointIRVerifier.cpp
230

Don't you want to re-write this utility function without recursion?
In this case you will not need Visited parameter. Also I would suggest this function returns enum BaseType.

390

if both parts are true it means both are relocated pointers, why do we return false? Did I miss anything?

anna added inline comments.Jul 6 2017, 11:11 AM
lib/IR/SafepointIRVerifier.cpp
230

Yeah, that might be better. I'll check it in as NFC, along with the BaseType enum return. We'll still need the visited parameter to avoid traversing through the operands again in the worklist.

390

The reason is because we are interested only in valid *unrelocated* uses. This happens only when both operands are unrelocated: these operands are either null, constant pointers or non-constant pointers (please see the comment above: lines 383).
Returning false when either are relocated simplifies the checks in this lambda -- because we know that from this point on it's unrelocated uses that we are interested in.
Also, the case where bother are relocated is automatically handled in the checks following the call to this lambda.

anna marked an inline comment as done.Jul 6 2017, 5:43 PM

Need to rebase code over the NFC refactoring.

lib/IR/SafepointIRVerifier.cpp
230

Checked in NFC refactoring change: https://reviews.llvm.org/rL307340

anna updated this revision to Diff 105573.Jul 6 2017, 7:00 PM

rebased over the NFC refactoring.

skatkov accepted this revision.Jul 6 2017, 9:43 PM
skatkov added inline comments.
lib/IR/SafepointIRVerifier.cpp
390

Got it. It is not a bool algebra :) !hasValidUnrelocatedUse does not mean has invalid :) it means has not or has invalid.

This revision is now accepted and ready to land.Jul 6 2017, 9:43 PM
This revision was automatically updated to reflect the committed changes.