llvm.org GIT mirror llvm / 2093e88
Anonymous definitions in foreach blocks triggered a 'def already exists' git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210526 91177308-0d34-0410-b5e6-96231b3b80d8 Artyom Skrobov 5 years ago
2 changed file(s) with 32 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
359359 }
360360
361361 if (Records.getDef(IterRec->getNameInitAsString())) {
362 Error(Loc, "def already exists: " + IterRec->getNameInitAsString());
363 return true;
362 // If this record is anonymous, it's no problem, just generate a new name
363 if (IterRec->isAnonymous())
364 IterRec->setName(GetNewAnonymousName());
365 else {
366 Error(Loc, "def already exists: " + IterRec->getNameInitAsString());
367 return true;
368 }
364369 }
365370
366371 Records.addDef(IterRec);
5050 // CHECK: string Name = "R7";
5151 // CHECK: int Index = 7;
5252
53 foreach i = {0-3,9-7} in
53 foreach i = {0-3,9-7} in {
5454 def S#i : Register<"Q"#i, i>;
55 def : Register<"T"#i, i>;
56 }
5557
5658 // CHECK: def S0
5759 // CHECK: def S1
6062 // CHECK: def S7
6163 // CHECK: def S8
6264 // CHECK: def S9
65
66 // CHECK: def
67 // CHECK: string Name = "T0";
68
69 // CHECK: def
70 // CHECK: string Name = "T1";
71
72 // CHECK: def
73 // CHECK: string Name = "T2";
74
75 // CHECK: def
76 // CHECK: string Name = "T3";
77
78 // CHECK: def
79 // CHECK: string Name = "T9";
80
81 // CHECK: def
82 // CHECK: string Name = "T8";
83
84 // CHECK: def
85 // CHECK: string Name = "T7";
86