[PATCH] D94934: [llvm] Prevent infinite loop in InstCombine of select statements

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 01:32:16 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa003f26539cf: [llvm] Prevent infinite loop in InstCombine of select statements (authored by Tres Popp <tpopp at google.com>).

Changed prior to commit:
  https://reviews.llvm.org/D94934?vs=317422&id=317485#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94934

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
@@ -1123,7 +1123,7 @@
     // else. Only do this if CmpRHS is a constant, as profitability is not
     // clear for other cases.
     // FIXME: The replacement could be performed recursively.
-    if (isa<Constant>(CmpRHS) && !isa<ConstantExpr>(CmpRHS))
+    if (match(CmpRHS, m_ImmConstant()) && !match(CmpLHS, m_ImmConstant()))
       if (auto *I = dyn_cast<Instruction>(TrueVal))
         if (I->hasOneUse())
           for (Use &U : I->operands())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94934.317485.patch
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210119/e6e475f0/attachment.bin>


More information about the llvm-commits mailing list