[PATCH] D26781: [LSR] Canonicalize formula and put recursive Reg related with current loop in ScaledReg.

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 18:25:58 PST 2016


wmi created this revision.
wmi added reviewers: qcolombet, sanjoy, atrick.
wmi added subscribers: llvm-commits, davidxl.
wmi set the repository for this revision to rL LLVM.
Herald added a subscriber: mzolotukhin.

After https://reviews.llvm.org/D26429, LSR formula can have multiple SCEVAddRecExprs inside of its BaseRegs. Previous canonicalization will swap the first SCEVAddRecExpr in BaseRegs with ScaledReg. But now we want to swap the SCEVAddRecExpr Reg related with current loop with ScaledReg. Otherwise, we may generate code like this: RegA + lsr.iv + RegB, where loop invariant parts RegA and RegB are not grouped together and cannot be promoted outside of loop. With this patch, it will ensure lsr.iv to be generated later in the expr: RegA + RegB + lsr.iv, so that RegA + RegB can be promoted outside of loop.


Repository:
  rL LLVM

https://reviews.llvm.org/D26781

Files:
  lib/Transforms/Scalar/LoopStrengthReduce.cpp
  test/Transforms/LoopStrengthReduce/X86/canonical.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26781.78301.patch
Type: text/x-patch
Size: 13144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161117/ed488c76/attachment.bin>


More information about the llvm-commits mailing list