diff options
Diffstat (limited to 'lib/Transforms/Scalar/StraightLineStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/StraightLineStrengthReduce.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp index b5089b006bdd..a58c32cc5894 100644 --- a/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp +++ b/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp @@ -1,9 +1,8 @@ //===- StraightLineStrengthReduce.cpp - -----------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -683,9 +682,13 @@ void StraightLineStrengthReduce::rewriteCandidateWithBasis( // Canonicalize bump to pointer size. Bump = Builder.CreateSExtOrTrunc(Bump, IntPtrTy); if (InBounds) - Reduced = Builder.CreateInBoundsGEP(nullptr, Basis.Ins, Bump); + Reduced = Builder.CreateInBoundsGEP( + cast<GetElementPtrInst>(Basis.Ins)->getResultElementType(), + Basis.Ins, Bump); else - Reduced = Builder.CreateGEP(nullptr, Basis.Ins, Bump); + Reduced = Builder.CreateGEP( + cast<GetElementPtrInst>(Basis.Ins)->getResultElementType(), + Basis.Ins, Bump); } break; } |