[PATCH] D40289: [SafepointIRVerifier] Allow deriving pointers from unrelocated base

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 21:15:19 PST 2017


mkazantsev requested changes to this revision.
mkazantsev added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/IR/SafepointIRVerifier.cpp:124
+static bool isDerivedPointerDef(const Value *Val) {
+  return isa<CastInst>(Val) || isa<GetElementPtrInst>(Val);
+}
----------------
`CastInst` doesn't look like what you need, it also includes `sext`, `zext` and a lot of stuff you don't need.


================
Comment at: lib/IR/SafepointIRVerifier.cpp:128
+static const Value *getBasePointer(const Value *Val) {
+  if (!Val->getType()->isPointerTy())
+    return Val;
----------------
Why do you check it outside of `isDerivedPointerDef`? We don't want integer-to-integer casts to be treated as derived pointers. Please add it as check.


================
Comment at: lib/IR/SafepointIRVerifier.cpp:384
+    auto isBaseAvailable = [&AvailableSet] (const Value *V) {
+      // Derived pointer can be safely used only if it's base is relocated.
+      // So we need to check only is base pointer relocated or not.
----------------
it's -> its


================
Comment at: lib/IR/SafepointIRVerifier.cpp:385
+      // Derived pointer can be safely used only if it's base is relocated.
+      // So we need to check only is base pointer relocated or not.
+      return AvailableSet.count(getBasePointer(V)) != 0;
----------------
"only if base pointer is relocated or not"


https://reviews.llvm.org/D40289





More information about the llvm-commits mailing list