[PATCH] D23929: GVN-hoist: only hoist relevant scalar instructions

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 07:54:28 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL282160: GVN-hoist: only hoist relevant scalar instructions (authored by spop).

Changed prior to commit:
  https://reviews.llvm.org/D23929?vs=71873&id=72173#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23929

Files:
  llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
  llvm/trunk/test/Transforms/GVNHoist/hoist-recursive-geps.ll

Index: llvm/trunk/test/Transforms/GVNHoist/hoist-recursive-geps.ll
===================================================================
--- llvm/trunk/test/Transforms/GVNHoist/hoist-recursive-geps.ll
+++ llvm/trunk/test/Transforms/GVNHoist/hoist-recursive-geps.ll
@@ -8,9 +8,9 @@
 ; CHECK: load
 ; CHECK: load
 ; CHECK: fsub
-; CHECK: fmul
 ; CHECK: fsub
 ; CHECK: fmul
+; CHECK: fmul
 ; CHECK-NOT: fsub
 ; CHECK-NOT: fmul
 
Index: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
@@ -891,6 +891,10 @@
         if (MaxDepthInBB != -1 && InstructionNb++ >= MaxDepthInBB)
           break;
 
+        // Do not value number terminator instructions.
+        if (!isa<TerminatorInst>(&I1))
+          break;
+
         if (auto *Load = dyn_cast<LoadInst>(&I1))
           LI.insert(Load, VN);
         else if (auto *Store = dyn_cast<StoreInst>(&I1))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23929.72173.patch
Type: text/x-patch
Size: 1012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160922/eb433968/attachment.bin>


More information about the llvm-commits mailing list