[llvm] [TableGen] Make `!and` and `!or` short-circuit (PR #113963)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 10:18:24 PST 2024


================
@@ -1543,6 +1543,29 @@ const Init *BinOpInit::resolveReferences(Resolver &R) const {
   const Init *lhs = LHS->resolveReferences(R);
   const Init *rhs = RHS->resolveReferences(R);
 
+  unsigned Opc = getOpcode();
+  if (Opc == AND || Opc == OR) {
+    // Short-circuit. Regardless whether this is a logical or bitwise
+    // AND/OR.
+    // Ideally we could also short-circuit `!or(true, ...)`, but it's
----------------
jurahul wrote:

The comment about `!or` now seems stale.

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


More information about the llvm-commits mailing list