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

Steffen Larsen via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 23:09:03 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:

I wonder if we could name `canCastToPtrOrVectorPtr` in a way that makes it usable bi-directionally. That is, could we make it "this type can be cast to and from ptr or vec ptr"?

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


More information about the llvm-commits mailing list