[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-07-06 Thread Weibo He via cfe-commits
https://github.com/NewSigma edited https://github.com/llvm/llvm-project/pull/144319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-07-04 Thread Weibo He via cfe-commits
@@ -0,0 +1,341 @@ +//===- LifetimeMove.cpp - Narrowing lifetimes -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-07-03 Thread Weibo He via cfe-commits
@@ -0,0 +1,341 @@ +//===- LifetimeMove.cpp - Narrowing lifetimes -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-06-29 Thread Weibo He via cfe-commits
NewSigma wrote: CI fail seems not related. I'm marking it ready for review because it works in my tests with ASAN enabled, both for coro code and non-coro code. The non-coro part should be landed in another PR if current patch looks good. https://github.com/llvm/llvm-project/pull/144319 _

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-06-29 Thread Weibo He via cfe-commits
https://github.com/NewSigma ready_for_review https://github.com/llvm/llvm-project/pull/144319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-06-24 Thread Weibo He via cfe-commits
https://github.com/NewSigma updated https://github.com/llvm/llvm-project/pull/144319 >From 584d47295f7719f96ee77d32a6b4329f82be Mon Sep 17 00:00:00 2001 From: NewSigma Date: Mon, 16 Jun 2025 15:36:53 +0800 Subject: [PATCH 01/10] Add LifetimeMovePass --- clang/test/CodeGenCoroutines/pr5691

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-06-22 Thread Weibo He via cfe-commits
https://github.com/NewSigma updated https://github.com/llvm/llvm-project/pull/144319 >From 584d47295f7719f96ee77d32a6b4329f82be Mon Sep 17 00:00:00 2001 From: NewSigma Date: Mon, 16 Jun 2025 15:36:53 +0800 Subject: [PATCH 1/9] Add LifetimeMovePass --- clang/test/CodeGenCoroutines/pr56919.

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-06-22 Thread Weibo He via cfe-commits
NewSigma wrote: RFC: https://discourse.llvm.org/t/rfc-add-lifetimemovepass/87005 https://github.com/llvm/llvm-project/pull/144319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-06-19 Thread Weibo He via cfe-commits
https://github.com/NewSigma updated https://github.com/llvm/llvm-project/pull/144319 >From 584d47295f7719f96ee77d32a6b4329f82be Mon Sep 17 00:00:00 2001 From: NewSigma Date: Mon, 16 Jun 2025 15:36:53 +0800 Subject: [PATCH 1/8] Add LifetimeMovePass --- clang/test/CodeGenCoroutines/pr56919.

[clang] [llvm] [Transforms] Add LifetimeMovePass (PR #144319)

2025-06-16 Thread Weibo He via cfe-commits
https://github.com/NewSigma edited https://github.com/llvm/llvm-project/pull/144319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LLVM][Coro] Add LifetimeMovePass (PR #144319)

2025-06-16 Thread Weibo He via cfe-commits
@@ -0,0 +1,223 @@ +//===- LifetimeMove.cpp - Narrowing lifetimes -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [LLVM][Coro] Add LifetimeMovePass (PR #144319)

2025-06-16 Thread Weibo He via cfe-commits
https://github.com/NewSigma updated https://github.com/llvm/llvm-project/pull/144319 >From 584d47295f7719f96ee77d32a6b4329f82be Mon Sep 17 00:00:00 2001 From: NewSigma Date: Mon, 16 Jun 2025 15:36:53 +0800 Subject: [PATCH 1/4] Add LifetimeMovePass --- clang/test/CodeGenCoroutines/pr56919.

[clang] [llvm] [LLVM][Coro] Add LifetimeMovePass (PR #144319)

2025-06-16 Thread Weibo He via cfe-commits
NewSigma wrote: cc @ChuanqiXu9 @nikic https://github.com/llvm/llvm-project/pull/144319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LLVM][Coro] Add LifetimeMovePass (PR #144319)

2025-06-16 Thread Weibo He via cfe-commits
https://github.com/NewSigma created https://github.com/llvm/llvm-project/pull/144319 As suggested by @ChuanqiXu9 in #14 , I propose LifetimeMovePass, which was previously part of the CoroSplit pass, should now appear as a general pass. Lifetime markers determine whether we place alloca on

[clang] [llvm] [CoroSplit] Rise lifetime.end to get smaller frame size (PR #143333)

2025-06-09 Thread Weibo He via cfe-commits
https://github.com/NewSigma closed https://github.com/llvm/llvm-project/pull/14 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CoroSplit] Rise lifetime.end to get smaller frame size (PR #143333)

2025-06-09 Thread Weibo He via cfe-commits
NewSigma wrote: Prefer make it a general pass https://github.com/llvm/llvm-project/pull/14 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CoroSplit] Rise lifetime.end to get smaller frame size (PR #143333)

2025-06-09 Thread Weibo He via cfe-commits
NewSigma wrote: It sounds interesting, though I still don’t have a clear idea about it. What are the benefits for non-coroutine code, and where exactly should we place it in the pipeline? https://github.com/llvm/llvm-project/pull/14 ___ cfe-commi

[clang] [llvm] [CoroSplit] Rise lifetime.end to get smaller frame size (PR #143333)

2025-06-08 Thread Weibo He via cfe-commits
https://github.com/NewSigma updated https://github.com/llvm/llvm-project/pull/14 >From 771ff1c9cc7d4b7f95d78d4219288d5c7ca0b83e Mon Sep 17 00:00:00 2001 From: NewSigma Date: Thu, 5 Jun 2025 21:51:06 +0800 Subject: [PATCH 1/2] Rise lifetime.end to get smaller frame size --- clang/test/Code

[clang] [llvm] [CoroSplit] Rise lifetime.end to get smaller frame size (PR #143333)

2025-06-08 Thread Weibo He via cfe-commits
https://github.com/NewSigma created https://github.com/llvm/llvm-project/pull/14 Lifetime markers determine whether we place alloca on the frame or on the stack. We can move `lifetime.end` to an optimized position to reduce the coroutine frame size. I propose finding the suspend point that

[clang] [Clang][CodeGen] Do not emit lifetime intrinsics for coro promise alloca (PR #140548)

2025-05-20 Thread Weibo He via cfe-commits
NewSigma wrote: After further consideration, I think this is not a satisfactory solution to the issue. I may revisit it if I develop a concrete plan. Apologies for any inconvenience. https://github.com/llvm/llvm-project/pull/140548 ___ cfe-commits ma

[clang] [Clang][CodeGen] Do not emit lifetime intrinsics for coro promise alloca (PR #140548)

2025-05-20 Thread Weibo He via cfe-commits
https://github.com/NewSigma closed https://github.com/llvm/llvm-project/pull/140548 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Do not emit lifetime intrinsics for coro promise alloca (PR #140548)

2025-05-19 Thread Weibo He via cfe-commits
@@ -1343,6 +1343,11 @@ llvm::Value *CodeGenFunction::EmitLifetimeStart(llvm::TypeSize Size, if (!ShouldEmitLifetimeMarkers) return nullptr; + // No lifetimes on promise alloca, or middle end passes will assume promise + // dead after lifetime.end, leading to mis-optim

[clang] [Clang][CodeGen] Do not emit lifetime intrinsics for coro promise alloca (PR #140548)

2025-05-19 Thread Weibo He via cfe-commits
https://github.com/NewSigma updated https://github.com/llvm/llvm-project/pull/140548 >From d2e1a8d8a650f2a38387c500f942a0c6722c8a84 Mon Sep 17 00:00:00 2001 From: NewSigma Date: Mon, 19 May 2025 22:12:45 +0800 Subject: [PATCH 1/2] Do not emit lifetime intrinsics for coro promise alloca --- cl

[clang] [Clang][CodeGen] Do not emit lifetime intrinsics for coro promise alloca (PR #140548)

2025-05-19 Thread Weibo He via cfe-commits
NewSigma wrote: Here is a example ``` LLVM define i32 @fn() { entry: %__promise = alloca i32, align 4 %id = call token @llvm.coro.id(i32 16, ptr nonnull %__promise, ptr nonnull @fn, ptr null) %hdl = call ptr @llvm.coro.begin(token %id, ptr null) #14 %promise.addr = call ptr @llvm.coro.p

[clang] [Clang][CodeGen] Do not emit lifetime intrinsics for coro promise alloca (PR #140548)

2025-05-19 Thread Weibo He via cfe-commits
https://github.com/NewSigma created https://github.com/llvm/llvm-project/pull/140548 Coro promise has same lifetime as coro frame. It do not need explicit lifetime guarding. If we add lifetimes to it, middle end passes may assume promise dead after lifetime.end, leading to mis-optimizations.