[PATCH] D155718: [InstCombine] Remove unneeded isa<PHINode> check in foldOpIntoPhi

Dhruv Chawla via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 08:42:21 PDT 2023


0xdc03 created this revision.
0xdc03 added a reviewer: nikic.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
0xdc03 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This check is redundant as it is covered by the call to
isPotentiallyReachable.

It also fixes a regression in D154064 <https://reviews.llvm.org/D154064> where icmps in some cases do not get
folded into phi nodes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155718

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


Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1297,7 +1297,6 @@
       continue;
     }
 
-    if (isa<PHINode>(InVal)) return nullptr;  // Itself a phi.
     if (NonSimplifiedBB) return nullptr;  // More than one non-simplified value.
 
     NonSimplifiedBB = InBB;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155718.542048.patch
Type: text/x-patch
Size: 479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230719/0786eb03/attachment.bin>


More information about the llvm-commits mailing list