[PATCH] D23586: [Coroutines] Part 8: Coroutine Frame Building algorithm
Gor Nishanov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 15:44:50 PDT 2016
GorNishanov marked 5 inline comments as done.
================
Comment at: lib/Transforms/Coroutines/CoroFrame.cpp:479-480
@@ +478,4 @@
+
+ // TODO: Simplify PHINodes in the basic block to remove duplicate
+ // predecessors.
+
----------------
I do not think there is a correctness issue here.
For the case like:
```
entry:
...
br i1 %x label %a, label %a
...
a:
phi [0 %entry], [0 %entry], [1 %loop]
```
With the code as is, we will create two identical edge blocks:
```
entry:
...
br i1 %x label %a1, label %a2
...
a1:
%a1.val = phi [0 %entry]
br label %a
a2:
%a2.val = phi [0 %entry]
br label %a
a3:
%a3.val = phi [1 %loop]
br label %a
a:
phi [%a1.val %a1], [%a2.val %a2], [%a3.val %a3]
```
I added a TODO to tighten up PHI rewriting so that for identical predecessors we can share an edge block, so that the example above would look like:
```
entry:
...
br i1 %x label %a1, label %a2
...
a1:
%a1.val = phi [0 %entry]
br label %a
a2:
%a2.val = phi [1 %loop]
br label %a
a:
phi [%a1.val %a1], [%a2.val %a2]
```
https://reviews.llvm.org/D23586
More information about the llvm-commits
mailing list