[llvm] [SROA] Improve select folding around casts (PR #222466)

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 05:35:05 PDT 2026


================
@@ -1911,8 +1917,7 @@ static Value *getAdjustedPtr(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr,
   if (Offset != 0)
     Ptr = IRB.CreateInBoundsPtrAdd(Ptr, IRB.getInt(Offset),
                                    NamePrefix + "sroa_idx");
-  return IRB.CreatePointerBitCastOrAddrSpaceCast(Ptr, PointerTy,
-                                                 NamePrefix + "sroa_cast");
+  return IRB.CreateAddrSpaceCast(Ptr, PointerTy, NamePrefix + "sroa_cast");
----------------
yxsamliu wrote:

This looks like an NFC cleanup with opaque pointers and does not seem needed for the select-folding change. Could we leave it out or move it to a separate patch to keep this PR focused?

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


More information about the llvm-commits mailing list