This is an archive of the discontinued LLVM Phabricator instance.

[WIP][InstCombine] See if we can determine the value of a use based on a dominating condition
AbandonedPublic

Authored by mcrosier on Jul 7 2017, 1:42 PM.

Details

Reviewers
None
Summary

Test case:

int dataflow(int b) {
  int a;

  if (b==4)
    a = 3*b; // fully optimized when a is simplified to a constant;
  else 
    a = 5;

  if (a == 4)
    return 0;
  else
    return 1;
}

As an example, we can replace the use of 'b' in 'a = 3 * b' with '4', which then allows the function to simplify to just 'return 1'.

This is just something I quickly threw together. If anyone has interest in this I can add test cases and submit for formal review.

Chad

Diff Detail

Event Timeline

mcrosier created this revision.Jul 7 2017, 1:42 PM
mcrosier edited the summary of this revision. (Show Details)Jul 7 2017, 1:47 PM
mcrosier edited the summary of this revision. (Show Details)
mcrosier edited the summary of this revision. (Show Details)
mcrosier abandoned this revision.Jul 9 2017, 9:13 AM