commit | 7d98b66e3d18c0f60e76e20f9ea444c66833b9ba | [log] [tgz] |
---|---|---|
author | Nathan Gauër <brioche@google.com> | Wed May 07 14:53:25 2025 +0000 |
committer | GitHub <noreply@github.com> | Wed May 07 16:53:25 2025 +0200 |
tree | 1fd881efe3b2bdb180b963c0b74323118d5625b2 | |
parent | 29e09aff633bee49ddb744558877b52be868a325 [diff] |
[SPIR-V] Add InferAddrSpaces pass to the backend (#137766) This commit enables a pass in the backend which propagates the addrspace of the pointers down to the last use, making sure the addrspace remains consistent, and thus stripping any addrspacecast. This is required to lower LLVM-IR to logical SPIR-V, which does not support generic pointers. This is now required as HLSL emits several address spaces, and thus addrspacecasts in some cases: Example 1: resource access ```llvm %handle = tail call target("spirv.VulkanBuffer", ...) %rptr = @llvm.spv.resource.getpointer(%handle, ...); %cptr = addrspacecast ptr addrspace(11) %rptr to ptr %fptr = load i32, ptr %cptr ``` Example 2: object methods ```llvm define void @objectMethod(ptr %this) { } define void @foo(ptr addrspace(11) %object) { call void @objectMethod(ptr addrspacecast(addrspace(11) %object to ptr)); } ```
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.