[llvm] [SROA] Fix debug locations for variables with non-zero offsets (PR #97750)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 03:11:53 PDT 2024


https://github.com/OCHyams commented:

> Some nits inline; I greatly appreciate that this upgrades the existing implementation from "here's a bucket of bits we swill around" into something that's reasoned and explained with comments and names. The sheer number of dimensions here is mind boggling.

Thanks! I'm glad I managed to finally get around to sorting this out.

> Do we need tests for the composition of fragments and bit extracts? There's code here dealing with bit-extract stuff, but no extra testing for it, are there other tests out there which cover these code paths? (Didn't look at the reviews adding bit-extract stuff as I was in outer woop woop sorry).

Good point. To maintain NFC-ness the current implementation doesn't add fragments to expressions that contain bit-extracts. I've added some test coverage of offsets+bit-extracts.

And as stated in createOrReplaceFragment we don't support composition if a fragment exists already in the expression - those dbg records are just thrown away (again, to maintain NFCness - that isn't a fundamental restriction). That's tested in llvm/test/DebugInfo/Generic/sroa-extract-bits.ll (not added in this patch).

https://github.com/llvm/llvm-project/pull/97750


More information about the llvm-commits mailing list