[llvm] [AMDGPU][MC] Allow UC_VERSION_* constant reuse (PR #96461)

Ivan Kosarev via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 03:01:33 PDT 2024


================
@@ -2366,8 +2366,12 @@ const MCExpr *AMDGPUDisassembler::createConstantSymbolExpr(StringRef Id,
                                                            int64_t Val) {
   MCContext &Ctx = getContext();
   MCSymbol *Sym = Ctx.getOrCreateSymbol(Id);
-  assert(!Sym->isVariable());
-  Sym->setVariableValue(MCConstantExpr::create(Val, Ctx));
+  int64_t Res = ~Val;
+  assert(!Sym->isVariable() ||
+         (Sym->getVariableValue()->evaluateAsAbsolute(Res) && Res == Val));
+  (void)Res;
----------------
kosarev wrote:

If this is going to be updated, maybe we don't really want the assert at all, because generally there's no guarantee the user won't redefine the symbol and it wouldn't be nice to crash when they do.

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


More information about the llvm-commits mailing list