[llvm] [AMDGPU] MCExpr printing helper with KnownBits support (PR #95951)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 04:29:31 PDT 2024


================
@@ -395,12 +395,10 @@ void AMDGPUAsmPrinter::emitCommonFunctionComments(
 SmallString<128> AMDGPUAsmPrinter::getMCExprStr(const MCExpr *Value) {
   SmallString<128> Str;
   raw_svector_ostream OSS(Str);
-  int64_t IVal;
-  if (Value->evaluateAsAbsolute(IVal)) {
-    OSS << static_cast<uint64_t>(IVal);
-  } else {
-    Value->print(OSS, MAI);
-  }
+  auto &Streamer = getTargetStreamer()->getStreamer();
+  auto &Context = Streamer.getContext();
+  const MCExpr *New = llvm::TryFold(Value, Context);
----------------
Pierre-vh wrote:

does this really need `llvm::` ?

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


More information about the llvm-commits mailing list