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

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 13:37:38 PDT 2016


sebpop updated this revision to Diff 71873.
sebpop added a comment.

Updated patch to only filter out TerminatorInst.
As I was mentioning, the other instructions are rare, and we would spend more time in isa<>() than allowing these instructions to be discarded after computing a VN.


https://reviews.llvm.org/D23929

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

Index: llvm/lib/Transforms/Scalar/GVNHoist.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/lib/Transforms/Scalar/GVNHoist.cpp
@@ -913,7 +913,8 @@
             break;
 
           CI.insert(Call, VN);
-        } else if (HoistingGeps || !isa<GetElementPtrInst>(&I1))
+        } else if (!isa<TerminatorInst>(&I1) &&
+                   (HoistingGeps || !isa<GetElementPtrInst>(&I1)))
           // Do not hoist scalars past calls that may write to memory because
           // that could result in spills later. geps are handled separately.
           // TODO: We can relax this for targets like AArch64 as they have more


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23929.71873.patch
Type: text/x-patch
Size: 698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160919/0022cffe/attachment.bin>


More information about the llvm-commits mailing list