[PATCH] D157264: [NewGVN] Use leader for instrinsics with the returned attribute

Manuel Brito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 02:39:18 PDT 2023


ManuelJBrito created this revision.
ManuelJBrito added reviewers: asbirlea, kmitropoulou.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ManuelJBrito requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Intrinsics with the returned attribute are copies of arguments, but those arguments might be equivalent to something. We this patch we now use lookupOperandLeader to try and find a leader for the returned value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157264

Files:
  llvm/lib/Transforms/Scalar/NewGVN.cpp


Index: llvm/lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1606,7 +1606,8 @@
       if (II->getIntrinsicID() == Intrinsic::ssa_copy)
         if (auto Res = performSymbolicPredicateInfoEvaluation(II))
           return Res;
-      return ExprResult::some(createVariableOrConstant(ReturnedValue));
+      return ExprResult::some(
+          createVariableOrConstant(lookupOperandLeader(ReturnedValue)));
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157264.547681.patch
Type: text/x-patch
Size: 559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230807/1d77679b/attachment.bin>


More information about the llvm-commits mailing list