[PATCH] D92739: [ValueTracking] Branch on poison is UB

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 17 19:40:14 PST 2021


aqjune added a comment.

I agree SCEV/ScalarEvolutionExpander is okay, but the problem is that when combined with other illegal optimizations SCEV may answer incorrectly in the end. For example:

  i = 0;
  do {
    i++
    if (false) {
      if(i <= n) { .. }
    }
  } while(do_continue());
  
  => // SimplifyCFG + (select i1 -> and)
  
  i = 0;
  do {
    i++ // SCEV may analyze i as <nsw>
    if (and false, (i <= n)) { .. } // .. because i cannot be poison by the condition here
  } while(do_continue());


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92739/new/

https://reviews.llvm.org/D92739



More information about the llvm-commits mailing list