[PATCH] D149132: [LICM] Reassociate & hoist add expressions

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 20:56:28 PDT 2023

mkazantsev planned changes to this revision.
mkazantsev added a comment.

Err, indeed I messed up with test TODOs.

Comment at: llvm/test/Transforms/LICM/hoist-add-sub.ll:394
-; TODO: iv + x < 4 ==> iv < 4 - x
+; iv + x < 4 ==> iv < 4 - x
 define i32 @test_04(ptr %p, ptr %x_p, ptr %length_p) {
nikic wrote:
> TODO incorrectly dropped here. But I think maybe the test isn't right and `%x` is supposed to use range `!1` not `!0`? Same for the pair of tests above.
No, range `!0` is good enough here. The original add doesn't overflow because of `nsw`, and the new sub doesn't overflow because it's a subtraction of two non-negatives.



More information about the llvm-commits mailing list