[PATCH] D111237: [TypePromotion] Promote PHI + [SZ]Ext

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 01:53:00 PST 2021


samparker added a comment.

My knee jerk reaction is that this looks like a lot of code to add little functionality... the pass can already promote phis, so, IIUC, the only functional change is to enable the use of sign extends for their operands? If so, I don't really understand why this couldn't be added more gracefully into the existing search. My handwavey suggestion would be to search from SExt nodes (in the same manner as icmp, but with a search depth limit of 2), create a dedicated function to estimate the cost of promotion and modify the IRPromoter to enable sign extending some sources. Does any of that sound reasonable?



================
Comment at: llvm/lib/CodeGen/TypePromotion.cpp:1176
+  SmallPtrSet<PHINode *, 20> VisitedPHIs;
   for (BasicBlock &BB : F) {
     for (auto &I : BB) {
----------------
Can these new loops not just be fused into the original? When I originally wrote this, I treated phis the same as icmps, but admittedly didn't find any additional improvements.


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

https://reviews.llvm.org/D111237



More information about the llvm-commits mailing list