[PATCH] D58224: [DebugInfo] Adjust fragment offset for big endian targets when splitting alloca in SROA

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 15 08:25:16 PST 2019

aprantl added inline comments.

Comment at: lib/Transforms/Scalar/SROA.cpp:4279
+          Offset += std::max(AllocaSize, P.size() * SizeOfByte) - Size;
+        Fragments.push_back(Fragment(NewAI, Offset, Size));
Ka-Ka wrote:
> aprantl wrote:
> > Since there are many places in the compiler where we create fragments, would it be an option to adapt the semantics of DW_OP_LLVM_fragment in a way that allows us to defer the special handling of big endian targets to AsmPrinter/DwarfExpression.cpp ?
> > Or, if that doesn't work create an API for creating new fragments that force users to think about what to do on big-endian targets?
> If I interpret you correctly you suggest to extend DW_OP_LLVM_fragment to hold additional information about the hole (the undescribed bits between this and the next fragment) that might follow the fragment. That would be a larger change, but it might be worth it.
I think I may need a refresher about what the problem here is. The code here is making the gap between fragments larger, but it's not immediately obvious why. Is that because we are counting the bits from offset 0 to the other end of the value in big endian? I think I may need some ASCII art to illustrate the problem :-)




More information about the llvm-commits mailing list