[llvm] [ConstantFolding] Implement canConstantFoldCallTo() using TLI (PR #221903)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 01:01:35 PDT 2026


================
@@ -2010,9 +2010,13 @@ void SCCPInstVisitor::handleCallOverdefined(CallBase &CB) {
   if (CB.getType()->isStructTy())
     return (void)markOverdefined(&CB);
 
+  if (!F || !F->isDeclaration())
+    return (void)mergeInValue(ValueState[&CB], &CB, getValueFromMetadata(&CB));
+
----------------
artagnon wrote:

Change seems unnecessary, as there's already:

```cpp
  // Fall back to metadata.
  mergeInValue(ValueState[&CB], &CB, getValueFromMetadata(&CB));
```

at the end of the if?

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


More information about the llvm-commits mailing list