Summary:
AbstractCallSite::getCallbackUses() does not check that callback callee index from
the callback metadata does not exceed the total number of call arguments. This patch
add such validation check.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Subscribers: hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78112
auto *CBCalleeIdxAsCM = cast<ConstantAsMetadata>(OpMD->getOperand(0));
uint64_t CBCalleeIdx =
cast<ConstantInt>(CBCalleeIdxAsCM->getValue())->getZExtValue();
- CBUses.push_back(ICS.arg_begin() + CBCalleeIdx);
+ if (CBCalleeIdx < ICS.arg_size())
+ CBUses.push_back(ICS.arg_begin() + CBCalleeIdx);
}
}
; RUN: opt -S -openmpopt -stats < %s 2>&1 | FileCheck %s
+; RUN: opt -S -attributor -attributor-disable=false -openmpopt -stats < %s 2>&1 | FileCheck %s
; REQUIRES: asserts
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"