[llvm] [IRBuilder] Handle byte types in CreateBitPreservingCastChain (PR #209557)

Steffen Larsen via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 23:42:14 PDT 2026


================
@@ -149,7 +149,9 @@ Value *IRBuilderBase::CreateBitPreservingCastChain(const DataLayout &DL,
   }
 
   // See if we need ptrtoint for this type pair. May require additional bitcast.
-  if (OldTy->isPtrOrPtrVectorTy() && NewTy->isIntOrIntVectorTy()) {
+  bool NewIsIntLike =
+      NewTy->isIntOrIntVectorTy() || NewTy->isByteOrByteVectorTy();
----------------
steffenlarsen wrote:

`isIntToPtrCastable` still sounds mono-directional. Maybe something like `isCastableThroughInt{orIntPtr}` or `isIntCastBitPreserving`?

https://github.com/llvm/llvm-project/pull/209557


More information about the llvm-commits mailing list