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

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 13:01:39 PDT 2021


rjmccall added inline comments.


================
Comment at: llvm/tools/llvm-diff/DifferenceEngine.cpp:477
+      if (CSL->getType()->getNumElements() != CSR->getType()->getNumElements())
+        return false;
+
----------------
void wrote:
> rjmccall wrote:
> > Hmm.  I don't think it's okay to just compare the number of elements: if the types might be different, they might have different layouts.
> The individual elements are checked in the loop below. I made it recursive because I couldn't count on the types to be uniqued, because of the naming differences.
Sure, I see that, but you could have different struct types with different layouts but compatible elements.  Because one is packed and the other isn't, or so on.


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