[llvm] [IPSCCP][FuncSpec] Protect against metadata access from call args. (PR #124284)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 10:31:26 PST 2025
================
@@ -415,6 +415,8 @@ Constant *InstCostVisitor::visitCallBase(CallBase &I) {
for (unsigned Idx = 0, E = I.getNumOperands() - 1; Idx != E; ++Idx) {
Value *V = I.getOperand(Idx);
+ if (isa<MetadataAsValue>(V))
----------------
davemgreen wrote:
I was wondering that - but calls should be the most common place. For other operations like load / stores the metadata will be an extra operands, not one of the ones we are already looking at like the Value or Pointer.
I believe this is where they are excluded for normal SCCP: https://github.com/llvm/llvm-project/blob/544a3cb65b6b9b1455f9294d1764f47a7b8673b7/llvm/lib/Transforms/Utils/SCCPSolver.cpp#L1796
https://github.com/llvm/llvm-project/pull/124284
More information about the llvm-commits
mailing list