On Wed, Aug 16, 2017 at 6:40 AM, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote: > I think the linear output you obtained was post simplification. We > need to look at the output prior to any simplifications. I believe it > looks like this: Before prompting memory variable to SSA form, the SSA form is correct. That is my currently understanding. The incorrect SSA form happen when we promote the memory variable into pseudo. > Finally here is what clang does after some phases (initially clang > starts with local vars). > > *** IR Dump After SROA *** > ; Function Attrs: nounwind > define void @foo() #0 { > entry: > %0 = load i32, i32* @a, align 4, !tbaa !1 > %tobool = icmp ne i32 %0, 0 > br i1 %tobool, label %if.then, label %if.else > > if.then: ; preds = %entry > %1 = load i32, i32* @b, align 4, !tbaa !1 > br label %if.end > > if.else: ; preds = %entry > %2 = load i32, i32* @c, align 4, !tbaa !1 > br label %if.end > > if.end: ; preds = %if.else, %if.then > %e.0 = phi i32 [ %1, %if.then ], [ %2, %if.else ] <================ Notice how clang place the phi node at where I said it need to be, basically the L3 in my email. Also notice clang does not have phi source. It don't need to. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html