From f8848a81494046e63ec0ca3609f53d7cbf305729 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 16 Jun 2015 01:20:53 +0000 Subject: [PATCH] Revert 239795 I forgot to update some clang test cases. I'll fix and resubmit tomorrow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239800 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/CallSite.h | 4 -- .../InstCombine/InstCombineCalls.cpp | 18 -------- test/CodeGen/NVPTX/intrin-nocapture.ll | 2 +- test/Transforms/Inline/byval-tail-call.ll | 2 +- test/Transforms/InstCombine/nonnull-param.ll | 42 ------------------- test/Transforms/InstCombine/select.ll | 2 +- 6 files changed, 3 insertions(+), 67 deletions(-) delete mode 100644 test/Transforms/InstCombine/nonnull-param.ll diff --git a/include/llvm/IR/CallSite.h b/include/llvm/IR/CallSite.h index 1da025f802f..170d263dfc7 100644 --- a/include/llvm/IR/CallSite.h +++ b/include/llvm/IR/CallSite.h @@ -27,7 +27,6 @@ #define LLVM_IR_CALLSITE_H #include "llvm/ADT/PointerIntPair.h" -#include "llvm/ADT/iterator_range.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/CallingConv.h" #include "llvm/IR/Instructions.h" @@ -151,9 +150,6 @@ public: } IterTy arg_end() const { return (*this)->op_end() - getArgumentEndOffset(); } - iterator_range args() const { - return iterator_range(arg_begin(), arg_end()); - } bool arg_empty() const { return arg_end() == arg_begin(); } unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); } diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index 85270cfca3b..e83b9dd36ae 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1391,24 +1391,6 @@ static IntrinsicInst *FindInitTrampoline(Value *Callee) { // visitCallSite - Improvements for call and invoke instructions. // Instruction *InstCombiner::visitCallSite(CallSite CS) { - - // Mark any parameters that are known to be non-null with the nonnull - // attribute. This is helpful for inlining calls to functions with null - // checks on their arguments. - unsigned ArgNo = 0; - for (Value *V : CS.args()) { - if (!CS.paramHasAttr(ArgNo+1, Attribute::NonNull) && - isKnownNonNull(V)) { - AttributeSet AS = CS.getAttributes(); - AS = AS.addAttribute(CS.getInstruction()->getContext(), ArgNo+1, - Attribute::NonNull); - CS.setAttributes(AS); - return CS.getInstruction(); - } - ArgNo++; - } - assert(ArgNo == CS.arg_size() && "sanity check"); - if (isAllocLikeFn(CS.getInstruction(), TLI)) return visitAllocSite(*CS.getInstruction()); diff --git a/test/CodeGen/NVPTX/intrin-nocapture.ll b/test/CodeGen/NVPTX/intrin-nocapture.ll index 2dbd29f616f..55781bb15a0 100644 --- a/test/CodeGen/NVPTX/intrin-nocapture.ll +++ b/test/CodeGen/NVPTX/intrin-nocapture.ll @@ -11,7 +11,7 @@ declare i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32*) ; CHECK: @bar define void @bar() { %t1 = alloca i32 -; CHECK: call i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32* nonnull %t1) +; CHECK: call i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32* %t1) ; CHECK-NEXT: store i32 10, i32* %t1 %t2 = call i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32* %t1) store i32 10, i32* %t1 diff --git a/test/Transforms/Inline/byval-tail-call.ll b/test/Transforms/Inline/byval-tail-call.ll index 7553b76cf15..1e50463ed80 100644 --- a/test/Transforms/Inline/byval-tail-call.ll +++ b/test/Transforms/Inline/byval-tail-call.ll @@ -33,7 +33,7 @@ define void @frob(i32* %x) { ; CHECK: %[[POS:.*]] = alloca i32 ; CHECK: %[[VAL:.*]] = load i32, i32* %x ; CHECK: store i32 %[[VAL]], i32* %[[POS]] -; CHECK: {{^ *}}call void @ext(i32* nonnull %[[POS]] +; CHECK: {{^ *}}call void @ext(i32* %[[POS]] ; CHECK: tail call void @ext(i32* null) ; CHECK: ret void tail call void @qux(i32* byval %x) diff --git a/test/Transforms/InstCombine/nonnull-param.ll b/test/Transforms/InstCombine/nonnull-param.ll deleted file mode 100644 index d9a84ee47cd..00000000000 --- a/test/Transforms/InstCombine/nonnull-param.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: opt -S -instcombine < %s | FileCheck %s - -declare void @callee(i8* %arg) - -; Positive test - arg is known non null -define void @test(i8* nonnull %arg) { -; CHECK-LABEL: @test -; CHECK: call void @callee(i8* nonnull %arg) - call void @callee(i8* %arg) - ret void -} - - -; Negative test - arg is not known to be non null -define void @test2(i8* %arg) { -; CHECK-LABEL: @test2 -; CHECK: call void @callee(i8* %arg) - call void @callee(i8* %arg) - ret void -} - -declare void @callee2(i8*, i8*, i8*) - -; Sanity check arg indexing -define void @test3(i8* %arg1, i8* nonnull %arg2, i8* %arg3) { -; CHECK-LABEL: @test3 -; CHECK: call void @callee2(i8* %arg1, i8* nonnull %arg2, i8* %arg3) - call void @callee2(i8* %arg1, i8* %arg2, i8* %arg3) - ret void -} - -; Because of the way CallSite::paramHasAttribute looks at the callee -; directly, we will not set the attribute on the CallSite. That's -; fine as long as all consumers use the same check. -define void @test4(i8* nonnull %arg) { -; CHECK-LABEL: @test4 -; CHECK: call void @test4(i8* %arg) - call void @test4(i8* %arg) - ret void -} - - diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll index 8be247228b8..27e487b4815 100644 --- a/test/Transforms/InstCombine/select.ll +++ b/test/Transforms/InstCombine/select.ll @@ -1265,7 +1265,7 @@ define i32 @test77(i1 %flag, i32* %x) { ; load does. ; CHECK-LABEL: @test77( ; CHECK: %[[A:.*]] = alloca i32, align 1 -; CHECK: call void @scribble_on_i32(i32* nonnull %[[A]]) +; CHECK: call void @scribble_on_i32(i32* %[[A]]) ; CHECK: store i32 0, i32* %x ; CHECK: %[[P:.*]] = select i1 %flag, i32* %[[A]], i32* %x ; CHECK: load i32, i32* %[[P]] -- 2.34.1