diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-20 23:05:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-20 23:05:43 +0000 |
commit | 01533ff6526fd31ed4d5c9768dae65ccb1126d92 (patch) | |
tree | 00a334408ebac4e31d39c447dafcef75ec14bbfe /test | |
parent | b9a131e8a6dbd8f4d7e06267b0a2fa65c816b7fa (diff) | |
download | external_llvm-01533ff6526fd31ed4d5c9768dae65ccb1126d92.zip external_llvm-01533ff6526fd31ed4d5c9768dae65ccb1126d92.tar.gz external_llvm-01533ff6526fd31ed4d5c9768dae65ccb1126d92.tar.bz2 |
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/DSGraph/strcpy.ll | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/Analysis/DSGraph/strcpy.ll b/test/Analysis/DSGraph/strcpy.ll new file mode 100644 index 0000000..5ef59ae --- /dev/null +++ b/test/Analysis/DSGraph/strcpy.ll @@ -0,0 +1,34 @@ +; We know that strcpy cannot be used to copy pointer values, because +; pointers might contain null bytes and would stop the copy. The code +; has no defined way to check for this, so DSA can know that strcpy doesn't +; require merging the input arguments. + +; RUN: analyze %s -datastructure-gc --dsgc-abort-if-merged=A,B --dsgc-check-flags=A:SM,B:SR --dsgc-dspass=bu + +implementation + +internal void %strcpy(sbyte* %s1, sbyte* %s2) { +entry: + br label %loopentry + +loopentry: ; preds = %entry, %loopentry + %cann-indvar = phi uint [ 0, %entry ], [ %next-indvar, %loopentry ] ; <uint> [#uses=2] + %cann-indvar1 = cast uint %cann-indvar to long ; <long> [#uses=2] + %s1_addr.0 = getelementptr sbyte* %s1, long %cann-indvar1 ; <sbyte*> [#uses=1] + %s2_addr.0 = getelementptr sbyte* %s2, long %cann-indvar1 ; <sbyte*> [#uses=1] + %next-indvar = add uint %cann-indvar, 1 ; <uint> [#uses=1] + %tmp.3 = load sbyte* %s2_addr.0 ; <sbyte> [#uses=2] + store sbyte %tmp.3, sbyte* %s1_addr.0 + %tmp.4 = setne sbyte %tmp.3, 0 ; <bool> [#uses=1] + br bool %tmp.4, label %loopentry, label %loopexit + +loopexit: ; preds = %loopentry + ret void +} + +int %main() { + %A = alloca sbyte + %B = alloca sbyte + call void %strcpy(sbyte* %A, sbyte* %B) + ret int 0 +} |