[PATCH] D38415: [SimplifyIndVar] Replace IVUsers with loop invariant if possible
Hongbin Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 14:19:22 PDT 2017
etherzhhb added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:552
- if (!C)
+ if (!SE->isLoopInvariant(S, L))
return false;
----------------
efriedma wrote:
> etherzhhb wrote:
> > We may only want to do the replace if S is invariant of the IV's Loop, which may be different from "L" which is the innermost loop that contains the IV user
> Yes; otherwise, the transform isn't doing anything useful.
>
> We might need to call isHighCostExpansion here, so we don't generate something ridiculous?
Yes, this make sense.
I did some experiments and we may want to actually write:
```
if (!SE->isLoopInvariant(S, IV's Loop) || !SE->isLoopInvariant(S, IV User's Loop))
```
If IV's Loop do not contains IV User's Loop
https://reviews.llvm.org/D38415
More information about the llvm-commits
mailing list