[SCEV] Fix isImpliedViaMerge() with values from previous iteration (PR56242)
When trying to prove an implied condition on a phi by proving it for all incoming values, we need to be careful about values coming from a backedge, as these may refer to a previous loop iteration. A variant of this issue was fixed in D101829, but the dominance condition used there isn't quite right: It checks that the value dominates the incoming block, which doesn't exclude backedges (values defined in a loop will usually dominate the loop latch, which is the incoming block of the backedge). Instead, we should be checking for domination of the phi block. Any values defined inside the loop will not dominate the loop header phi. Fixes https://github.com/llvm/llvm-project/issues/56242. Differential Revision: https://reviews.llvm.org/D128640
Loading
Please sign in to comment