aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2020-08-17 18:17:17 -0500
committerJohannes Doerfert <johannes@jdoerfert.de>2020-08-17 18:21:09 -0500
commit19bd4ef157a85aee0f6302165dd3eec9b341524a (patch)
tree1ff0931ab60fb36af1aaae4882e43081761add4d
parent5dfc207c5352e606e20399d9e15b2ade2922c0d2 (diff)
downloadllvm-19bd4ef157a85aee0f6302165dd3eec9b341524a.zip
llvm-19bd4ef157a85aee0f6302165dd3eec9b341524a.tar.gz
llvm-19bd4ef157a85aee0f6302165dd3eec9b341524a.tar.bz2
[Attributor] Properly use the call site argument position
-rw-r--r--llvm/lib/Transforms/IPO/AttributorAttributes.cpp3
-rw-r--r--llvm/test/Transforms/Attributor/undefined_behavior.ll3
2 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 2e8d3f6..762d4a1 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 1c99488..22c2979 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