[PATCH] D77523: Add CanonicalizeFreezeInLoops pass

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 23:25:40 PDT 2020


aqjune created this revision.
aqjune added reviewers: spatel, efriedma, lebedev.ri, fhahn, jdoerfert.
Herald added subscribers: llvm-commits, javed.absar, hiraditya, mgorny.
Herald added a project: LLVM.

If an induction variable is frozen and used, SCEV yields imprecise result
because it doesn't say anything about frozen variables.

Due to this reason, performance degradation happened after
https://reviews.llvm.org/D76483 is merged, causing
SCEV yield imprecise result and preventing LSR to optimize a loop.

The suggested solution here is to add a pass which canonicalizes frozen variables
inside a loop. To be specific, it pushes freezes out of the loop by freezing
the initial value and step values instead.
This solution was also mentioned at https://reviews.llvm.org/D70623 .
By adding this pass, the assembly output from the reduced C program
(https://reviews.llvm.org/D76483#1952362 ) becomes equivalent.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77523

Files:
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Utils.h
  llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Utils/CMakeLists.txt
  llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
  llvm/lib/Transforms/Utils/Utils.cpp
  llvm/test/Transforms/CanonicalizeFreezeInLoops/simple.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77523.255226.patch
Type: text/x-patch
Size: 22418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/2f0f13c5/attachment.bin>


More information about the llvm-commits mailing list