[PATCH] D142551: [InstCombine] Teach isDeadPHICycle to look through multiple uses

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 08:10:18 PST 2023


luke added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:1443
-      return replaceInstUsesWith(PN, PoisonValue::get(PN.getType()));
-    }
     // When a PHI is used only to be compared with zero, it is safe to replace
----------------
This is now covered by isDeadPHICycle


================
Comment at: llvm/test/Transforms/InstCombine/fmul.ll:396-400
   %local_var_7.0 = phi <4 x float> [ %mul, %entry ], [ %2, %for.body ]
   br i1 %c1, label %for.body, label %for.end
 
 for.body:                                         ; preds = %for.cond
   %2 = insertelement <4 x float> %local_var_7.0, float 0.000000e+00, i32 2
----------------
Looks like a dead cycle to me. I presume it's now detected because it `isDeadPHICycle` can look through arbitrary instructions now


================
Comment at: llvm/test/Transforms/InstCombine/pr27703.ll:16
 bb206:
-  ret void
+  ret ptr %t2
 ; CHECK: phi
----------------
Otherwise a dead phi cycle is detected here and the phi is removed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142551



More information about the llvm-commits mailing list