[all-commits] [llvm/llvm-project] c78f37: [CIR] Fix dominance problems with values defined i...

Andy Kaylor via All-commits all-commits at lists.llvm.org
Fri Feb 27 15:31:29 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c78f37fdebd852f567e6380382a8eda8a28f382f
      https://github.com/llvm/llvm-project/commit/c78f37fdebd852f567e6380382a8eda8a28f382f
  Author: Andy Kaylor <akaylor at nvidia.com>
  Date:   2026-02-27 (Fri, 27 Feb 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenCleanup.cpp
    M clang/lib/CIR/CodeGen/CIRGenExpr.cpp
    M clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp
    M clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
    M clang/lib/CIR/CodeGen/CIRGenFunction.h
    M clang/test/CIR/CodeGen/cleanup.cpp
    M clang/test/CIR/CodeGen/coro-task.cpp
    M clang/test/CIR/CodeGen/defaultarg.cpp
    M clang/test/CIR/CodeGen/dtors.cpp
    M clang/test/CIR/CodeGen/lambda-static-invoker.cpp
    M clang/test/CIR/CodeGen/stmt-expr.cpp
    M clang/test/CIR/CodeGen/struct.cpp

  Log Message:
  -----------
  [CIR] Fix dominance problems with values defined in cleanup scopes (#183810)

We currently encounter dominance verification errors when a value is
defined inside a cleanup scope but used outside the scope. This occurs
when forceCleanup() is used to exit a cleanup scope while a variable is
holding a value that was created in the scope body. Classic codegen
solved this problem by passing a list of values to spill and reload to
forceCleanup(). This change implements that same solution for CIR.

I have also aligned the ScalarExprEmitter::VisitExprWithCleanups
implementation with that of classic codegen, eliminating an extra
lexical scope. This causes temporary allocas to be created at the next
higher existing lexical scope, but I think that's OK since they would be
hoisted there anyway by a later pass.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list