This is an archive of the discontinued LLVM Phabricator instance.

[DA] Fix assertion with loop exiting variables
Needs ReviewPublic

Authored by dmgreen on Apr 27 2018, 10:20 AM.

Details

Summary

Given code like:

for(i = ...)
  A[i] = 1;
A[i] = 2;

The scev for A[i]=2 is {A,+,4}<for>, even though it is outside the loop. This
can confuse DA into thinking it is in the loop, leading to it using a SIV test,
and asserting.

Diff Detail

Event Timeline

dmgreen created this revision.Apr 27 2018, 10:20 AM

There may be a better way to fix this using getSCEVAtScope around line 3358, but my scev-fu isn't particularly strong and I'm still seeing asserts from it.