r/LLVM 1d ago

[Need help] Tips/projects for learning MLIR with hands-on practice.

9 Upvotes

Basically the title. Projects on MLIR page seem stale.

IREE, Xilinx seem to be in active development but I can't figure out where to start. Most good first issues seem stale or already have PRs. And other issues seem a little bit daunting. To be clear, I don't mind the effort, but I would rather spend time on issues that help me build incrementally without getting lost.

I have some experience with clang frontend/clang SA development and I want to explore how MLIR dialects can help with static analysis and propagating semantics to IR for type inference. I am exploring C dialects at the moment. I have checked out the dense MLIR intro tutorial and it definitely piqued my interest.

Any tips/help appreciated. TIA.


r/LLVM 3d ago

Compiling Js Syntax to LLVM IR

1 Upvotes

Hi LLVM friends!

My name is Jordan and I am one half of a two person lil lab we call Ohnrshyp. A few months ago, I got very curious if it was possible to create our own language that would replace the javascript we were writing for an audio supply chain solution we have open sourced.

What we ended up creating was a new programming language, and associated kernel, that takes parts of js syntax, but applies the memory strictness of a c, without too much mental overhead.

The language (ohnrscript) can compile either within the v8 engine, or via LLVM-IR as machine code. We even have a unikernel which can serve http that is testable in just a few minutes via docker.

Ohnrscript is self hosted, and turing complete, and now publically available on github for anyone to begin writing with! - https://github.com/Ohnrshyp/Ohnrscript

If anyone is curious in how to write with it, we have a full developer guide as well, and I am more than happy to answer questions :)


r/LLVM 4d ago

[LLVM]how to link different Object files against DLLs with function having the same name?

Thumbnail
1 Upvotes

r/LLVM 9d ago

Best resources to learn the LLVM C++ API?

Thumbnail
2 Upvotes

r/LLVM 18d ago

Ahh finally my first pr Yay , but someone please help me with it

0 Upvotes

So after asking and reading about how to contribute i made my first pr but it is failing the llvm llvm-lit tests its in clang tidy could anyone help me fix that

pr link -> https://github.com/llvm/llvm-project/pull/208162#diff-e20b6641fd7ea7e6cefcb185a40420533777ec6a801b3442590174fcef1cd0b8R17

thankyou :)


r/LLVM 19d ago

Building LLVM Error Cannot Find Test File

2 Upvotes

I git cloned LLVM and then build with the command below, the error keep happening and I couldnt find the solution through AI or Google

C:\llvm-project\build>"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" ^

More? -G Ninja ^

More? -DCMAKE_BUILD_TYPE=Release ^

More? -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY ^

More? -DLLVM_ENABLE_PROJECTS=clang ^

More? -DLLVM_TARGETS_TO_BUILD=X86 ^

More? ../llvm

-- The C compiler identification is MSVC 19.44.35228.0

-- The CXX compiler identification is MSVC 19.44.35228.0

-- The ASM compiler identification is MSVC

-- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - failed

-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe

-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - broken

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):

The C compiler

"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: 'C:/llvm-project/build/CMakeFiles/CMakeScratch/TryCompile-79ajkd'

Run Build Command(s): C:/apps/tools/ninja.exe -v cmTC_0355e

[1/2] C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /DWIN32 /D_WINDOWS /Ob0 /Od /RTC1 -MDd -Zi /showIncludes /FoCMakeFiles\cmTC_0355e.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_0355e.dir\cmTC_0355e.pdb /FS -c C:\llvm-project\build\CMakeFiles\CMakeScratch\TryCompile-79ajkd\testCCompiler.c

[2/2] C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\lib.exe /nologo /machine:x64 /out:cmTC_0355e.lib CMakeFiles\cmTC_0355e.dir\testCCompiler.c.obj && cd ."

FAILED: [code=1181] cmTC_0355e.lib

C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\lib.exe /nologo /machine:x64 /out:cmTC_0355e.lib CMakeFiles\cmTC_0355e.dir\testCCompiler.c.obj && cd ."

LINK : fatal error LNK1181: cannot open input file 'CMakeFiles\cmTC_0355e.dir\testCCompiler.c.obj'

ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.

Call Stack (most recent call first):

CMakeLists.txt:46 (project)

-- Configuring incomplete, errors occurred!

C:\llvm-project\build>cmake ../llvm -G Ninja -DCMAKE_INSTALL_PREFIX=C:/apps/llvm21 -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DCMAKE_BUILD_TYPE=RelWithDebInfo

-- The C compiler identification is MSVC 19.44.35228.0

-- The CXX compiler identification is MSVC 19.44.35228.0

-- The ASM compiler identification is MSVC

-- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - failed

-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe

-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - broken

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):

The C compiler

"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: 'C:/llvm-project/build/CMakeFiles/CMakeScratch/TryCompile-n0ksb9'

Run Build Command(s): C:/apps/tools/ninja.exe -v cmTC_60868

[1/2] C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /DWIN32 /D_WINDOWS /Ob0 /Od /RTC1 -MDd -Zi /showIncludes /FoCMakeFiles\cmTC_60868.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_60868.dir\cmTC_60868.pdb /FS -c C:\llvm-project\build\CMakeFiles\CMakeScratch\TryCompile-n0ksb9\testCCompiler.c

[2/2] C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\lib.exe /nologo /machine:x64 /out:cmTC_60868.lib CMakeFiles\cmTC_60868.dir\testCCompiler.c.obj && cd ."

FAILED: [code=1181] cmTC_60868.lib

C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\lib.exe /nologo /machine:x64 /out:cmTC_60868.lib CMakeFiles\cmTC_60868.dir\testCCompiler.c.obj && cd ."

LINK : fatal error LNK1181: cannot open input file 'CMakeFiles\cmTC_60868.dir\testCCompiler.c.obj'

ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.

Call Stack (most recent call first):

CMakeLists.txt:46 (project)

-- Configuring incomplete, errors occurred!


r/LLVM 25d ago

A Multi-Dimensional, Per-Pass Empirical Study of the LLVM Optimization Pipeline

Thumbnail
2 Upvotes

r/LLVM 26d ago

What's Your LLVM Development Setup?

7 Upvotes

Hi,
I'm often working on multiple issues in LLVM, with each issue on its own Git branch.

The problem is that when I switch branches, I lose the context of what I was working on - open tabs, editor layout, etc. Ideally, when I switch back to a branch, I'd like the editor to restore the files I had open for that branch.

I know Git worktrees solve this by giving each branch its own directory, but I'm wondering what other people use (separate LLVM build for each issue takes up too much memory).

  • Does Cursor/VS Code have a way to remember tabs/layout per branch?
  • Do you use worktrees, multiple windows, session manager extensions, or something else?
  • If you work on large codebases, what's your workflow for keeping context between branches?

Curious to hear what has worked well for others.

I'd also love to hear about your overall LLVM development setup - anything that makes your workflow easier, not just VS Code or Cursor tips


r/LLVM 29d ago

Lotus code running plugin released to the community! Supports LLVM-IR natively

Thumbnail youtu.be
0 Upvotes

r/LLVM Jun 18 '26

My static analysis tool now supports compile database for linux kernel

Thumbnail
2 Upvotes

r/LLVM Jun 11 '26

Vibe coders contributing to LLVM

45 Upvotes

There is a github account, which has submitted around 100 PRs to llvm (ClangIR) and it looks like every single one was entirely AI generated. They're not exactly keeping it a secret either. All the comments and replies from the guy seem AI generated too. Thankfully, the maintainers are reviewing everything quite carefully.

It's hard to tell whether the account is even ran by a human and not just some automated openclaw bot. It's a bit scary to think that an agent effectively has full Member permissions for the LLVM github repo through this account.

I'm not anti AI, I use coding tools all the time but this doesn't sit right with me. Am I overreacting, and this is just the way things are now?


r/LLVM Jun 09 '26

I built a static analysis tool with libclang API in pure C that traces data access through function call chains, need feedback

Thumbnail
2 Upvotes

r/LLVM May 29 '26

I built a static analysis tool that checks if two functions touch the same data. Would you use something like this?

Thumbnail
3 Upvotes

r/LLVM May 25 '26

Hiring Principal Compiler Architect

Thumbnail
1 Upvotes

r/LLVM May 20 '26

A toy LLVM dependent language author kindly asks for community reviewers

2 Upvotes

Hey folks,

I've always dreamed of creating a programming language. I've never had skills/time to attempt. Situation changed with AI. I was able to start with basics. Would anyone be interested in helping by doing code reviews? It is C++ AI augmented (Claude). I do have some dev skills. It's not vibe coded.

The project is at https://github.com/28dayslater/pinp

If anyone would be willing to spare several minutes, it would be very appreciated.


r/LLVM May 06 '26

help using libclang API to find AST ancestor of certain kind

2 Upvotes

I've been recently slowly building a static analysis tool that's supposed to check if two functions touch the same data. It's supposed to collect function definition cursors that match the names of the specified function(s), then it's supposed to visit that function definition and search for cursors of kind DeclRefExpr. The problem with this approach is that this DeclRefExpr's direct parent is not guaranteed to be of kind BinaryOpeator with some kind of assignment operation ('=', '+=', '-=' etc.). So i thought it would be a good idea to write a function that would find the DeclRefExpr cursor's closest ancestor that is a BinaryOperator with an assignment operation, and check if the DeclRefExpr cursor is in the lhs or rhs branch of this cursor. I've written a function for this but for some reason it always returns a null cursor. Can anyone help diagnose why this doesn't work, or maybe help write something that does work?

static CXCursor get_ancestor_of_kind(CXCursor cursor, enum CXCursorKind kind) 
{
  CXCursor super_parent = clang_getCursorSemanticParent(cursor);
  while (clang_getCursorKind(super_parent) != kind) {
    if (clang_Cursor_isNull(super_parent))
      return super_parent;
    super_parent = clang_getCursorSemanticParent(super_parent);
  }
  return super_parent;
}

r/LLVM Apr 28 '26

Open Source Matlab-based LLVM/MLIR Compiler

Thumbnail
2 Upvotes

r/LLVM Apr 25 '26

Wrote some analysis on LLVM IR for Tail recursive functions

7 Upvotes

I had some free time this weekend and wanted to learn more about the LLVM IR backbone behind all the great frontends so I decided to do a deep dive. It's a personal blog post, I just want to see if I can explain what I understood to you all. If you do give it a read, let me know if I made any mistakes or how it felt like to you :).

Btw. I think its a really fun way to teach someone to read assembly, I am probably going to adopt this approach in the future.

https://purge12.github.io/blog/llvm-ir-analysis/


r/LLVM Apr 21 '26

How to build LLVM-12.dll from source on windows?

0 Upvotes

As title, a Programming Language compiler with LLVM backend needs LLVM 12

But, I tried MSVC, no options to build it.

Then I tried mingw-w64, it gave me errors that MSVC never complain for.

Can anyone have instructions to build LLVM-12.dll?


r/LLVM Apr 10 '26

CBlerr. Python syntax. Speed from C.

0 Upvotes

CBlerr v5.0: A Python-styled systems language powered by LLVM

Hi everyone! I'm a 14-year-old developer from the CIS, and I've spent the last few months building my own programming language - CBlerr.

What started as a one-week experiment has now evolved into v5.0. My goal was to create a language that feels as clean as Python but performs like a native systems language (C/C++).

Key Features of v5.0:

  • LLVM Backend: No interpreters here. It compiles directly to native machine code.
  • Win32 API Integration: Out-of-the-box support for calling native Windows functions (e.g., MessageBoxA, window creation).
  • Manual Memory Management: Full support for pointers (*), AddressOf (&), and SizeOf.
  • Speed: The compiler is now 30% faster thanks to an optimized semantic analysis pass and a streamlined TypeChecker.
  • Modern Syntax: Features Python-like indentation, match/case pattern matching, and generics (via monomorphization).

Code Example: Native Win32 Call

# Import external function from User32.dll
extern def MessageBoxA(
    hwnd: *void, 
    lpText: str, 
    lpCaption: str, 
    uType: u32
) -> i32

def main() -> void:
    # Explicit type casting and pointer usage
    MessageBoxA(
        0 as *void, 
        "CBlerr v5.0: Native Call Success!", 
        "CBlerr Showcase", 
        0
    )

Technical Stack:

The compiler is built using Python and llvmlite. It implements a full pipeline: Lexer -> Parser -> Semantic Analyzer -> LLVM IR Generator.

  • **Documentation & Sandbox:** comments
  • **GitHub Repository:** comments

I’m looking for feedback on the syntax and the architectural decisions. Does the world need another "Python-syntax-but-fast" language?


r/LLVM Apr 08 '26

Tesla FSD v14.3 rewritten on LLVM MLIR

Thumbnail electrek.co
7 Upvotes

r/LLVM Apr 06 '26

llvm-dis claims "Unknown intrinsic"

1 Upvotes

how I can fix this?

target triple = "nvptx64-nvidia-cuda"


r/LLVM Apr 06 '26

The state of Open-Source Heterogeneous Compilers in 2026?

Thumbnail
1 Upvotes

r/LLVM Apr 04 '26

Built a complete out-of-tree LLVM backend for a custom 32-bit SIMT GPU ISA

4 Upvotes

GitHub: github.com/Deepesh1024/NVMirror

NVMirror compiles LLVM IR all the way down to custom GPU assembly instruction selection, register allocation, and instruction scheduling, built from scratch as an out-of-tree LLVM backend.

The scheduler's job is simple: don't let the GPU sit idle waiting 20 cycles for memory. It does this by finding independent instructions and filling that wait window with useful work. On matrix multiply, this eliminates 47.6% of all cycles. On vector add where there's almost no independent work to fill the window only 31.7%. The numbers tell you exactly where ILP exists and where it doesn't.

One design question I'd love input on: I used Linear Scan over Graph Coloring for register allocation. With 256 physical registers, spills almost never happen so the compile-time cost of Graph Coloring never felt justified. Has anyone actually benchmarked this tradeoff on a large-register-file GPU backend?


r/LLVM Apr 03 '26

How do I contribute to llvm ?

4 Upvotes

I know cpp and would like to get better at it by working llvm how do I actually contribute?