[llvm] [DirectX] Make dx.RawBuffer an op that can't be replaced (PR #154620)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 14:00:11 PDT 2025


farzonl wrote:

> > This looks good to me. Please wait to hear back from @nikic on whether we should do the isTokenLikeTy() refactoring before or after this change.
> 
> I'd like the usages in the IR verifier to be adjusted, and an IR verifier test added that errors when using such a type in a phi node.
> 
> I don't think we need to replace other uses at this time.

@bogner  can you verify if these are all case we would not weant a Raw or Typed Buffer?
1. llvm/lib/IR/Verifier.cpp:3009:      Check(!Arg.getType()->isTokenTy(),

`Function takes token but isn't an intrinsic`
example:
```
define void @f(token %A) {
entry:
  ret void
}
```

2. llvm/lib/IR/Verifier.cpp:3023:    Check(!F.getReturnType()->isTokenTy(),
`Function returns a token but isn't an intrinsic`
example:
```
define token @f() {
entry:
  ret token undef
}
```
3. llvm/lib/IR/Verifier.cpp:3637:  Check(!PN.getType()->isTokenTy(), "PHI nodes cannot have token type!");

Obviously this one is a yes we don't want Raw or Type buffers in PHI nodes

4. llvm/lib/IR/Verifier.cpp:3842:      Check(!ParamTy->isTokenTy(),
`Function has token parameter but isn't an intrinsic`

There was no test case for this one.

5. llvm/lib/IR/Verifier.cpp:3849:    Check(!FTy->getReturnType()->isTokenTy(),

`Return type cannot be token for indirect call!`
example
```
define void @f() {
entry:
  call token () undef ()
  ret void
}
```

https://github.com/llvm/llvm-project/pull/154620


More information about the llvm-commits mailing list