<div dir="ltr">Hi,<div><br></div><div>Both LazyValueInfo and ScalarEvolution can calculate a constant range for an LLVM Value.</div><div>I found that some times they do not agree, may be I interpreted them incorrectly</div><div><br></div><div>For example in the following IR:</div><div><br></div><div><div>bb85:                                             ; preds = %bb85, %bb73</div><div>  %tmp86 = phi i32 [ 1, %bb73 ], [ %tmp95, %bb85 ]</div><div>  %tmp95 = add nsw i32 %tmp86, 1<br></div><div>  %tmp96 = icmp slt i32 %tmp95, 20</div><div>  br i1 %tmp96, label %bb85, label %bb97</div></div><div><br></div><div>LazyValueInfo give:</div><div><br></div><div>POP   %tmp86 = phi i32 [ 1, %bb73 ], [ %tmp95, %bb85 ] in bb85 = constantrange<-2147483648, 20></div><div><br></div><div>While ScalarEvolution give:</div><div><br></div><div><div> %tmp86 = phi i32 [ 1, %bb73 ], [ %tmp95, %bb85 ]</div><div>  -->  {1,+,1}<nuw><nsw><%bb85> U: [1,20) S: [1,20)             Exits: 19               LoopDispositions: { %bb85: Computable, %bb73: Variant, %bb46: Variant }</div></div><div><br></div><div>In this example, the range of %tmp86 is <-2147483648, 20> from LazyValueInfo, but it is [1,20) from ScalarEvolution.</div><div><br></div><div>How can I interpret these results? </div><div>Is there a way to get [0, 20) for %tmp86 in LazyValueInfo?</div><div><br></div><div>Thanks</div><div>Hongbin</div><div><br></div><div><br></div><div><br></div></div>