[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 10:55:11 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:
That sounds like a bit of a contradiction still, since bitcast iN to byte to ptr is valid but bitcast iN to ptr isn't legal, so looking through bitcast seems to become illegal, which seems a bigger structural change. Sorry this is probably not a good place to reopen that discussion, but I'd have thought that LLVM would need to instead go with permitting inttoptr to allow byte type inputs, to avoid pre-existing passes, which currently step through bitcast as noops, silently becoming unsound.
https://github.com/llvm/llvm-project/pull/222049
More information about the llvm-commits
mailing list