[PATCH] Enable ExitValue rewrite only when expansion cost is low.

Wei Mi wmi at google.com
Thu May 28 10:44:30 PDT 2015


Hal and Andy, thanks for the helpful comments.

> Once LoopCanBeDel is false, it will never become true again. Please remove this variable and just 'return false' in all places where you set LoopCanBeDel to false.


Done.

> incoming -> Incoming


Done.

> Please update you patch for trunk. You probably don't need LastPN.


Done.

> IsLoopCanBeDel should be phrased "CanLoopBeDeleted". However, it's not just a query; it at least needs a very clear comment that it may hoist instructions into the preheader to facilitate the query.


I think it is fine to let later phase to do the LICM so I changed Loop::makeLoopInvariant to Loop::hasLoopInvariantOperands. CanLoopBeDeleted is a query only func now.

> As Hal pointed out, it's very important to return early from CanLoopBeDeleted. We should only scan all instructions in the loop if we know the loop can otherwise be deleted.


Done.

> I'm curious why you needed to enable aggressive exit value replacement in four unit tests. Can your logic determine that the loops can be deleted in those cases?


I changed the tests. Now aggressive exit value replacement is only enabled in test/Transforms/IndVarSimplify/lcssa-preservation.ll. That test is used to check IndVars preserves LCSSA form. I preserve the original test behavior by enabling aggressive exit value replacement. For other three tests, loops can be deleted.

Thanks,
Wei.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9800

Files:
  lib/Analysis/ScalarEvolutionExpander.cpp
  lib/Transforms/Scalar/IndVarSimplify.cpp
  test/Transforms/IndVarSimplify/exit_value_test2.ll
  test/Transforms/IndVarSimplify/exit_value_test3.ll
  test/Transforms/IndVarSimplify/lcssa-preservation.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9800.26704.patch
Type: text/x-patch
Size: 13551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150528/025dc80d/attachment.bin>


More information about the llvm-commits mailing list