mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-14 18:06:32 +00:00

This changes to address the PR : 55207 We update the volatility on the LValue by looking at the LHS cast operation qualifier and propagate the RValue volatile-ness from the CGF data structure . Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D157890
44 lines
1.8 KiB
C++
44 lines
1.8 KiB
C++
// RUN: %clang_cc1 -O2 -triple=x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK
|
|
struct agg
|
|
{
|
|
int a ;
|
|
int b ;
|
|
} t;
|
|
struct agg a;
|
|
int vt=10;
|
|
_Complex float cf;
|
|
int volatile vol =10;
|
|
void f0() {
|
|
const_cast<volatile _Complex float &>(cf) = const_cast<volatile _Complex float&>(cf) + 1;
|
|
// CHECK: %cf.real = load volatile float, ptr @cf
|
|
// CHECK: %cf.imag = load volatile float, ptr getelementptr
|
|
// CHECK: %add.r = fadd float %cf.real, 1.000000e+00
|
|
// CHECK: %add.i = fadd float %cf.imag, 0.000000e+00
|
|
// CHECK: store volatile float %add.r
|
|
// CHECK: store volatile float %add.i, ptr getelementptr
|
|
static_cast<volatile _Complex float &>(cf) = static_cast<volatile _Complex float&>(cf) + 1;
|
|
// CHECK: %cf.real1 = load volatile float, ptr @cf
|
|
// CHECK: %cf.imag2 = load volatile float, ptr getelementptr
|
|
// CHECK: %add.r3 = fadd float %cf.real1, 1.000000e+00
|
|
// CHECK: %add.i4 = fadd float %cf.imag2, 0.000000e+00
|
|
// CHECK: store volatile float %add.r3, ptr @cf
|
|
// CHECK: store volatile float %add.i4, ptr getelementptr
|
|
const_cast<volatile int &>(a.a) = const_cast<volatile int &>(t.a) ;
|
|
// CHECK: %0 = load volatile i32, ptr @t
|
|
// CHECK: store volatile i32 %0, ptr @a
|
|
static_cast<volatile int &>(a.b) = static_cast<volatile int &>(t.a) ;
|
|
// CHECK: %1 = load volatile i32, ptr @t
|
|
// CHECK: store volatile i32 %1, ptr getelementptr
|
|
const_cast<volatile int&>(vt) = const_cast<volatile int&>(vt) + 1;
|
|
// CHECK: %2 = load volatile i32, ptr @vt
|
|
// CHECK: %add = add nsw i32 %2, 1
|
|
// CHECK: store volatile i32 %add, ptr @vt
|
|
static_cast<volatile int&>(vt) = static_cast<volatile int&>(vt) + 1;
|
|
// CHECK: %3 = load volatile i32, ptr @vt
|
|
// CHECK: %add5 = add nsw i32 %3, 1
|
|
// CHECK: store volatile i32 %add5, ptr @vt
|
|
vt = const_cast<int&>(vol);
|
|
// %4 = load i32, ptr @vol
|
|
// store i32 %4, ptr @vt
|
|
}
|