| Issue |
203452
|
| Summary |
[CppEmitter] Improve code readability
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
vfdff
|
Now we use mlir-translate to convert the emitc dialect to cpp file,
For the following test, If we can fix the following case1 and case2 issue, then the code is more readability
```cpp
void member_of_pointer(mystruct* v1, int32_t v2, size_t v3) {
mystruct* v4;
v4 = v1; **// case1: the variable v4 is redundant, use v1 directly is better ?**
v4->a = v2;
int32_t v5 = v4->b;
int32_t v6;
v6 = v5;
int32_t v7 = (v4->c)[v3];
v6 = v7; **// case2: maybe use v6 = (v4->c)[v3]; to avoid using new temporary variable v7**
(v4->d)[v3] = v2;
return;
}
```
* test: https://llvm.godbo.lt/z/YnErWjvjn
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs