[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 17:53:06 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:
@nikic, the LangRef very literally says "It is always a no-op." today. I think I understand what you meant (I'm guessing it is because bitcasts cause poison to spread, so the optimizer can add bitcast to byte but not from byte), but this still sounds a fairly sweeping change to make because of the ptr-to-ptr legacy baggage.
(combining inttotpr/ptrtoint/bitcast sounds nice for eventually also solving this from the other direction, of just defining that all same-size casts are legal)
https://github.com/llvm/llvm-project/pull/222049
More information about the llvm-commits
mailing list