This is an archive of the discontinued LLVM Phabricator instance.

[LSR] Generalize one aspect of terminator folding (recently introduced in D132443)
ClosedPublic

Authored by reames on Jan 20 2023, 11:08 AM.

Details

Summary

There's no need to require the start value to come directly from the loop predecessor.

Diff Detail

Event Timeline

reames created this revision.Jan 20 2023, 11:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 11:08 AM
reames requested review of this revision.Jan 20 2023, 11:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 11:08 AM
nikic added a subscriber: nikic.Jan 20 2023, 11:43 AM
nikic added inline comments.
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
6714

The bool return value can be dropped -- check nullptr return instead.

reames added inline comments.Jan 20 2023, 11:53 AM
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
6714

I plan to do this in a followup NFC. There's a bunch of other simplification that follows, and some of the naming could stand cleaned up too.

nikic accepted this revision.Jan 20 2023, 12:01 PM

LG

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
6714

Sounds good.

llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll
154

This is a miscompile, but you are already know that...

This revision is now accepted and ready to land.Jan 20 2023, 12:01 PM
reames added inline comments.Jan 20 2023, 12:15 PM
llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll
154

I actually hadn't noticed. But yes, that's one of the issued I'd called out on the original review. :)

This revision was landed with ongoing or failed builds.Jan 20 2023, 12:19 PM
This revision was automatically updated to reflect the committed changes.