[PATCH] D104734: [llvm-diff] Explicitly check ConstantStructs for differences

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 23 15:57:55 PDT 2021


rjmccall added a comment.

Oh, yeah, if we recurse into initializers in equivalentAsOperands then we'll have that problem for sure.  I don't think you can just check at the top level of a struct initializer, though — you need to be able to do this check in recursive positions, like if the element initializer is a bitcast.  I would suggest doing the check specifically in the case where you've found global variables.

Also, you should record both GVL and GVR in the difference engine you construct, and then do something like `if (GVL == SavedGVL) return GVR == SavedGVR;`.  If you see a self-reference in the LHS but the RHS is like a null pointer or some other global, that's a difference, not something we should skip!  This will make it a sort of maximal fixed point.

I would suggest just setting SavedGVL and SavedGVR on the temporary difference engine instead of passing them in to all uses of equivalentOnOperands.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104734/new/

https://reviews.llvm.org/D104734



More information about the llvm-commits mailing list