[llvm-dev] Potentially unsafe loop optimization
Richard Kenner via llvm-dev
llvm-dev at lists.llvm.org
Thu Feb 18 09:16:31 PST 2021
> Had the bcmp not been there, this late run of InstructionSimplify
> wouldn't have happened. There are no other optimizations that always
> run in this part of the pipeline that would see the bad IR created
> from loop strength reduce and optimize based on it. SelectionDAG can
> do optimizations with nuw, but it only runs on a single basic block
> so it won't see the phi.
OK, I understand now.
> Nikita's patch, 835104a1141a06ae7821fe2b642b9603e00aa17b removes the
> nuw from the add on trunk.
That sounds right given that it moved the add before the branch.
> I didn't look at why llvm 10 works.
Probably because it didn't do the late run or it didn't spot the phi
would be my guess.
More information about the llvm-dev
mailing list