[llvm-commits] [llvm] r51171 - in /llvm/trunk: lib/VMCore/Instructions.cpp test/Verifier/2002-11-05-GetelementptrPointers.ll
Dan Gohman
gohman at apple.com
Thu May 15 17:16:32 PDT 2008
Author: djg
Date: Thu May 15 19:16:32 2008
New Revision: 51171
URL: http://llvm.org/viewvc/llvm-project?rev=51171&view=rev
Log:
Revert the change from r51157 in
test/Verifier/2002-11-05-GetelementptrPointers.ll, which was incorrect.
Instead, fix getIndexedType to not follow pointer types, as
PointerType is a subclass of CompositeType.
Modified:
llvm/trunk/lib/VMCore/Instructions.cpp
llvm/trunk/test/Verifier/2002-11-05-GetelementptrPointers.ll
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=51171&r1=51170&r2=51171&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Thu May 15 19:16:32 2008
@@ -1336,7 +1336,7 @@
unsigned CurIdx = 0;
for (; CurIdx != NumIdx; ++CurIdx) {
const CompositeType *CT = dyn_cast<CompositeType>(Agg);
- if (!CT) return 0;
+ if (!CT || isa<PointerType>(CT)) return 0;
Value *Index = Idxs[CurIdx];
if (!CT->indexValid(Index)) return 0;
Agg = CT->getTypeAtIndex(Index);
Modified: llvm/trunk/test/Verifier/2002-11-05-GetelementptrPointers.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/2002-11-05-GetelementptrPointers.ll?rev=51171&r1=51170&r2=51171&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/2002-11-05-GetelementptrPointers.ll (original)
+++ llvm/trunk/test/Verifier/2002-11-05-GetelementptrPointers.ll Thu May 15 19:16:32 2008
@@ -1,7 +1,7 @@
-; RUN: llvm-as < %s
+; RUN: not llvm-as < %s |& grep {Invalid getelementptr indices}
-; This testcase was previously considered invalid for indexing into a pointer
-; that is contained WITHIN a structure, but this is now valid.
+; This testcase is invalid because we are indexing into a pointer that is
+; contained WITHIN a structure.
define void @test({i32, i32*} * %X) {
getelementptr {i32, i32*} * %X, i32 0, i32 1, i32 0
More information about the llvm-commits
mailing list