Skip to content

Commit 820c5d1

Browse files
authored
Merge pull request rust-lang#153 from vext01/unsupported
Reject `getelementptr` instructions we don't yet handle.
2 parents 55c5e9b + 7c6e662 commit 820c5d1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/IR/Instructions.h"
1414
#include "llvm/IR/Intrinsics.h"
1515
#include "llvm/IR/Module.h"
16+
#include "llvm/IR/Operator.h"
1617
#include "llvm/MC/MCContext.h"
1718
#include "llvm/MC/MCSectionELF.h"
1819
#include "llvm/MC/MCStreamer.h"
@@ -632,6 +633,19 @@ class YkIRWriter {
632633

633634
void serialiseGetElementPtrInst(GetElementPtrInst *I, FuncLowerCtxt &FLCtxt,
634635
unsigned BBIdx, unsigned &InstIdx) {
636+
// We yet don't support:
637+
// - the `inrange` keyword.
638+
// - the vector variant.
639+
//
640+
// It appears that `inrange` can't appear in a GEP *instruction* (only a
641+
// GEP expression, inline in another instruction), but we check for it
642+
// anyway.
643+
if ((cast<GEPOperator>(I)->getInRangeIndex() != nullopt) ||
644+
(I->getPointerOperand()->getType()->isVectorTy())) {
645+
serialiseUnimplementedInstruction(I, FLCtxt, BBIdx, InstIdx);
646+
return;
647+
}
648+
635649
// opcode:
636650
serialiseOpcode(OpCodePtrAdd);
637651
// type_idx:

0 commit comments

Comments
 (0)