[PATCH] D84601: [InstCombine] Fold freeze into phi if beneficial

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 26 14:37:43 PDT 2020


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1053
+    if (isa<Constant>(InVal) && !isa<ConstantExpr>(InVal) &&
+        (!isa<FreezeInst>(I) || !isa<UndefValue>(InVal)))
       continue;
----------------
Won't this let through something like a constant vector with one undef element? Maybe just use the usual guaranteed-not-undef query here?


================
Comment at: llvm/test/Transforms/InstCombine/freeze-phi.ll:171
   ret i32 %y.fr
 }
----------------
Can you also add a test with an all-constant phi, in which case the freeze will get dropped completely? I believe the code also handles that case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84601





More information about the llvm-commits mailing list