[PATCH] D38085: Use the basic cost if a GEP is not used as addressing mode

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 09:11:46 PDT 2017


junbuml added a comment.

In my tests for spec2000/2006/2017 on aarch64 with -O3, I didn't see any significant performance regressions, and the code size change was minor.



================
Comment at: test/Analysis/CostModel/X86/vector_gep.ll:11
   %vector = shufflevector <4 x i64> %temp, <4 x i64> undef, <4 x i32> zeroinitializer
-;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds %struct.S
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds %struct.S
   %B = getelementptr inbounds %struct.S, <4 x %struct.S*> %s, <4 x i32> zeroinitializer, <4 x i32> zeroinitializer
----------------
With this patch, %B is changed to a non-free because it's used in %arrayidx (non-memory operation). It might be possible to continue checking users of the non-memory operation users, but doing this completely must be expensive to be done in getGEPCost.  It might be possible to add some simple exceptions, but in this patch I didn't add such checks.


https://reviews.llvm.org/D38085





More information about the llvm-commits mailing list