[llvm] [Inliner] Fix bug where attributes are propagated incorrectly (PR #109347)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 19:23:16 PDT 2024


================
@@ -1477,6 +1483,12 @@ static void AddReturnAttributes(CallBase &CB, ValueToValueMapTy &VMap) {
     auto *NewRetVal = dyn_cast_or_null<CallBase>(VMap.lookup(RetVal));
     if (!NewRetVal)
       continue;
+
+    // The RetVal might have be simplified during the inlining
+    // process. Only propagate return attributes if we are in fact calling the
+    // same function.
+    if (RetVal->getCalledFunction() != NewRetVal->getCalledFunction())
----------------
goldsteinn wrote:

Or we could just disable the simplifyInstruction on callbases

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


More information about the llvm-commits mailing list