Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / copypaste / asm.cpp
blob1d93469aa3c2f62983c3b1fc63004c81ae8767b8
1 // RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
3 // expected-no-diagnostics
5 int foo1(int src) {
6 int dst = src;
7 if (src < 100 && src > 0) {
9 asm ("mov %1, %0\n\t"
10 "add $1, %0"
11 : "=r" (dst)
12 : "r" (src));
15 return dst;
18 // Identical to foo1 except that it adds two instead of one, so it's no clone.
19 int foo2(int src) {
20 int dst = src;
21 if (src < 100 && src > 0) {
23 asm ("mov %1, %0\n\t"
24 "add $2, %0"
25 : "=r" (dst)
26 : "r" (src));
29 return dst;
32 // Identical to foo1 except that its a volatile asm statement, so it's no clone.
33 int foo3(int src) {
34 int dst = src;
35 if (src < 100 && src > 0) {
37 asm volatile ("mov %1, %0\n\t"
38 "add $1, %0"
39 : "=r" (dst)
40 : "r" (src));
43 return dst;