The new version has several advantages:
- (IMNSHO) it's more readable and neater
- It handles loads and stores properly
- It can handle any number of incoming blocks rather than just two. I'll be taking advantage of this in a followup patch.
With this change we can now finally sink load-modify-store idioms such as:
if (a) return *b += 3; else return *b += 4; => %z = load i32, i32* %y %.sink = select i1 %a, i32 3, i32 4 %b = add i32 %z, %.sink store i32 %b, i32* %y ret i32 %b
When this works for switches it'll be even more powerful.
Why not use Instruction::isIdenticalTo or Instruction::isIdenticalToWhenDefined?