This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Re-land: Fix isKnownPredicate
ClosedPublic

Authored by skatkov on Mar 16 2018, 1:07 AM.

Details

Summary

This is re-land of https://reviews.llvm.org/rL327362 with a fix and regression test.

The crash was due to it is possible that for found MDL loop, LHS or RHS may contain
an invariant unknown SCEV which does not dominate the MDL. Please see regression
test for an example.

Diff Detail

Event Timeline

skatkov created this revision.Mar 16 2018, 1:07 AM
mkazantsev accepted this revision.Mar 18 2018, 9:39 PM

LGTM with nits. I've also run this test via our Fuzzer testing and it didn't detect any failures, so I think it's fine now.

lib/Analysis/ScalarEvolution.cpp
8747

It could be one if with && conditions, but it's up to you.

test/Transforms/IndVarSimplify/inner-loop-by-latch-cond.ll
22

How about adding check that @foo is called with %j?

This revision is now accepted and ready to land.Mar 18 2018, 9:39 PM
mkazantsev added inline comments.Mar 18 2018, 9:40 PM
test/Analysis/ScalarEvolution/inner-loop-by-latch-cond-unknown.ll
1

Please add | FileCheck %s and CHECK-LABEL: @foo.

This revision was automatically updated to reflect the committed changes.