Re: [PATCH] D16251: There seems to be a fundamental problem in SimplifyCFG: Dead code removal can result inuninitialized variables. The impact is an “endless” loop which can be consideredthe consequence of searching for the initialization. More details are...

Akira Hatanaka via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 09:28:42 PST 2016


ahatanak added a subscriber: ahatanak.
ahatanak added a comment.

Is the code still correct when the pass removes an edge entering a loop with two entries?

For example, if we initially have a CFG like this which has a loop (BB1,BB2),

BB0-->BB1<-->BB2<--BB3

BB0:
v0 = a
BB1:
v1 = phi(v0, v3)
...
BB2:
v2 = phi(v1, v4)
v3 = v2 + 1
...
BB3:
v4 = b

BB1 doesn't dominate BB2 because the loop has two entries from BB0 and BB3.

However, if simplifycfg is able to remove edge (BB3->BB2), (BB1,BB2) becomes a single entry loop with header BB1.

BB0:
v0 = a
BB1:
v1 = phi(v0, v3)
...
BB2:
v3 = v1 + 1
...

If simplifycfg is able to remove edge BB0->BB1, then you'll get

BB1:
...
BB2:
v3 = v3 + 1
...


http://reviews.llvm.org/D16251





More information about the llvm-commits mailing list