[llvm] [IRBuilder][GlobalISel] Add byte ptr cast support in IRBuilder (PR #222049)
Jameson Nash via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 09:47:07 PDT 2026
================
@@ -140,9 +146,7 @@ Value *IRBuilderBase::CreateBitPreservingCastChain(const DataLayout &DL,
};
// See if we need inttoptr for this type pair. May require additional bitcast.
- bool OldIsIntLike =
- OldTy->isIntOrIntVectorTy() || OldTy->isByteOrByteVectorTy();
- if (OldIsIntLike && NewTy->isPtrOrPtrVectorTy()) {
+ if (OldTy->isIntOrIntVectorTy() && NewTy->isPtrOrPtrVectorTy()) {
----------------
vtjnash wrote:
I think the more correct check here is that inttoptr is needed whenever it is changing from not a pointer to a pointer (easier than trying to hardcodw a list of all non-pointer things):
```suggestion
if (!OldTy->isPtrOrPtrVectorTy() && NewTy->isPtrOrPtrVectorTy()) {
```
(And the same below. Following https://github.com/llvm/llvm-project/pull/186835/changes#diff-7b9ae5c1774880299e98d0bd713f6d0b881a6f70ad31ce5603ea6275fecf8a42R142)
https://github.com/llvm/llvm-project/pull/222049
More information about the llvm-commits
mailing list