[llvm] [TableGen] Short-circuit !cond operator (PR #208942)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 05:19:14 PDT 2026


================
@@ -2738,6 +2738,16 @@ const Init *CondOpInit::resolveReferences(Resolver &R) const {
     const Init *NewVal = Val->resolveReferences(R);
     NewVals.push_back(NewVal);
     Changed |= NewVal != Val;
+
+    // Short-circuit if this cond is true.
+    if (auto *NewCondVal = dyn_cast_or_null<IntInit>(
+            NewCond->convertInitializerTo(IntRecTy::get(getRecordKeeper())))) {
+      if (NewCondVal->getValue()) {
+        Changed = 1;
----------------
jayfoad wrote:

```suggestion
        Changed = true;
```

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


More information about the llvm-commits mailing list