Skip to content

Commit

Permalink
[AutoBump] Merge with fixes of a1c9dd7 (Oct 10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgehre-amd committed Jan 13, 2025
2 parents 59cb35c + a1c9dd7 commit 24e0e63
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,7 @@ def EmitC_SwitchOp : EmitC_Op<"switch", [RecursiveMemoryEffects,
func2(v4);
break;
}
}
```
}];

Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Target/Cpp/TranslateToCpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static LogicalResult printOperation(CppEmitter &emitter,
if (failed(emitSwitchCase(emitter, os, switchOp.getDefaultRegion())))
return failure();

os.unindent() << "}";
os.unindent() << "}\n}";
return success();
}

Expand Down
3 changes: 2 additions & 1 deletion mlir/test/Target/Cpp/emitc-constants-as-variables.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func.func @emitc_switch_ui64() {
// CPP-DEFAULT-NEXT: func2((uint64_t) 1);
// CPP-DEFAULT-NEXT: break;
// CPP-DEFAULT-NEXT: }
// CPP-DEFAULT-NEXT: }
// CPP-DEFAULT-NEXT: return;
// CPP-DEFAULT-NEXT: }

Expand All @@ -62,4 +63,4 @@ func.func @negative_values() {
// CPP-DEFAULT-LABEL: void negative_values() {
// CPP-DEFAULT-NEXT: ssize_t v1 = (size_t) 10 + (ssize_t) -3000000000;
// CPP-DEFAULT-NEXT: return;
// CPP-DEFAULT-NEXT: }
// CPP-DEFAULT-NEXT: }
28 changes: 28 additions & 0 deletions mlir/test/Target/Cpp/switch.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -40,6 +41,7 @@
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ptrdiff_t() {
Expand Down Expand Up @@ -77,6 +79,7 @@ func.func @emitc_switch_ptrdiff_t() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -100,6 +103,7 @@ func.func @emitc_switch_ptrdiff_t() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ssize_t() {
Expand Down Expand Up @@ -138,6 +142,7 @@ func.func @emitc_switch_ssize_t() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -161,6 +166,7 @@ func.func @emitc_switch_ssize_t() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_size_t() {
Expand Down Expand Up @@ -199,6 +205,7 @@ func.func @emitc_switch_size_t() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -222,6 +229,7 @@ func.func @emitc_switch_size_t() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_index() {
Expand Down Expand Up @@ -260,6 +268,7 @@ func.func @emitc_switch_index() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -283,6 +292,7 @@ func.func @emitc_switch_index() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_opaque() {
Expand Down Expand Up @@ -322,6 +332,7 @@ func.func @emitc_switch_opaque() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -345,6 +356,7 @@ func.func @emitc_switch_opaque() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i1() {
Expand Down Expand Up @@ -383,6 +395,7 @@ func.func @emitc_switch_i1() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -406,6 +419,7 @@ func.func @emitc_switch_i1() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i8() {
Expand Down Expand Up @@ -444,6 +458,7 @@ func.func @emitc_switch_i8() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -467,6 +482,7 @@ func.func @emitc_switch_i8() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui8() {
Expand Down Expand Up @@ -505,6 +521,7 @@ func.func @emitc_switch_ui8() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -528,6 +545,7 @@ func.func @emitc_switch_ui8() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i16() {
Expand Down Expand Up @@ -566,6 +584,7 @@ func.func @emitc_switch_i16() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -589,6 +608,7 @@ func.func @emitc_switch_i16() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui16() {
Expand Down Expand Up @@ -627,6 +647,7 @@ func.func @emitc_switch_ui16() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -650,6 +671,7 @@ func.func @emitc_switch_ui16() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i32() {
Expand Down Expand Up @@ -688,6 +710,7 @@ func.func @emitc_switch_i32() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -711,6 +734,7 @@ func.func @emitc_switch_i32() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui32() {
Expand Down Expand Up @@ -749,6 +773,7 @@ func.func @emitc_switch_ui32() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -772,6 +797,7 @@ func.func @emitc_switch_ui32() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i64() {
Expand Down Expand Up @@ -810,6 +836,7 @@ func.func @emitc_switch_i64() {
// CPP-DEFAULT: func2(v4);
// CPP-DEFAULT: break;
// CPP-DEFAULT: }
// CPP-DEFAULT: }
// CPP-DEFAULT: return;
// CPP-DEFAULT: }

Expand All @@ -833,6 +860,7 @@ func.func @emitc_switch_i64() {
// CPP-DECLTOP: func2(v2);
// CPP-DECLTOP: break;
// CPP-DECLTOP: }
// CPP-DECLTOP: }
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui64() {
Expand Down

0 comments on commit 24e0e63

Please sign in to comment.