[PATCH] D17430: [ifcnv] Add comment explaining why it's OK to duplicate convergent MIs in ifcnv.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 16:42:52 PST 2016
jlebar added a comment.
In http://reviews.llvm.org/D17430#357590, @resistor wrote:
> I don't agree with the new comments. If conversion does not remove any dependencies. It just changes their expression from control flow to predication, but they're still control dependencies in that they gate execution.
My understanding is that it's a bit more complicated than that. I'm looking at the "simple" transformation, and afaict, if the basic block we're predicating has more than one predecessor, we copy it into one predecessor (adding predication) and also leave it alone so it can still be branched to. It's specifically this sort of thing that I'm trying to say is safe.
To be concrete, suppose we have
BB1 --> TBB
BB2 --> (TBB or FBB) based on cond
TBB --> exit
The simple conversion on the BB2 + TBB + FBB subgraph will convert this to
BB1 --> TBB --> exit
BB2 --> predicated (TBB + exit) --> FBB
In this case a convergent operation inside TBB originally had a CFG dependency equal to BB1 || BB2+cond. After the transform there are two convergent instructions, one with a dependency equal to BB1, and the other with a dependency equal to BB2+cond. I read this as "removing" a control-flow dependency on the two instructions, but maybe that's not the right way to express what's going on.
It's quite likely I'm still misunderstanding what's going on here. Once we settle on an understanding I'll definitely update the comment, since it's either wrong or unclear.
Thank you for your help.
http://reviews.llvm.org/D17430
More information about the llvm-commits
mailing list