diff options
-rw-r--r-- | llvm/include/llvm/TableGen/Record.h | 4 | ||||
-rw-r--r-- | llvm/test/TableGen/if.td | 17 |
2 files changed, 20 insertions, 1 deletions
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h index 9736e015008..50477402a89 100644 --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -905,7 +905,9 @@ public: // possible to fold. Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const override; - bool isComplete() const override { return false; } + bool isComplete() const override { + return LHS->isComplete() && MHS->isComplete() && RHS->isComplete(); + } Init *resolveReferences(Record &R, const RecordVal *RV) const override; diff --git a/llvm/test/TableGen/if.td b/llvm/test/TableGen/if.td index 05a2d992856..019e4dd1585 100644 --- a/llvm/test/TableGen/if.td +++ b/llvm/test/TableGen/if.td @@ -56,6 +56,23 @@ def D128: S<128>; // CHECK: def D8 // CHECK-NEXT: bits<2> val = { 0, 0 }; +// Make sure !if gets propagated across multiple layers of inheritance. +class getInt<int c> { + int ret = !if(c, 0, 1); +} +class I1<int c> { + int i = getInt<c>.ret; +} +class I2<int c> : I1<c>; + +// CHECK: def DI1 { // I1 +// CHECK-NEXT: int i = 0; +def DI1: I1<1>; + +// CHECK: def DI2 { // I1 I2 +// CHECK-NEXT: int i = 0; +def DI2: I2<1>; + // CHECK: def One // CHECK-NEXT: list<int> first = [1, 2, 3]; // CHECK-NEXT: list<int> rest = [1, 2, 3]; |