[PATCH] D157613: [Clang][ExtendLifetimes][3/4] Add -fextend-lifetimes flag to Clang to extend the lifetime of local variables

Stephen Tozer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 5 07:09:41 PDT 2023


StephenTozer added inline comments.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:3492-3499
+        // Ignore fake uses and the instructions that load their
+        // operands.
+        if (Intrinsic->getIntrinsicID() == llvm::Intrinsic::fake_use) {
+          const llvm::Value *FakeUseArg = Intrinsic->getArgOperand(0);
+          if (++II == IE || &*II != FakeUseArg)
+            break;
+          continue;
----------------
jmorse wrote:
> It's a bit ugly to switch away from having a range-based loop, am I right in thinking this is because you need to skip the load-to-fake-use? Annoying but necessary I guess. Could I request an explicit "II = std::next(II);" though to really ram home to the reader that we're skipping an extra instruction, using the pre-increment is liable to be missed, and we're not trying to be super-concise here IMO.
> 
> The addition of the "I" variable looks like it might be un-necessary, that's only _used_ by GetStoreIfValid which has a domination assignment above it no?
> Annoying but necessary I guess.

Probably not necessary actually - the addition of an extra variable could cover this case without removing the for-range.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157613



More information about the cfe-commits mailing list