[PATCH] D104734: [llvm-diff] Explicitly check ConstantStructs for differences
Bill Wendling via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 22 14:02:49 PDT 2021
void added inline comments.
================
Comment at: llvm/tools/llvm-diff/DifferenceEngine.cpp:477
+ if (CSL->getType()->getNumElements() != CSR->getType()->getNumElements())
+ return false;
+
----------------
rjmccall wrote:
> 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.
Ah! I see what you mean. There's a method called `isLayoutIdentical`, but it checks each element's pointer value. The only other thing it checks is the Packed attribute. I added that.
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