[PATCH] D149323: [SCEV] Don't invalidate past dependency-breaking instructions
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 28 01:38:44 PDT 2023
nikic added a comment.
In D149323#4304636 <https://reviews.llvm.org/D149323#4304636>, @mkazantsev wrote:
> Consider example:
>
> %sum = add i32 %x, %y
> %load_p= gep ptr %p, i32 %sum
> %load1 = load %i32 load_p
>
> if (%load_1 == %sum) {
> %load_2 = load %i32 load_p
> %sum_2 = add i32 %load_2, 2
> }
>
>
> Here we can theoretically prove that SCEV for `%load_2` is `%x + %y` (same as `%sum`) and `%sum2 = %x + %y + 1`.
>
> Now, imagine that we invalidate `%x`. With your patch, if I understand it correctly, `%sum_2` won't be invalidated.
Not sure I get the example. `%load1` and `%load_2` will both always be SCEVUnknown (loads always are, if they are SCEVable at all). The `%x + %y` is part of the load address, but it doesn't impact the SCEV of the load itself. It's part of `%load_p`, but that one will continue to be invalidated normally.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149323/new/
https://reviews.llvm.org/D149323
More information about the llvm-commits
mailing list