[llvm] MCExpr-ify SIProgramInfo (PR #88257)

Janek van Oirschot via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 14:32:23 PDT 2024


================
@@ -462,6 +464,16 @@ MetadataStreamerMsgPackV4::getHSAKernelProps(const MachineFunction &MF,
   const SIMachineFunctionInfo &MFI = *MF.getInfo<SIMachineFunctionInfo>();
   const Function &F = MF.getFunction();
 
+  auto GetMCExprValue = [&MF](const MCExpr *Value) {
+    int64_t Val;
+    if (!Value->evaluateAsAbsolute(Val)) {
+      MCContext &Ctx = MF.getContext();
+      Ctx.reportError(SMLoc(), "Could not resolve MCExpr when required.");
----------------
JanekvO wrote:

I tried to figure out an appropriate test case to trigger these errors but these are currently not possible through regression tests as construction of the MCExpr are derived from AMDGPUResourceUsageAnalysis values which are known and will therefore always resolve. The only way I was able to figure out a test case was through unittests where I forcefully add a unresolvable MCExpr and put it through the HSAMetadataStreamer but I am not convinced of this approach as a test. Furthermore, even with unittests I was not able to figure out an approach to force the error in AMDGPUAsmPrinter's case. Do let me know what you think.

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


More information about the llvm-commits mailing list