[PATCH] D104618: [LoopDeletion] Exploit undef Phi inputs when symbolically executing 1st iteration

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 00:45:01 PDT 2021


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Scalar/LoopDeletion.cpp:263
         Value *Incoming = PN.getIncomingValueForBlock(Pred);
+        // Skip undefs. If they are present, we can assume they equal to the
+        // non-undef input.
----------------
nit: they are equal


================
Comment at: llvm/test/Transforms/LoopDeletion/eval_first_iteration.ll:744
 ; CHECK:       if.true:
 ; CHECK-NEXT:    br i1 undef, label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
 ; CHECK:       if.true.1:
----------------
It would be good to replace these `br i1 undef` by `br i1 %c1` where `%c1` is an arg, to avoid making the code UB.


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

https://reviews.llvm.org/D104618



More information about the llvm-commits mailing list