Daniel Dunbar | d7f7d08 | 2010-06-29 22:00:45 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64 -emit-llvm -o - %s | FileCheck %s |
| 2 | |
| 3 | // Check that we don't generate unnecessary reloads. |
| 4 | // |
| 5 | // CHECK: define void @f0() |
| 6 | // CHECK: [[x_0:%.*]] = alloca i32, align 4 |
| 7 | // CHECK-NEXT: [[y_0:%.*]] = alloca i32, align 4 |
| 8 | // CHECK-NEXT: store i32 1, i32* [[x_0]] |
| 9 | // CHECK-NEXT: store i32 1, i32* [[x_0]] |
| 10 | // CHECK-NEXT: store i32 1, i32* [[y_0]] |
| 11 | // CHECK: } |
| 12 | void f0() { |
| 13 | int x, y; |
| 14 | x = 1; |
| 15 | y = (x = 1); |
| 16 | } |
| 17 | |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame] | 18 | // This used to test that we generate reloads for volatile access, |
| 19 | // but that does not appear to be correct behavior for C. |
Daniel Dunbar | d7f7d08 | 2010-06-29 22:00:45 +0000 | [diff] [blame] | 20 | // |
| 21 | // CHECK: define void @f1() |
| 22 | // CHECK: [[x_1:%.*]] = alloca i32, align 4 |
| 23 | // CHECK-NEXT: [[y_1:%.*]] = alloca i32, align 4 |
Eli Friedman | a40b7f2 | 2011-08-12 23:33:52 +0000 | [diff] [blame] | 24 | // CHECK-NEXT: store volatile i32 1, i32* [[x_1]] |
| 25 | // CHECK-NEXT: store volatile i32 1, i32* [[x_1]] |
| 26 | // CHECK-NEXT: store volatile i32 1, i32* [[y_1]] |
Daniel Dunbar | d7f7d08 | 2010-06-29 22:00:45 +0000 | [diff] [blame] | 27 | // CHECK: } |
| 28 | void f1() { |
| 29 | volatile int x, y; |
| 30 | x = 1; |
| 31 | y = (x = 1); |
| 32 | } |