-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate the volatile qualifier of exp to store /load operations .
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
- Loading branch information
1 parent
b5440e4
commit 2641d9b
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// 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 | ||
} |