[llvm] [IRBuilder][GlobalISel] Add byte ptr cast support in IRBuilder (PR #222049)
Anshil Gandhi via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 10:46:22 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()) {
----------------
gandhi56 wrote:
Yup, that's a contradiction in the langref. There was a discussion on implementing the `bytecast` instruction to cast byte -> other types (and I think the reverse as well). Based on the discussion on discourse, only the byte type can be casted to a ptr type via a bitcast. For ints, inttoptr would still be necessary.
https://github.com/llvm/llvm-project/pull/222049
More information about the llvm-commits
mailing list