[llvm] 19bd4ef - [Attributor] Properly use the call site argument position

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 16:23:43 PDT 2020


Author: Johannes Doerfert
Date: 2020-08-17T18:21:09-05:00
New Revision: 19bd4ef157a85aee0f6302165dd3eec9b341524a

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

LOG: [Attributor] Properly use the call site argument position

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    llvm/test/Transforms/Attributor/undefined_behavior.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 2e8d3f6774d5..762d4a111515 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -2019,8 +2019,7 @@ struct AAUndefinedBehaviorImpl : public AAUndefinedBehavior {
         Value *ArgVal = CB.getArgOperand(idx);
         if (!ArgVal || !ArgVal->getType()->isPointerTy())
           continue;
-        IRPosition CalleeArgumentIRP =
-            IRPosition::argument(*Callee->getArg(idx));
+        IRPosition CalleeArgumentIRP = IRPosition::callsite_argument(CB, idx);
         if (!CalleeArgumentIRP.hasAttr({Attribute::NoUndef}))
           continue;
         auto &NonNullAA = A.getAAFor<AANonNull>(*this, CalleeArgumentIRP);

diff  --git a/llvm/test/Transforms/Attributor/undefined_behavior.ll b/llvm/test/Transforms/Attributor/undefined_behavior.ll
index 1c99488ccb31..22c2979e23de 100644
--- a/llvm/test/Transforms/Attributor/undefined_behavior.ll
+++ b/llvm/test/Transforms/Attributor/undefined_behavior.ll
@@ -1032,8 +1032,7 @@ declare void @callee_ptr_arg(i32*)
 
 define void @callsite_noundef_2() {
 ; CHECK-LABEL: define {{[^@]+}}@callsite_noundef_2()
-; CHECK-NEXT:    call void @callee_ptr_arg(i32* noundef undef)
-; CHECK-NEXT:    ret void
+; CHECK-NEXT:    unreachable
 ;
   call void @callee_ptr_arg(i32* noundef undef)
   ret void


        


More information about the llvm-commits mailing list