[PATCH] D78112: [AbstractCallSite] Check that callback callee index is within call arguments

Sergey Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 09:39:58 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc1a9dd9aea49: [AbstractCallSite] Check that callback callee index is within call arguments (authored by sdmitriev).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78112/new/

https://reviews.llvm.org/D78112

Files:
  llvm/lib/IR/AbstractCallSite.cpp
  llvm/test/Transforms/OpenMP/rtf_type_checking.ll


Index: llvm/test/Transforms/OpenMP/rtf_type_checking.ll
===================================================================
--- llvm/test/Transforms/OpenMP/rtf_type_checking.ll
+++ llvm/test/Transforms/OpenMP/rtf_type_checking.ll
@@ -1,4 +1,5 @@
 ; 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"
Index: llvm/lib/IR/AbstractCallSite.cpp
===================================================================
--- llvm/lib/IR/AbstractCallSite.cpp
+++ llvm/lib/IR/AbstractCallSite.cpp
@@ -48,7 +48,8 @@
     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);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78112.257382.patch
Type: text/x-patch
Size: 1053 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200414/2d8a3f4c/attachment.bin>


More information about the llvm-commits mailing list