[PATCH] D141680: [GVN] Refactor findDominatingLoad function

Sergei Kachkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 09:37:02 PDT 2023


kachkov98 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:1123
+      // Stop the search if limit is reached.
+      if (++NumVisitedInsts > MaxNumVisitedInsts)
+        return nullptr;
----------------
uabelho wrote:
> This limit and the fact that we iterate over all instructions in the BB (including debug instructions/intrinsics) unfortunately makes GVN behave in different ways depending on if we have debug information present or not.
> 
> This can be seen with
>  opt "-passes=gvn" bbi-86242.ll -S -o -
> {F29187866}
> 
> If we remove the debug intrinsics from the input we see that GVN does more changes than with the debug stuff present
> (the input can probably be reduced a lot if we pass -gvn-max-num-visited-insts=<something small> to opt).
Thank you for the report! I've created PR to fix it: https://github.com/llvm/llvm-project/pull/65977


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141680/new/

https://reviews.llvm.org/D141680



More information about the llvm-commits mailing list