[llvm] r247371 - Revert "[InstCombineCalls] Use isKnownNonNullAt() to check nullness of passing arguments at callsite"

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 18:33:48 PDT 2015


Author: mehdi_amini
Date: Thu Sep 10 20:33:48 2015
New Revision: 247371

URL: http://llvm.org/viewvc/llvm-project?rev=247371&view=rev
Log:
Revert "[InstCombineCalls] Use isKnownNonNullAt() to check nullness of passing arguments at callsite"

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 at apple.com>

Removed:
    llvm/trunk/test/Transforms/InstCombine/call_nonnull_arg.ll
Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=247371&r1=247370&r2=247371&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu Sep 10 20:33:48 2015
@@ -1537,7 +1537,7 @@ Instruction *InstCombiner::visitCallSite
   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);

Removed: llvm/trunk/test/Transforms/InstCombine/call_nonnull_arg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/call_nonnull_arg.ll?rev=247370&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/call_nonnull_arg.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/call_nonnull_arg.ll (removed)
@@ -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
-}




More information about the llvm-commits mailing list