[PATCH] D148509: [BranchFolder] Skip redundant IMPLICIT_DEFs of subregs

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 03:25:06 PDT 2023


Pierre-vh added a comment.

I also like this solution but as I said on D148438 <https://reviews.llvm.org/D148438>, I don't feel like ResourceUsageAnalysis should have crashed anyway upon seeing a agpr_hi16 so I would argue that both D148438 <https://reviews.llvm.org/D148438> and this could go in (then just change D148438 <https://reviews.llvm.org/D148438> so it has an artificial MIR test with agpr_hi16)



================
Comment at: llvm/lib/CodeGen/BranchFolding.cpp:865
+        // Skip the register if we are about to add one of its super registers.
+        // TODO: Common this up with the same logic in addLineIns().
+        bool ContainsSuperReg = false;
----------------
IMO it's only worth merging the logic if in the end it yields less code/more understandable code. It's just a few lines of code here so I'm fine with either solution as long as this or D148438 goes in soon.


================
Comment at: llvm/lib/CodeGen/BranchFolding.cpp:866
+        // TODO: Common this up with the same logic in addLineIns().
+        bool ContainsSuperReg = false;
+        for (MCSuperRegIterator SReg(Reg, TRI); SReg.isValid(); ++SReg) {
----------------
small nit: isn't there a way to do this more succinctly with `any_of`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148509



More information about the llvm-commits mailing list