diff options
| author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-01 17:43:31 +0000 |
|---|---|---|
| committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-01 17:43:31 +0000 |
| commit | adf1c859dd38d5e0c6fb26e55c0cbde67e69d87e (patch) | |
| tree | 8aff1c8f18ef89a01f52be8ac6e190b9547ebfa1 /llvm/test/Transforms | |
| parent | bae683341931f72a1208cd27fd167daf6bfe1592 (diff) | |
| download | bcm5719-llvm-adf1c859dd38d5e0c6fb26e55c0cbde67e69d87e.tar.gz bcm5719-llvm-adf1c859dd38d5e0c6fb26e55c0cbde67e69d87e.zip | |
BoundsChecking: fix a bug when the handling of recursive PHIs failed and could leave dangling references in the cache
add regression tests for this problem.
Can already compile & run: PHP, PCRE, and ICU (i.e., all the software I tried)
llvm-svn: 157822
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/BoundsChecking/phi.ll | 48 | ||||
| -rw-r--r-- | llvm/test/Transforms/BoundsChecking/simple.ll | 2 |
2 files changed, 49 insertions, 1 deletions
diff --git a/llvm/test/Transforms/BoundsChecking/phi.ll b/llvm/test/Transforms/BoundsChecking/phi.ll new file mode 100644 index 00000000000..6c42ec815a9 --- /dev/null +++ b/llvm/test/Transforms/BoundsChecking/phi.ll @@ -0,0 +1,48 @@ +; RUN: opt < %s -bounds-checking -S | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" + +@global = private unnamed_addr constant [10 x i8] c"ola\00mundo\00", align 1 + +; CHECK: f1 +; no checks are possible here +; CHECK-NOT: trap +define void @f1(i8* nocapture %c) { +entry: + %0 = load i8* %c, align 1 + %tobool1 = icmp eq i8 %0, 0 + br i1 %tobool1, label %while.end, label %while.body + +while.body: + %c.addr.02 = phi i8* [ %incdec.ptr, %while.body ], [ %c, %entry ] + %incdec.ptr = getelementptr inbounds i8* %c.addr.02, i64 -1 + store i8 100, i8* %c.addr.02, align 1 + %1 = load i8* %incdec.ptr, align 1 + %tobool = icmp eq i8 %1, 0 + br i1 %tobool, label %while.end, label %while.body + +while.end: + ret void +} + + +; CHECK: f2 +define void @f2() { +while.body.i.preheader: + %addr = getelementptr inbounds [10 x i8]* @global, i64 0, i64 9 + br label %while.body.i + +while.body.i: +; CHECK: phi +; CHECK-NEXT: phi +; CHECK-NEXT: phi +; CHECK: trap + %c.addr.02.i = phi i8* [ %incdec.ptr.i, %while.body.i ], [ %addr, %while.body.i.preheader ] + %incdec.ptr.i = getelementptr inbounds i8* %c.addr.02.i, i64 -1 + store i8 100, i8* %c.addr.02.i, align 1 + %0 = load i8* %incdec.ptr.i, align 1 + %tobool.i = icmp eq i8 %0, 0 + br i1 %tobool.i, label %fn.exit, label %while.body.i + +fn.exit: + ret void +} diff --git a/llvm/test/Transforms/BoundsChecking/simple.ll b/llvm/test/Transforms/BoundsChecking/simple.ll index 162059fb34a..3d532c3cf3b 100644 --- a/llvm/test/Transforms/BoundsChecking/simple.ll +++ b/llvm/test/Transforms/BoundsChecking/simple.ll @@ -91,7 +91,7 @@ define void @f8() nounwind { define void @f9(i128* %arg) nounwind { %1 = alloca i128 %2 = select i1 undef, i128* %arg, i128* %1 -; CHECK: br i1 false +; CHECK-NOT: trap %3 = load i128* %2, align 4 ret void } |

