Revert "[InstCombineCalls] Use isKnownNonNullAt() to check nullness of passing argume...
authorMehdi Amini <mehdi.amini@apple.com>
Fri, 11 Sep 2015 01:33:48 +0000 (01:33 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Fri, 11 Sep 2015 01:33:48 +0000 (01:33 +0000)
This reverts commit r247356.

Breaks test/Transforms/InstCombine/pr8547.ll with:

Wrong types for attribute: byval inalloca nest noalias nocapture nonnull readnone readonly sret dereferenceable(1) dereferenceable_or_null(1)
  %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 nonnull %conv2) #0
LLVM ERROR: Broken function found, compilation aborted!

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247371 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineCalls.cpp
test/Transforms/InstCombine/call_nonnull_arg.ll [deleted file]

index 900953af6c600765d442d4e54f716e921cf54d32..cc7d4be7a78063cbfab384f282609aa655bc307c 100644 (file)
@@ -1537,7 +1537,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
   unsigned ArgNo = 0;
   for (Value *V : CS.args()) {
     if (!CS.paramHasAttr(ArgNo+1, Attribute::NonNull) &&
   unsigned ArgNo = 0;
   for (Value *V : CS.args()) {
     if (!CS.paramHasAttr(ArgNo+1, Attribute::NonNull) &&
-        isKnownNonNullAt(V, CS.getInstruction(), DT, TLI)) {
+        isKnownNonNull(V)) {
       AttributeSet AS = CS.getAttributes();
       AS = AS.addAttribute(CS.getInstruction()->getContext(), ArgNo+1,
                            Attribute::NonNull);
       AttributeSet AS = CS.getAttributes();
       AS = AS.addAttribute(CS.getInstruction()->getContext(), ArgNo+1,
                            Attribute::NonNull);
diff --git a/test/Transforms/InstCombine/call_nonnull_arg.ll b/test/Transforms/InstCombine/call_nonnull_arg.ll
deleted file mode 100644 (file)
index cac53d3..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-; RUN: opt < %s -instcombine -S | FileCheck %s
-
-; InstCombine should mark null-checked argument as nonnull at callsite
-declare void @dummy(i32*)
-
-define void @test(i32* %a) {
-; CHECK-LABEL: @test
-; CHECK: call void @dummy(i32* nonnull %a)
-entry:
-  %cond = icmp eq i32* %a, null
-  br i1 %cond, label %is_null, label %not_null
-not_null:
-  call void @dummy(i32* %a)
-  ret void
-is_null:
-  unreachable
-}