[llvm-commits] [llvm] r104756 - in /llvm/trunk: lib/Analysis/Lint.cpp test/Other/lint.ll
Dan Gohman
gohman at apple.com
Wed May 26 15:21:25 PDT 2010
Author: djg
Date: Wed May 26 17:21:25 2010
New Revision: 104756
URL: http://llvm.org/viewvc/llvm-project?rev=104756&view=rev
Log:
Reinstate checking of stackrestore, with checking for both Read
and Write, and add a comment explaining this.
Modified:
llvm/trunk/lib/Analysis/Lint.cpp
llvm/trunk/test/Other/lint.ll
Modified: llvm/trunk/lib/Analysis/Lint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Lint.cpp?rev=104756&r1=104755&r2=104756&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/Lint.cpp (original)
+++ llvm/trunk/lib/Analysis/Lint.cpp Wed May 26 17:21:25 2010
@@ -285,6 +285,14 @@
visitMemoryReference(I, CS.getArgument(0), 0, 0,
MemRef::Read | MemRef::Write);
break;
+
+ case Intrinsic::stackrestore:
+ // Stackrestore doesn't read or write memory, but it sets the
+ // stack pointer, which the compiler may read from or write to
+ // at any time, so check it for both readability and writeability.
+ visitMemoryReference(I, CS.getArgument(0), 0, 0,
+ MemRef::Read | MemRef::Write);
+ break;
}
}
Modified: llvm/trunk/test/Other/lint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/lint.ll?rev=104756&r1=104755&r2=104756&view=diff
==============================================================================
--- llvm/trunk/test/Other/lint.ll (original)
+++ llvm/trunk/test/Other/lint.ll Wed May 26 17:21:25 2010
@@ -2,6 +2,7 @@
target datalayout = "e-p:64:64:64"
declare fastcc void @bar()
+declare void @llvm.stackrestore(i8*)
@CG = constant i32 7
@@ -50,6 +51,8 @@
%lb = load i32* bitcast (i8* blockaddress(@foo, %next) to i32*)
; CHECK: Call to block address
call void()* bitcast (i8* blockaddress(@foo, %next) to void()*)()
+; CHECK: Undefined behavior: Null pointer dereference
+ call void @llvm.stackrestore(i8* null)
br label %next
More information about the llvm-commits
mailing list