Skip to content

Conversation

andykaylor
Copy link
Contributor

This fixes a problem where a rogue call to converter.addConversion inside of a type conversion lambda was causing memory corruption that (luckily!) triggered a test failure on some build platforms.

Near as I can tell, the unwanted addConversion call was the result of a bad rebase (by me). The code shouldn't have ever been there. Because the failure depends on the build environment, I can't find a reliable way to test this change.

This fixes a problem where a rogue call to converter.addConversion
inside of a type conversion lambda was causing memory corruption that
(luckily!) triggered a test failure on some build platforms.

Near as I can tell, the unwanted addConversion call was the result of a
bad rebase (by me). The code shouldn't have ever been there. Because the
failure depends on the build environment, I can't find a reliable way to
test this change.
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Sep 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 22, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clangir

Author: Andy Kaylor (andykaylor)

Changes

This fixes a problem where a rogue call to converter.addConversion inside of a type conversion lambda was causing memory corruption that (luckily!) triggered a test failure on some build platforms.

Near as I can tell, the unwanted addConversion call was the result of a bad rebase (by me). The code shouldn't have ever been there. Because the failure depends on the build environment, I can't find a reliable way to test this change.


Full diff: https://github.com/llvm/llvm-project/pull/160211.diff

1 Files Affected:

  • (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (-3)
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 1865698838134..1596ccb6a2617 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -2381,9 +2381,6 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter,
       }
       break;
     }
-    converter.addConversion([&](cir::VoidType type) -> mlir::Type {
-      return mlir::LLVM::LLVMVoidType::get(type.getContext());
-    });
 
     // Record has a name: lower as an identified record.
     mlir::LLVM::LLVMStructType llvmStruct;

Copy link
Contributor

@razvanlupusoru razvanlupusoru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this!

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@andykaylor andykaylor merged commit 01b60df into llvm:main Sep 23, 2025
12 checks passed
@andykaylor andykaylor deleted the cir-fix-typeconverter branch September 23, 2025 00:02
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 23, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building clang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/40137

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: 1200 seconds without output running [b'ninja', b'check-flang'], attempting to kill
...
PASS: Flang :: Transforms/DoConcurrent/skip_all_nested_loops.f90 (3828 of 3839)
PASS: Flang :: Transforms/debug-omp-target-op-1.fir (3829 of 3839)
PASS: Flang :: Transforms/verify-known-runtime-functions.fir (3830 of 3839)
PASS: Flang :: Driver/linker-flags.f90 (3831 of 3839)
PASS: Flang :: Transforms/tbaa3.fir (3832 of 3839)
PASS: Flang :: Transforms/tbaa-local-alloc-threshold.fir (3833 of 3839)
PASS: Flang :: Transforms/stack-arrays.f90 (3834 of 3839)
PASS: Flang :: Transforms/debug-dwarf-version.fir (3835 of 3839)
PASS: Flang :: Driver/omp-driver-offload.f90 (3836 of 3839)
PASS: Flang :: Driver/fopenmp.f90 (3837 of 3839)
command timed out: 1200 seconds without output running [b'ninja', b'check-flang'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=2325.713352

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants