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

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 17:49:54 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;
----------------
perlfu wrote:

I have have replaced the assertion with a comment instead, so symbols always respected existing value even if it does not match.

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


More information about the llvm-commits mailing list