[PATCH] D35499: [InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 14:44:19 PDT 2017
sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.
lgtm with minor nits
================
Comment at: include/llvm/IR/Operator.h:475
+ unsigned getNumNonConstantIndices() const {
+ unsigned NumNonConstantIndices = 0;
----------------
I'd call this `countNonConstantIndices`.
================
Comment at: include/llvm/IR/Operator.h:477
+ unsigned NumNonConstantIndices = 0;
+ for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
+ if (!isa<ConstantInt>(I)) {
----------------
You can use `llvm::count_if` here.
================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1490
+ (NumNonConstantIndices2 > 0 && !GEP2->hasOneUse()))) {
+ DEBUG(dbgs() << "Rejected because ...\n");
+ return nullptr;
----------------
Please add a full sentence here, or remove it.
https://reviews.llvm.org/D35499
More information about the llvm-commits
mailing list