[PATCH] D137944: [ObjC][ARC] Teach the OptimizeSequences step of ObjCARCOpts about WinEH funclet tokens

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 11:57:39 PST 2022


rnk added a comment.

I can't say I'm familiar with ARC, but this seems right to me.



================
Comment at: llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:767
+    const ColorVector &CV = BlockColors.find(BB)->second;
+    assert(CV.size() == 1 && "non-unique color for block!");
+    BasicBlock *EHPadBB = CV.front();
----------------
I don't think the verifier changes you made guarantee this. I would consider strengthening this to `report_fatal_error`, since valid IR transforms can probably reach this code.


================
Comment at: llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:2040-2041
+  DenseMap<BasicBlock *, ColorVector> BlockColors;
+  if (F.hasPersonalityFn() &&
+      isScopedEHPersonality(classifyEHPersonality(F.getPersonalityFn())))
+    BlockColors = colorEHFunclets(F);
----------------
I think this code snippet probably deserves a Function helper, `F->hasScopedEHPersonality()`. Another part of me thinks we should cache the personality enum similar to the way we cache intrinsic ids, but I wouldn't want to increase Function memory usage, so that seems premature. "No action required", I guess.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137944



More information about the llvm-commits mailing list