projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
145ab10
)
don't load element before checking to see if it is valid.
author
Chris Lattner
<sabre@nondot.org>
Sat, 9 Jul 2011 18:23:26 +0000
(18:23 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Sat, 9 Jul 2011 18:23:26 +0000
(18:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134836
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/VMCore/ConstantFold.cpp
patch
|
blob
|
history
diff --git
a/lib/VMCore/ConstantFold.cpp
b/lib/VMCore/ConstantFold.cpp
index 2c8f430176369fe4888f1f9cd804c4c2248bef28..adbf7fc08bc74da016a153da0fb024d7c0257ccd 100644
(file)
--- a/
lib/VMCore/ConstantFold.cpp
+++ b/
lib/VMCore/ConstantFold.cpp
@@
-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)) {