This is an archive of the discontinued LLVM Phabricator instance.

[SimpleLoopUnswtich] Support zext when injecting invariant conditions
ClosedPublic

Authored by mkazantsev on Nov 15 2022, 2:09 AM.

Details

Summary

This patch handles the following case: turn

if (x <u Invariant1) {
  if (zext(x) <u Invariant2) {
    ...
  }
}

into

if (x <u Invariant1) {
  if (zext(Invariant1) <=u Invariant2) { // Unswitch here
    // No check needed
  } else {
    if (zext(x) <u Invariant2) {
      ...
    }
  }
}

Diff Detail

Event Timeline

mkazantsev created this revision.Nov 15 2022, 2:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2022, 2:09 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
mkazantsev requested review of this revision.Nov 15 2022, 2:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2022, 2:09 AM
mkazantsev planned changes to this revision.Dec 19 2022, 3:27 AM

Marking as "planned changes" just to reduce review scope.

skatkov accepted this revision.Mar 3 2023, 1:57 AM

lgtm

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
3024

wile you are here. intro -> into

This revision is now accepted and ready to land.Mar 3 2023, 1:57 AM
mkazantsev marked an inline comment as done.Mar 6 2023, 12:14 AM
This revision was landed with ongoing or failed builds.Mar 6 2023, 12:43 AM
This revision was automatically updated to reflect the committed changes.