[llvm] [sroa][profcheck] Propagate profile in `unfoldGEPSelect` (PR #163318)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 08:25:44 PDT 2025


================
@@ -4383,8 +4391,12 @@ class AggLoadStoreRewriter : public InstVisitor<AggLoadStoreRewriter, bool> {
         IRB.CreateGEP(Ty, FalseOps[0], ArrayRef(FalseOps).drop_front(),
                       False->getName() + ".sroa.gep", NW);
 
-    Value *NSel =
-        IRB.CreateSelect(Cond, NTrue, NFalse, Sel->getName() + ".sroa.sel");
+    Value *NSel = MDFrom
+                      ? IRB.CreateSelect(Cond, NTrue, NFalse,
+                                         Sel->getName() + ".sroa.sel", MDFrom)
+                      : IRB.CreateSelectWithUnknownProfile(
+                            Cond, NTrue, NFalse, DEBUG_TYPE,
+                            Sel->getName() + ".sroa.sel");
----------------
nikic wrote:

We shouldn't do this. In profcheck mode MDFrom will be non-null, and otherwise we don't care.

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


More information about the llvm-commits mailing list