[llvm] [TableGen] Halt !if resolution for unresolved condition (PR #107823)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 01:35:41 PDT 2024
https://github.com/Akshat-Oke created https://github.com/llvm/llvm-project/pull/107823
`MHS` should not be resolved if we don't yet know which branch is to be taken.
>From 6526f13d5e44dac2bf1348c7b3961044b6d1901b Mon Sep 17 00:00:00 2001
From: Akshat Oke <Akshat.Oke at amd.com>
Date: Mon, 9 Sep 2024 08:28:25 +0000
Subject: [PATCH] [TableGen] Halt !if resolution for unresolved condition
---
llvm/lib/TableGen/Record.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 85516b7b9f20aa..cd855b6d43dd82 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -1876,6 +1876,11 @@ Init *TernOpInit::resolveReferences(Resolver &R) const {
return RHS->resolveReferences(R);
}
}
+ if (getOpcode() == IF && !lhs->isConcrete()) {
+ // do not proceed since we don't know the condition's value
+ return (TernOpInit::get(getOpcode(), lhs, MHS, RHS, getType()))
+ ->Fold(R.getCurrentRecord());
+ }
Init *mhs = MHS->resolveReferences(R);
Init *rhs;
More information about the llvm-commits
mailing list