Index: lib/Transforms/InstCombine/InstructionCombining.cpp =================================================================== --- lib/Transforms/InstCombine/InstructionCombining.cpp +++ lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1348,6 +1348,11 @@ // normalized. if (SO1->getType() != GO1->getType()) return nullptr; + + // Is it worth summing the offsets? + if (!isa(SO1)) + return nullptr; + Sum = Builder->CreateAdd(SO1, GO1, PtrOp->getName()+".sum"); }