// If the values are Selects with the same condition, we can do a more precise
// check: just check for aliases between the values on corresponding arms.
if (const SelectInst *SI2 = dyn_cast<SelectInst>(V2))
- if (SI->getCondition() == SI2->getCondition()) {
+ if (isValueEqualInPotentialCycles(SI->getCondition(),
+ SI2->getCondition())) {
AliasResult Alias =
AAQI.AAR.alias(MemoryLocation(SI->getTrueValue(), SISize),
MemoryLocation(SI2->getTrueValue(), V2Size), AAQI);
; On the first iteration, sel1 = a1, sel2 = a2, phi = a3
; On the second iteration, sel1 = a2, sel1 = a1, phi = a2
; As such, sel1 and phi may alias.
-; FIXME: Miscompile.
; CHECK-LABEL: Function: select_backedge
; CHECK: NoAlias: i32* %sel1, i32* %sel2
-; CHECK: NoAlias: i32* %phi, i32* %sel1
+; CHECK: MayAlias: i32* %phi, i32* %sel1
; CHECK: MayAlias: i32* %phi, i32* %sel2
define void @select_backedge() {
entry: