File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1558,7 +1558,6 @@ const Init *BinOpInit::Fold(const Record *CurRec) const {
15581558
15591559const Init *BinOpInit::resolveReferences (Resolver &R) const {
15601560 const Init *lhs = LHS->resolveReferences (R);
1561- const Init *rhs = RHS->resolveReferences (R);
15621561
15631562 unsigned Opc = getOpcode ();
15641563 if (Opc == AND || Opc == OR) {
@@ -1577,6 +1576,8 @@ const Init *BinOpInit::resolveReferences(Resolver &R) const {
15771576 }
15781577 }
15791578
1579+ const Init *rhs = RHS->resolveReferences (R);
1580+
15801581 if (LHS != lhs || RHS != rhs)
15811582 return (BinOpInit::get (getOpcode (), lhs, rhs, getType ()))
15821583 ->Fold (R.getCurrentRecord ());
Original file line number Diff line number Diff line change @@ -67,13 +67,18 @@ def rec7 {
6767 bits<3> flags = { true, false, true };
6868}
6969
70- // `!and` and `!or` should be short-circuit such that `!tail` on empty list will never
71- // be evaluated.
70+ // `!and` and `!or` should be short-circuit such that any of the `!head` or
71+ // `!tail` on empty list below will never be evaluated.
7272// CHECK: def rec8
73+ // CHECK: bit v = 0;
74+ // CHECK: int v2 = -1;
7375// CHECK: list<int> newSeq = [];
7476// CHECK: list<int> newSeq2 = [];
7577
7678class Foo <list<int> seq = []> {
79+ bit v = !and(false, !head(seq));
80+ int v2 = !or(-1, !head(seq));
81+
7782 bit unresolved = !ne(!find(NAME, "BAR"), -1);
7883 list<int> newSeq = !if(!and(false, unresolved), !tail(seq), seq);
7984 list<int> newSeq2 = !if(!or(-1, unresolved), seq, !tail(seq));
You can’t perform that action at this time.
0 commit comments