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

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 02:54: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;
----------------
shiltian wrote:

```suggestion
```

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


More information about the llvm-commits mailing list