https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91789
--- Comment #7 from Andrew Macleod <amacleod at redhat dot com> --- hmm. yeah. we have the knowledge... but how to apply it efficiently. =========== BB 4 ============ Imports: a_3(D) Exports: a_3(D) b_2(D) int VARYING a_3(D) int VARYING Relational : (b_2(D) >= a_3(D)) <bb 4> : if (a_3(D) < 0) goto <bb 5>; [INV] else goto <bb 6>; [INV] 4->5 (T) a_3(D) : int [-INF, -1] 4->6 (F) a_3(D) : int [0, +INF] We know the relationship upon entry to BB 4, but with no reference to b_2, there is no reason to update b_2's range. b_2 may never be reference again. =========== BB 6 ============ Imports: b_2(D) Exports: b_2(D) b_2(D) int VARYING <bb 6> : if (b_2(D) < 0) goto <bb 7>; [INV] else goto <bb 8>; [INV] 6->7 (T) b_2(D) : int [-INF, -1] 6->8 (F) b_2(D) : int [0, +INF] And upon entry to BB6, we do know that a_3 is [0, +INF], but with no reference to a_3 in this block, we don't see any reason to look to see if there is a relationship. And with no further references to a_3 in the IL, we wont propagate its value to here either. THe problem is that unless we do an exhaustive search of every possible relation of b_2, there is nothing in the IL at each point to indicate we should look at the other name. Perhaps it isnt as bad as I make it sound. r perhaps I can add relations to the export list for a block and have gori figure it out. IE, in bb4 a_3 is the only export, and we can calculate a range for it. If we note at this point that there is a relation between a_3 and b_2, perhaps I can add b_2 to the export list as well, and the GORI how to process the relation much like it process recalculations. IF we have c_9 = a_3 - 10 somewhere in the program, we note the dependence of c_9 on a_3, and we "recalculate" c_9 as [0,+INF] - 10 == [-10, +INF-10] on that edge. Perhaps I can likewise add relations to this recomputation and flag b_3 as a recomputation.. Since the relation is technically "true", it could be solved for b_2 as [1, 1] = b_2(D) >= [1, +INF] and everything should just work... hmm. I shall give it a go after a bit more thought.