[PATCH] D101375: [InstCombine] Add a few more patterns for folding select of select

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 30 05:47:33 PDT 2021


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2706
+        match(FalseVal, m_Zero())) {
+      auto Res = isImpliedCondition(TrueVal, B, DL);
+      if (Res && *Res == false)
----------------
Better to make the type explicit here and the next block, so it is obvious:
  Optional<bool> Res = isImpliedCondition...


================
Comment at: llvm/test/Transforms/InstCombine/select-safe-transforms.ll:156
   %x_inv = icmp sle i37 %a, %b
   %y = icmp ugt i37 %c, 42      ; thwart complexity-based ordering
   %or = select i1 %y, i1 true, i1 %x
----------------
How is this test different than the one above it?
Is the comment about complexity-based ordering copy/pasted here? I'm not seeing why it is necessary in these tests (could we just pass in an i1 argument to the function?).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101375



More information about the llvm-commits mailing list