This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Extend `i1 cond ? i1 x : i1 y` (where either x or y is a constant integer) to arbitrary-sized integers
AbandonedPublic

Authored by lebedev.ri on Feb 10 2022, 2:29 PM.

Details

Reviewers
bollu
Summary

@Meinersbur this is causing a number of polly test changes.
I believe those tests need to be fixed and not updated,
and that probably requires knowing what they are actually testing.
Would you like to help with that?

To support not just booleans we simply only need to sext the condition:
https://alive2.llvm.org/ce/z/EFKLeA

It is contentious whether we should not said condition before or after
the sext, doing that afterwards seems less worse,
but it will depend i guess.

Test llvm/test/Transforms/IndVarSimplify/eliminate-max.ll starts to trigger
assertion after this. While SCEVUnknown was originally created
for an opaque IR Value which was an Instruction, later said Value
was RAUW'd by a constant integer, yet we still have that SCEVUnknown.
Are we missing an invalidation?

Diff Detail

Event Timeline

lebedev.ri created this revision.Feb 10 2022, 2:29 PM
lebedev.ri requested review of this revision.Feb 10 2022, 2:29 PM

ping @Meinersbur this will need some help with polly's tests...

@Meinersbur i've updated affected polly tests to the best of my understanding, please comment if that is acceptable or not.

nikic added a subscriber: nikic.Feb 16 2022, 12:06 PM
nikic added inline comments.
llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll
14

It looks like the ranges computed in this file regress. You probably need to update the getRangeViaFactoring() code, which assumes that the selects here will be SCEVUnknowns.

lebedev.ri abandoned this revision.Oct 18 2022, 5:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 5:46 PM