[llvm] 4c56086 - [AbstractCallSite][FIX] Correct faulty assertion

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 23:23:06 PDT 2019


Author: Johannes Doerfert
Date: 2019-11-02T01:22:41-05:00
New Revision: 4c56086f8b458bbe8300b0cbd59baaf46ea38d7c

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

LOG: [AbstractCallSite][FIX] Correct faulty assertion

When the Attributor run on the IPConstantProp test case for multiple
callbacks it triggered a faulty assertion in the AbstractCallSite
implementation. The callee can well be at argument position 0.

Added: 
    

Modified: 
    llvm/include/llvm/IR/CallSite.h
    llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/CallSite.h b/llvm/include/llvm/IR/CallSite.h
index 13b1ae8d0e32..60f656e7a273 100644
--- a/llvm/include/llvm/IR/CallSite.h
+++ b/llvm/include/llvm/IR/CallSite.h
@@ -850,7 +850,7 @@ class AbstractCallSite {
   /// callee of this ACS. Only valid for callback calls!
   int getCallArgOperandNoForCallee() const {
     assert(isCallbackCall());
-    assert(CI.ParameterEncoding.size() && CI.ParameterEncoding[0] > 0);
+    assert(CI.ParameterEncoding.size() && CI.ParameterEncoding[0] >= 0);
     return CI.ParameterEncoding[0];
   }
 

diff  --git a/llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll b/llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll
index 3288b5b94de1..0d1df8dff52f 100644
--- a/llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll
+++ b/llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -ipconstprop -S < %s | FileCheck %s
+; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s
 ;
 ;
 ;                            /---------------------------------------|


        


More information about the llvm-commits mailing list