Update clang tests for r137527.

llvm-svn: 137535
This commit is contained in:
Eli Friedman 2011-08-12 23:33:52 +00:00
parent 23aca09205
commit 729ed799c7
7 changed files with 284 additions and 284 deletions

View File

@ -21,9 +21,9 @@ void f0() {
// CHECK: define void @f1()
// CHECK: [[x_1:%.*]] = alloca i32, align 4
// CHECK-NEXT: [[y_1:%.*]] = alloca i32, align 4
// CHECK-NEXT: volatile store i32 1, i32* [[x_1]]
// CHECK-NEXT: volatile store i32 1, i32* [[x_1]]
// CHECK-NEXT: volatile store i32 1, i32* [[y_1]]
// CHECK-NEXT: store volatile i32 1, i32* [[x_1]]
// CHECK-NEXT: store volatile i32 1, i32* [[x_1]]
// CHECK-NEXT: store volatile i32 1, i32* [[y_1]]
// CHECK: }
void f1() {
volatile int x, y;

View File

@ -118,7 +118,7 @@ int atomic(void) {
// CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
__sync_lock_release(&val);
// CHECK: volatile store i32 0, i32*
// CHECK: store volatile i32 0, i32*
__sync_synchronize ();
// CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
@ -130,7 +130,7 @@ int atomic(void) {
void release_return(int *lock) {
// Ensure this is actually returning void all the way through.
return __sync_lock_release(lock);
// CHECK: volatile store i32 0, i32*
// CHECK: store volatile i32 0, i32*
}

View File

@ -35,7 +35,7 @@ int main(int argc, char* argv[])
// PR8856 - -fshort-wchar makes wchar_t be unsigned.
// CHECK: @test2
// CHECK: volatile store i32 1, i32* %isUnsigned
// CHECK: store volatile i32 1, i32* %isUnsigned
void test2() {
volatile int isUnsigned = (wchar_t)-1 > (wchar_t)0;
}

View File

@ -24,182 +24,182 @@ int printf(const char *, ...);
// CHECK: define void @test()
void test() {
// CHECK: volatile load [[INT]]* @i
// CHECK: load volatile [[INT]]* @i
i;
// CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: sitofp [[INT]]
(float)(ci);
// CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
(void)ci;
// CHECK-NEXT: bitcast
// CHECK-NEXT: memcpy
(void)a;
// CHECK-NEXT: [[R:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
(void)(ci=ci);
// CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* @j
// CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* @i
// CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* @j
// CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* @i
(void)(i=j);
// CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// Not sure why they're ordered this way.
// CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
// CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
// CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
ci+=ci;
// CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
// CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
// CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// These additions can be elided
// CHECK-NEXT: add [[INT]] [[R]], [[R2]]
// CHECK-NEXT: add [[INT]] [[I]], [[I2]]
(ci += ci) + ci;
// CHECK-NEXT: call void asm
asm("nop");
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
(i += j) + k;
// CHECK-NEXT: call void asm
asm("nop");
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
// CHECK-NEXT: volatile store
// CHECK-NEXT: store volatile
// CHECK-NEXT: add nsw [[INT]]
(i += j) + 1;
// CHECK-NEXT: call void asm
asm("nop");
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add [[INT]]
// CHECK-NEXT: add [[INT]]
ci+ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
__real i;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
+ci;
// CHECK-NEXT: call void asm
asm("nop");
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
(void)(i=i);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: sitofp
(float)(i=i);
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
(void)i;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
i=i;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
i=i=i;
#ifndef __cplusplus
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
(void)__builtin_choose_expr(0, i=i, j=j);
#endif
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: icmp
// CHECK-NEXT: br i1
// CHECK: volatile load
// CHECK-NEXT: volatile store
// CHECK: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: br label
// CHECK: volatile load
// CHECK-NEXT: volatile store
// CHECK: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: br label
k ? (i=i) : (j=j);
// CHECK: phi
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
(void)(i,(i=i));
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
i=i,i;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
(i=j,k=j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
(i=j,k);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
(i,j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: trunc
// CHECK-NEXT: volatile store
// CHECK-NEXT: store volatile
// CHECK-NEXT: sext
// CHECK-NEXT: volatile store
// CHECK-NEXT: store volatile
i=c=k;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
// CHECK-NEXT: volatile store
// CHECK-NEXT: store volatile
i+=k;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
ci;
#ifndef __cplusplus
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
(int)ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: icmp ne
// CHECK-NEXT: icmp ne
// CHECK-NEXT: or i1
(_Bool)ci;
#endif
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
ci=ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
ci=ci=ci;
// CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
__imag ci = __imag ci = __imag ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
__real (i = j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
__imag i;
// ============================================================
@ -224,71 +224,71 @@ void test() {
// Not a use. gcc got this wrong in 4.2 and omitted the side effects
// entirely, but it is fixed in 4.4.0.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
__imag (i = j);
#ifndef __cplusplus
// A use of the real part
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: sitofp
(float)(ci=ci);
// Not a use, bug? gcc treats this as not a use, that's probably a bug due to
// tree folding ignoring volatile.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
(int)(ci=ci);
#endif
// A use.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: sitofp
(float)(i=i);
// A use. gcc treats this as not a use, that's probably a bug due to tree
// folding ignoring volatile.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
(int)(i=i);
// A use.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: sub
-(i=j);
// A use. gcc treats this a not a use, that's probably a bug due to tree
// folding ignoring volatile.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
+(i=k);
// A use. gcc treats this a not a use, that's probably a bug due to tree
// folding ignoring volatile.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
__real (ci=ci);
// A use.
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: add
i + 0;
// A use.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add
(i=j) + i;
// A use. gcc treats this as not a use, that's probably a bug due to tree
// folding ignoring volatile.
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: add
(i=j) + 0;

View File

@ -3,8 +3,8 @@
void test0() {
// CHECK: define void @test0()
// CHECK: [[F:%.*]] = alloca float
// CHECK-NEXT: [[REAL:%.*]] = volatile load float* getelementptr inbounds ({ float, float }* @test0_v, i32 0, i32 0)
// CHECK-NEXT: volatile load float* getelementptr inbounds ({{.*}} @test0_v, i32 0, i32 1)
// CHECK-NEXT: [[REAL:%.*]] = load volatile float* getelementptr inbounds ({ float, float }* @test0_v, i32 0, i32 0)
// CHECK-NEXT: load volatile float* getelementptr inbounds ({{.*}} @test0_v, i32 0, i32 1)
// CHECK-NEXT: store float [[REAL]], float* [[F]], align 4
// CHECK-NEXT: ret void
extern volatile _Complex float test0_v;
@ -13,10 +13,10 @@ void test0() {
void test1() {
// CHECK: define void @test1()
// CHECK: [[REAL:%.*]] = volatile load float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0)
// CHECK-NEXT: [[IMAG:%.*]] = volatile load float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1)
// CHECK-NEXT: volatile store float [[REAL]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0)
// CHECK-NEXT: volatile store float [[IMAG]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1)
// CHECK: [[REAL:%.*]] = load volatile float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0)
// CHECK-NEXT: [[IMAG:%.*]] = load volatile float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1)
// CHECK-NEXT: store volatile float [[REAL]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0)
// CHECK-NEXT: store volatile float [[IMAG]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1)
// CHECK-NEXT: ret void
extern volatile _Complex float test1_v;
test1_v = test1_v;

View File

@ -33,7 +33,7 @@ void f() {
pa = 0;
// Is this okay? What are LLVM's volatile semantics for structs?
// CHECK: volatile store { i64, i64 } zeroinitializer, { i64, i64 }* @vpa
// CHECK: store volatile { i64, i64 } zeroinitializer, { i64, i64 }* @vpa
vpa = 0;
// CHECK: [[TMP:%.*]] = load { i64, i64 }* @pa, align 8

View File

@ -26,8 +26,8 @@ void test() {
i;
(float)(ci);
// CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: sitofp [[INT]]
// These are not uses in C++:
@ -37,202 +37,202 @@ void test() {
(void)a;
(void)(ci=ci);
// CHECK-NEXT: [[R:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
(void)(i=j);
// CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* @j
// CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* @i
// CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* @j
// CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* @i
ci+=ci;
// CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// Not sure why they're ordered this way.
// CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
// CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
// CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// Note that C++ requires an extra volatile load over C from the LHS of the '+'.
// Note that C++ requires an extra load volatile over C from the LHS of the '+'.
(ci += ci) + ci;
// CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
// CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
// CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// These additions can be elided.
// CHECK-NEXT: add [[INT]] [[R1]], [[R2]]
// CHECK-NEXT: add [[INT]] [[I1]], [[I2]]
asm("nop"); // CHECK-NEXT: call void asm
// Extra volatile load in C++.
// Extra load volatile in C++.
(i += j) + k;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
asm("nop"); // CHECK-NEXT: call void asm
// Extra volatile load in C++.
// Extra load volatile in C++.
(i += j) + 1;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
asm("nop"); // CHECK-NEXT: call void asm
ci+ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add [[INT]]
// CHECK-NEXT: add [[INT]]
__real i;
+ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
asm("nop"); // CHECK-NEXT: call void asm
(void)(i=i);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
(float)(i=i);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: sitofp
(void)i;
i=i;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// Extra volatile load in C++.
// Extra load volatile in C++.
i=i=i;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
(void)__builtin_choose_expr(0, i=i, j=j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
k ? (i=i) : (j=j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: icmp
// CHECK-NEXT: br i1
// CHECK: volatile load
// CHECK-NEXT: volatile store
// CHECK: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: br label
// CHECK: volatile load
// CHECK-NEXT: volatile store
// CHECK: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: br label
// CHECK: phi
(void)(i,(i=i));
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
i=i,k;
// CHECK-NEXT: volatile load [[INT]]* @i
// CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
// CHECK-NEXT: load volatile [[INT]]* @i
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
(i=j,k=j);
// CHECK-NEXT: volatile load [[INT]]* @j
// CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
// CHECK-NEXT: volatile load [[INT]]* @j
// CHECK-NEXT: volatile store {{.*}}, [[INT]]* @k
// CHECK-NEXT: load volatile [[INT]]* @j
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
// CHECK-NEXT: load volatile [[INT]]* @j
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @k
(i=j,k);
// CHECK-NEXT: volatile load [[INT]]* @j
// CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
// CHECK-NEXT: load volatile [[INT]]* @j
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
(i,j);
// Extra load in C++.
i=c=k;
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: trunc
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: sext
// CHECK-NEXT: volatile store
// CHECK-NEXT: store volatile
i+=k;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add nsw [[INT]]
// CHECK-NEXT: volatile store
// CHECK-NEXT: store volatile
ci;
asm("nop"); // CHECK-NEXT: call void asm
(int)ci;
// CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 0
// CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 1
// CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 0
// CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 1
(bool)ci;
// CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 0
// CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 1
// CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 0
// CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 1
// CHECK-NEXT: icmp ne
// CHECK-NEXT: icmp ne
// CHECK-NEXT: or i1
ci=ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
asm("nop"); // CHECK-NEXT: call void asm
// Extra load in C++.
ci=ci=ci;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
__imag ci = __imag ci = __imag ci;
// CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
__real (i = j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
__imag i;
@ -258,95 +258,95 @@ void test() {
// Not a use. gcc got this wrong in 4.2 and omitted the side effects
// entirely, but it is fixed in 4.4.0.
__imag (i = j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// C++ does an extra load here. Note that we have to do full loads.
(float)(ci=ci);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: sitofp
// Not a use, bug? gcc treats this as not a use, that's probably a
// bug due to tree folding ignoring volatile.
(int)(ci=ci);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// A use.
(float)(i=i);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: sitofp
// A use. gcc treats this as not a use, that's probably a bug due to tree
// folding ignoring volatile.
(int)(i=i);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// A use.
-(i=j);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: sub
// A use. gcc treats this a not a use, that's probably a bug due to tree
// folding ignoring volatile.
+(i=k);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// A use. gcc treats this a not a use, that's probably a bug due to tree
// folding ignoring volatile.
__real (ci=ci);
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile store
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: store volatile
// A use.
i + 0;
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: add
// A use.
(i=j) + i;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add
// A use. gcc treats this as not a use, that's probably a bug due to tree
// folding ignoring volatile.
(i=j) + 0;
// CHECK-NEXT: volatile load
// CHECK-NEXT: volatile store
// CHECK-NEXT: volatile load
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: add
(i,j)=k;
// CHECK-NEXT: volatile load [[INT]]* @k
// CHECK-NEXT: volatile store {{.*}}, [[INT]]* @j
// CHECK-NEXT: load volatile [[INT]]* @k
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @j
(j=k,i)=i;
// CHECK-NEXT: volatile load [[INT]]* @i
// CHECK-NEXT: volatile load [[INT]]* @k
// CHECK-NEXT: volatile store {{.*}}, [[INT]]* @j
// CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
// CHECK-NEXT: load volatile [[INT]]* @i
// CHECK-NEXT: load volatile [[INT]]* @k
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @j
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
// CHECK-NEXT: ret void
}