[llvm] [IRBuilder] Handle byte types in CreateBitPreservingCastChain (PR #209557)
Steffen Larsen via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 03:48:50 PDT 2026
================
@@ -139,8 +139,18 @@ Value *IRBuilderBase::CreateBitPreservingCastChain(const DataLayout &DL,
return CreateBitCast(In, Ty);
};
+ // Byte (and byte-vector) types are not integers, but like integers they can
+ // be reinterpreted as a pointer-sized integer before/after an inttoptr or
+ // ptrtoint step. Treat them the same as integers here so we never attempt a
+ // direct (and invalid) bitcast between a byte/integer aggregate and a
+ // pointer.
+ bool OldIsIntLike =
+ OldTy->isIntOrIntVectorTy() || OldTy->isByteOrByteVectorTy();
----------------
steffenlarsen wrote:
Since it is a common property of these two type-categories (ints and bytes) I lean towards having a new member in `Type`, like @vporpo suggests.
https://github.com/llvm/llvm-project/pull/209557
More information about the llvm-commits
mailing list