summaryrefslogtreecommitdiffstats
path: root/llvm/test/Other
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-30 19:05:00 +0000
committerDan Gohman <gohman@apple.com>2010-04-30 19:05:00 +0000
commit299e7b93ac96ebad71829987a355094bd1d59bdd (patch)
tree433fe4dde980dd35a5b094f377566beebeaadc43 /llvm/test/Other
parent14cf752486f3589d110b4dfd7ff985d44d18da3a (diff)
downloadbcm5719-llvm-299e7b93ac96ebad71829987a355094bd1d59bdd.tar.gz
bcm5719-llvm-299e7b93ac96ebad71829987a355094bd1d59bdd.zip
Add lint checks for invalid uses of memory.
llvm-svn: 102733
Diffstat (limited to 'llvm/test/Other')
-rw-r--r--llvm/test/Other/lint.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/Other/lint.ll b/llvm/test/Other/lint.ll
index 8658495c971..d0db5e46c66 100644
--- a/llvm/test/Other/lint.ll
+++ b/llvm/test/Other/lint.ll
@@ -3,6 +3,8 @@ target datalayout = "e-p:64:64:64"
declare fastcc void @bar()
+@CG = constant i32 7
+
define i32 @foo() noreturn {
; CHECK: Caller and callee calling convention differ
call void @bar()
@@ -39,6 +41,16 @@ define i32 @foo() noreturn {
%xx = xor i32 undef, undef
; CHECK: sub(undef, undef)
%xs = sub i32 undef, undef
+
+; CHECK: Write to read-only memory
+ store i32 8, i32* @CG
+; CHECK: Write to text section
+ store i32 8, i32* bitcast (i32()* @foo to i32*)
+; CHECK: Load from block address
+ %lb = load i32* bitcast (i8* blockaddress(@foo, %next) to i32*)
+; CHECK: Call to block address
+ call void()* bitcast (i8* blockaddress(@foo, %next) to void()*)()
+
br label %next
next:
@@ -64,3 +76,9 @@ define void @not_vararg(i8* %p) nounwind {
call void @llvm.va_start(i8* %p)
ret void
}
+
+define void @use_indbr() {
+ indirectbr i8* bitcast (i32()* @foo to i8*), [label %block]
+block:
+ unreachable
+}
OpenPOWER on IntegriCloud