[PATCH] D52671: [InstCombine] Skip merging non-free GEP

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 28 15:07:19 PDT 2018


efriedma added a comment.

Do you have perf/size numbers?

I'm sort of confused that MachineCSE doesn't trigger on your testcase, but that isn't really relevant here, I guess.



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1681
+    if (isa<Instruction>(Src) && !Src->hasOneUse() &&
+        TTI.getUserCost(Src) != TargetTransformInfo::TCC_Free) {
+      BasicBlock *CurBB = GEP.getParent();
----------------
For array GEPs, we have a check to try to make sure we aren't making a GEP more expensive (see EndsWithSequential etc.)  Maybe instead of adding a different kind of check, it would make more sense to extend the existing check to struct GEPs?


https://reviews.llvm.org/D52671





More information about the llvm-commits mailing list