[PATCH] D95789: [SpeculateAroundPHIs] Avoid speculation on loop back edges

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 00:36:08 PST 2021


bjope added reviewers: fhahn, reames, spatel, chandlerc, asbirlea.
bjope added a comment.

I think the problem with loop metadata not being handled properly is a bug (that also could impact performance negatively) , so this is a quick fix (but I guess it could be possible to handle transition of metadata to the new latch with some effort if the transform is beneficial).

Then there is the question about loop form and what can be expected at the end of the opt pipeline. Should the loop be in simplified/rotated form (I think legacy PM ends with SimplifyCFG, but new PM is running this pass that might unrotate(?) the loop). At least our downstream benchmarks suffered significantly since it failed to detect hwloops when having speculated around a phi involving a latch. If there is no canonical form, then maybe we need to improve codegen to either undo the transform (rotate loops) or improve the hwloop detection somehow.

Maybe I should add a TTI hook to simplify for specific targets to use this workaround (although, the loop metadata problem could possible be messing up for any target)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95789/new/

https://reviews.llvm.org/D95789



More information about the llvm-commits mailing list