Skip to content

Commit

Permalink
don't load element before checking to see if it is valid.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134836 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Jul 9, 2011
1 parent 145ab10 commit bda2065
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/VMCore/ConstantFold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2172,9 +2172,9 @@ static Constant *ConstantFoldGetElementPtrImpl(Constant *C,
bool inBounds,
IndexTy const *Idxs,
unsigned NumIdx) {
if (NumIdx == 0) return C;
Constant *Idx0 = cast<Constant>(Idxs[0]);
if (NumIdx == 0 ||
(NumIdx == 1 && Idx0->isNullValue()))
if ((NumIdx == 1 && Idx0->isNullValue()))
return C;

if (isa<UndefValue>(C)) {
Expand Down

0 comments on commit bda2065

Please sign in to comment.