[PATCH] D156395: [Reassociate][NFC] Update the header comment of Reassociate Pass

Hongyu Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 22:48:05 PDT 2023


XChy created this revision.
XChy added reviewers: nikic, spatel.
XChy added projects: All, LLVM.
Herald added subscribers: StephenFan, hiraditya.
XChy requested review of this revision.
Herald added a subscriber: llvm-commits.

The doc for reassociate has been outdated and inconsistent with its mechanism.
Its description about rank is wrong, which I update here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156395

Files:
  llvm/lib/Transforms/Scalar/Reassociate.cpp


Index: llvm/lib/Transforms/Scalar/Reassociate.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -12,10 +12,10 @@
 // For example: 4 + (x + 5) -> x + (4 + 5)
 //
 // In the implementation of this algorithm, constants are assigned rank = 0,
-// function arguments are rank = 1, and other values are assigned ranks
-// corresponding to the reverse post order traversal of current function
-// (starting at 2), which effectively gives values in deep loops higher rank
-// than values not in loops.
+// the ith function arguments are rank = i + 1, and other values are assigned
+// ranks corresponding to the reverse post order traversal of current function
+// (starting at rank(the last function argument) << 16), which effectively gives
+// values in deep loops higher rank than values not in loops.
 //
 //===----------------------------------------------------------------------===//
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156395.544611.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230727/a27df8ea/attachment.bin>


More information about the llvm-commits mailing list