[PATCH] D143515: [AsmPrinter] Add hook to override constant folding for printing.
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 09:59:07 PST 2023
arsenm added a comment.
Missing tests
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3454-3460
+ if (Size > 8) {
+ // Not always used in order to preserve backwards compatibility while
+ // allowing for large pointers.
+ AP.OutStreamer->emitZeros(Size);
+ return;
+ }
AP.OutStreamer->emitIntValue(0, Size);
----------------
Don't understand why you can't unconditionally call emitZeros. Compatibility is not a concern with the codegen APIs
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h:105
+ /// values do not fit in MCExpr.
+ Constant *constantFoldForPrint(const Constant *CV) override;
+
----------------
I don't understand this hook. Why is printing special? I'd rather extend with an MCBigConstantExpr or similar implementation rather than hack around this
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp:178
+ auto DstAddr = CE->getType()->getPointerAddressSpace();
+ if (Op->isNullValue() && AT.getNullPointerValue(SrcAddr) == 0 &&
+ AT.getPointerSizeInBits(DstAddr) > 64)
----------------
Don't hardcode to generic, check the null pointer representation
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143515/new/
https://reviews.llvm.org/D143515
More information about the llvm-commits
mailing list