Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4538,6 +4538,9 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
if (!Indices.empty() && !Ty->isSized(&Visited))
return error(ID.Loc, "base element of getelementptr must be sized");

if (!ConstantExpr::isSupportedGetElementPtr(Ty))
return error(ID.Loc, "invalid base element for constant getelementptr");

if (!GetElementPtrInst::getIndexedType(Ty, Indices))
return error(ID.Loc, "invalid getelementptr indices");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
; Test the case of an invalid pointee type on a constant GEP

; CHECK: invalid base element for constant getelementptr

define ptr @test_scalable_vector_gep(ptr %a) {
ret ptr getelementptr (<vscale x 1 x i8>, ptr @a, i64 1)
}