We can skip such incoming values. This was already done by
PhiValues if present, but we can also do this without the
additional analysis.
SmallPtrSet<Value *, 4> UniqueSrc;
Value *OnePhi = nullptr;
for (Value *PV1 : PN->incoming_values()) {
+ // Skip the phi itself being the incoming value.
+ if (PV1 == PN)
+ continue;
+
if (isa<PHINode>(PV1)) {
if (OnePhi && OnePhi != PV1) {
// To control potential compile time explosion, we choose to be
ret void
}
-; NO-PHI-VALUES: MayAlias: i8* %a, i8* %phi
-; PHI-VALUES: MustAlias: i8* %a, i8* %phi
+; CHECK: MustAlias: i8* %a, i8* %phi
define void @phi_contains_self() {
entry:
%a = alloca i32