<div dir="ltr">Sorry for the delay, I've been on holiday. Rich - thanks for your repro, it definitely helps. I've boiled it down to the IR below. %x and %y should be PartialAlias as they are NoAlias on the first loop iteration and MustAlias on the second. However, BasicAliasAnalysis as of b9ce60ff09ce9ddc94862f72d94ed09e4c4a1b49 says that %x and %y NoAlias. The regression *wasn't* caused by the a false positive in the new analysis the change introduces. The patch also fixes a bug in the sign extension logic in the class (see test_sign_extension in the patch), and this fix now reveals what I believe is a bug in the modulo analysis (I think it's missing a call to isValueEqualInPotentialCycles). I've included a bit of my debugging session below, but I'll dig into this new issue myself to see if I can fix it. Thanks -<br><br>Nick<br><br>target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br><br>@b = global i32 0, align 4<br>@c = global i32 0, align 4<br>@d = global i32 0, align 4<br>@e = global i32* null, align 8<br><br>; CHECK-LABEL: main<br>; CHECK:  PartialAlias: i32** %x, i32** %y<br>define i32 @main() {<br>  %h = alloca [1 x [2 x i32*]], align 16<br>  %.pr = load i32* @d, align 4<br>  %1 = icmp slt i32 %.pr, 2<br>  br i1 %1, label %.<a href="http://lr.ph">lr.ph</a>, label %10<br><br>.<a href="http://lr.ph">lr.ph</a>:                                           ; preds = %0<br>  %2 = load i32* @c, align 4<br>  %3 = sext i32 %2 to i64<br>  %d.promoted = load i32* @d, align 4<br>  br label %4<br><br>; <label>:4                                       ; preds = %.<a href="http://lr.ph">lr.ph</a>, %4<br>  %5 = phi i32 [ %d.promoted, %.<a href="http://lr.ph">lr.ph</a> ], [ %8, %4 ]<br>  %6 = phi i32 [ %.pr, %.<a href="http://lr.ph">lr.ph</a> ], [ %8, %4 ]<br>  %7 = sext i32 %6 to i64<br>  %x = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 %3, i64 %7<br>  store i32* @b, i32** %x, align 8<br>  %8 = add nsw i32 %5, 1<br>  %9 = icmp slt i32 %8, 2<br>  br i1 %9, label %4, label %10<br><br>; <label>:10                                      ; preds = %._crit_edge, %0<br>  %y = getelementptr inbounds [1 x [2 x i32*]]* %h, i64 0, i64 0, i64 1<br>  %11 = load i32** %y, align 8<br>  store i32* %11, i32** @e, align 8<br>  ret i32 0<br>}<br><br>And my debugging session:<br><br> $ lldb -- ./Debug+Asserts/bin/opt gvn.ll -basicaa -aa-eval -debug-aa -count-aa -print-all-alias-modref-info -debug -disable-output<br> // ...<br>(lldb) <br>Process 3397 stopped<br>* thread #1: tid = 0xcebe7, 0x00000001016e3ce3 opt`(anonymous namespace)::BasicAliasAnalysis::aliasGEP(this=0x0000000104809000, GEP1=0x000000010410ab30, V1Size=8, V1AAInfo=0x00007fff5fbfce60, V2=0x000000010410a860, V2Size=8, V2AAInfo=0x00007fff5fbfce78, UnderlyingV1=0x0000000104109e68, UnderlyingV2=0x0000000104109e68) + 3651 at BasicAliasAnalysis.cpp:1101, queue = 'com.apple.main-thread', stop reason = step over<br>    frame #0: 0x00000001016e3ce3 opt`(anonymous namespace)::BasicAliasAnalysis::aliasGEP(this=0x0000000104809000, GEP1=0x000000010410ab30, V1Size=8, V1AAInfo=0x00007fff5fbfce60, V2=0x000000010410a860, V2Size=8, V2AAInfo=0x00007fff5fbfce78, UnderlyingV1=0x0000000104109e68, UnderlyingV2=0x0000000104109e68) + 3651 at BasicAliasAnalysis.cpp:1101<br>   1098        uint64_t ModOffset = (uint64_t)GEP1BaseOffset & (Modulo - 1);<br>   1099        if (V1Size != UnknownSize && V2Size != UnknownSize &&<br>   1100            ModOffset >= V2Size && V1Size <= Modulo - ModOffset)<br>-> 1101          return NoAlias;<br>   1102    <br>   1103        // If we know all the variables are positive, then GEP1 >= GEP1BasePtr.<br>   1104        // If GEP1BasePtr > V2 (GEP1BaseOffset > 0) then we know the pointers<br>(lldb) p V1Size<br>(uint64_t) $20 = 8<br>(lldb) p V2Size<br>(uint64_t) $21 = 8<br>(lldb) p ModOffset<br>(uint64_t) $22 = 8<br>(lldb) p Modulo<br>(uint64_t) $23 = 16<br>(lldb) p GEP1->getName()<br>(llvm::StringRef) $24 = (Data = "y", Length = 1)<br>(lldb) p V2->getName()<br>(llvm::StringRef) $25 = (Data = "x", Length = 1)<br>(lldb) p GEP1BaseOffset<br>(int64_t) $26 = 8<br><br></div>