[llvm] a7cc275 - Add verifier check that musttail and preallocated are not used together

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 11:25:58 PDT 2020


Author: Arthur Eubanks
Date: 2020-05-18T11:24:59-07:00
New Revision: a7cc275e7e8ac21ddf1b6d74e3de013d9f88d016

URL: https://github.com/llvm/llvm-project/commit/a7cc275e7e8ac21ddf1b6d74e3de013d9f88d016
DIFF: https://github.com/llvm/llvm-project/commit/a7cc275e7e8ac21ddf1b6d74e3de013d9f88d016.diff

LOG: Add verifier check that musttail and preallocated are not used together

Summary:
Currently they are not supported together. Supporting them will require
a LangRef change. See discussion in https://reviews.llvm.org/D77689.

Reviewers: rnk, efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80132

Added: 
    

Modified: 
    llvm/lib/IR/Verifier.cpp
    llvm/test/Verifier/preallocated-invalid.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index ed211c5d0ca8..4d64af3e8de4 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -3150,6 +3150,9 @@ static AttrBuilder getParameterABIAttributes(int I, AttributeList Attrs) {
 
 void Verifier::verifyMustTailCall(CallInst &CI) {
   Assert(!CI.isInlineAsm(), "cannot use musttail call with inline asm", &CI);
+  // FIXME: support musttail + preallocated
+  Assert(!CI.countOperandBundlesOfType(LLVMContext::OB_preallocated),
+         "musttail and preallocated not yet supported", &CI);
 
   // - The caller and callee prototypes must match.  Pointer types of
   //   parameters or return types may 
diff er in pointee type, but not

diff  --git a/llvm/test/Verifier/preallocated-invalid.ll b/llvm/test/Verifier/preallocated-invalid.ll
index 770199d653a2..faa4c7a9fbfe 100644
--- a/llvm/test/Verifier/preallocated-invalid.ll
+++ b/llvm/test/Verifier/preallocated-invalid.ll
@@ -116,3 +116,10 @@ define void @preallocated_arg_token() {
     %x = call i8* @llvm.call.preallocated.arg(token %t, i32 1) preallocated(i32)
     ret void
 }
+
+; CHECK: musttail and preallocated not yet supported
+define void @musttail() {
+    %cs = call token @llvm.call.preallocated.setup(i32 0)
+    musttail call void @foo0() ["preallocated"(token %cs)]
+    ret void
+}


        


More information about the llvm-commits mailing list