Skip to content

Commit

Permalink
don't reverse on older llvm
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwight Guth committed Sep 27, 2021
1 parent 5ad632e commit 8f468f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/llvm/EmitGCLayoutInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,19 @@ struct EmitGCLayoutInfo : public ModulePass {
IDPos,
ConstantInt::get(GCSI->getArgOperand(IDPos)->getType(), id));
unsigned int nrelocs = S->gc_args_end() - S->gc_args_begin();
unsigned int i = nrelocs - 1;
#if LLVM_VERSION_MAJOR >= 11
unsigned int i = nrelocs - 1;
for (auto &R : S->getGCRelocates()) {
#define increment i--
#else
unsigned int i = 0;
for (auto &R : S->getRelocates()) {
#define increment i++
#endif
auto Arg = R->getBasePtr();
auto *Ty = Arg->getType()->getPointerElementType();
if (Ty->isIntegerTy()) {
i--;
increment;
continue;
}
if (!Ty->isStructTy()) {
Expand Down Expand Up @@ -89,7 +92,7 @@ struct EmitGCLayoutInfo : public ModulePass {
error(StructTy);
}
cats[std::make_pair(id, i)] = cat;
i--;
increment;
}
if (nrelocs > numRelocations) {
numRelocations = nrelocs;
Expand Down

0 comments on commit 8f468f6

Please sign in to comment.