[llvm] [IPSCCP][FuncSpec] Protect against metadata access from call args. (PR #124284)

Alexandros Lamprineas via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 09:50:37 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))
----------------
labrinea wrote:

Then should the isa<MetadataAsValue>(V) be moved inside findConstantFor?
```
if (isa<MetadataAsValue>(V))
  return nullptr;
if (auto *C = dyn_cast<Constant>(V))
  return C;
...
```
Would a metadata operand be possible to appear in anything else other than a call? If not, then let's leave it as is.

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


More information about the llvm-commits mailing list