[PATCH] D84003: [InstCombine] Fix replace select with Phis when branch has the same labels

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 00:05:25 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc98988107868: [InstCombine] Fix replace select with Phis when branch has the same labels (authored by mkazantsev).

Changed prior to commit:
  https://reviews.llvm.org/D84003?vs=278664&id=278667#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84003

Files:
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp


Index: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2469,6 +2469,10 @@
   } else
     return nullptr;
 
+  // Make sure the branches are actually different.
+  if (TrueSucc == FalseSucc)
+    return nullptr;
+
   // We want to replace select %cond, %a, %b with a phi that takes value %a
   // for all incoming edges that are dominated by condition `%cond == true`,
   // and value %b for edges dominated by condition `%cond == false`. If %a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84003.278667.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200717/ce8c96a8/attachment.bin>


More information about the llvm-commits mailing list