Last active
January 2, 2016 05:49
-
-
Save reinhrst/8259669 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| --- seqlock_atom.ll 2014-01-04 11:47:54.000000000 +0000 | |
| +++ seqlock_seq_cst.ll 2014-01-04 11:47:41.000000000 +0000 | |
| @@ -17,6 +17,10 @@ | |
| entry: | |
| %i = alloca i32, align 4 | |
| %local_lock = alloca i32, align 4 | |
| + %.atomictmp = alloca i32, align 4 | |
| + %.atomictmp2 = alloca i32, align 4 | |
| + %.atomictmp3 = alloca i32, align 4 | |
| + %.atomictmp4 = alloca i32, align 4 | |
| store i32 0, i32* %local_lock, align 4 | |
| store i32 1, i32* %i, align 4 | |
| br label %for.cond | |
| @@ -31,21 +35,29 @@ | |
| %1 = load i32* %local_lock, align 4 | |
| %inc = add nsw i32 %1, 1 | |
| store i32 %inc, i32* %local_lock, align 4 | |
| - store atomic i32 %inc, i32* @lock seq_cst, align 4 | |
| - %2 = load i32* %i, align 4 | |
| - store atomic i32 %2, i32* @x1 seq_cst, align 4 | |
| + store i32 %inc, i32* %.atomictmp | |
| + %2 = load i32* %.atomictmp, align 4 | |
| + store atomic i32 %2, i32* @lock seq_cst, align 4 | |
| %3 = load i32* %i, align 4 | |
| - store atomic i32 %3, i32* @x2 seq_cst, align 4 | |
| - %4 = load i32* %local_lock, align 4 | |
| - %inc2 = add nsw i32 %4, 1 | |
| - store i32 %inc2, i32* %local_lock, align 4 | |
| - store atomic i32 %inc2, i32* @lock seq_cst, align 4 | |
| + store i32 %3, i32* %.atomictmp2 | |
| + %4 = load i32* %.atomictmp2, align 4 | |
| + store atomic i32 %4, i32* @x1 seq_cst, align 4 | |
| + %5 = load i32* %i, align 4 | |
| + store i32 %5, i32* %.atomictmp3 | |
| + %6 = load i32* %.atomictmp3, align 4 | |
| + store atomic i32 %6, i32* @x2 seq_cst, align 4 | |
| + %7 = load i32* %local_lock, align 4 | |
| + %inc5 = add nsw i32 %7, 1 | |
| + store i32 %inc5, i32* %local_lock, align 4 | |
| + store i32 %inc5, i32* %.atomictmp4 | |
| + %8 = load i32* %.atomictmp4, align 4 | |
| + store atomic i32 %8, i32* @lock seq_cst, align 4 | |
| br label %for.inc | |
| for.inc: ; preds = %for.body | |
| - %5 = load i32* %i, align 4 | |
| - %inc3 = add nsw i32 %5, 1 | |
| - store i32 %inc3, i32* %i, align 4 | |
| + %9 = load i32* %i, align 4 | |
| + %inc6 = add nsw i32 %9, 1 | |
| + store i32 %inc6, i32* %i, align 4 | |
| br label %for.cond | |
| for.end: ; preds = %for.cond | |
| @@ -62,6 +74,10 @@ | |
| %lv1 = alloca i32, align 4 | |
| %lv2 = alloca i32, align 4 | |
| %local_lock = alloca i32, align 4 | |
| + %.atomicdst = alloca i32, align 4 | |
| + %.atomicdst4 = alloca i32, align 4 | |
| + %.atomicdst5 = alloca i32, align 4 | |
| + %.atomicdst6 = alloca i32, align 4 | |
| %.compoundliteral = alloca [1 x %struct.timespec], align 4 | |
| store i32 0, i32* %v1, align 4 | |
| store i32 0, i32* %v2, align 4 | |
| @@ -81,10 +97,12 @@ | |
| br label %while.body3 | |
| while.body3: ; preds = %while.body, %if.then, %if.end10 | |
| - %atomic-load = load atomic i32* @lock seq_cst, align 4 | |
| - store i32 %atomic-load, i32* %local_lock, align 4 | |
| - %2 = load i32* %local_lock, align 4 | |
| - %and = and i32 %2, 1 | |
| + %2 = load atomic i32* @lock seq_cst, align 4 | |
| + store i32 %2, i32* %.atomicdst, align 4 | |
| + %3 = load i32* %.atomicdst, align 4 | |
| + store i32 %3, i32* %local_lock, align 4 | |
| + %4 = load i32* %local_lock, align 4 | |
| + %and = and i32 %4, 1 | |
| %tobool = icmp ne i32 %and, 0 | |
| br i1 %tobool, label %if.then, label %if.end | |
| @@ -92,13 +110,19 @@ | |
| br label %while.body3 | |
| if.end: ; preds = %while.body3 | |
| - %atomic-load4 = load atomic i32* @x1 seq_cst, align 4 | |
| - store i32 %atomic-load4, i32* %v1, align 4 | |
| - %atomic-load5 = load atomic i32* @x2 seq_cst, align 4 | |
| - store i32 %atomic-load5, i32* %v2, align 4 | |
| - %3 = load i32* %local_lock, align 4 | |
| - %atomic-load6 = load atomic i32* @lock seq_cst, align 4 | |
| - %cmp7 = icmp eq i32 %3, %atomic-load6 | |
| + %5 = load atomic i32* @x1 seq_cst, align 4 | |
| + store i32 %5, i32* %.atomicdst4, align 4 | |
| + %6 = load i32* %.atomicdst4, align 4 | |
| + store i32 %6, i32* %v1, align 4 | |
| + %7 = load atomic i32* @x2 seq_cst, align 4 | |
| + store i32 %7, i32* %.atomicdst5, align 4 | |
| + %8 = load i32* %.atomicdst5, align 4 | |
| + store i32 %8, i32* %v2, align 4 | |
| + %9 = load i32* %local_lock, align 4 | |
| + %10 = load atomic i32* @lock seq_cst, align 4 | |
| + store i32 %10, i32* %.atomicdst6, align 4 | |
| + %11 = load i32* %.atomicdst6, align 4 | |
| + %cmp7 = icmp eq i32 %9, %11 | |
| br i1 %cmp7, label %if.then9, label %if.end10 | |
| if.then9: ; preds = %if.end | |
| @@ -108,9 +132,9 @@ | |
| br label %while.body3 | |
| while.end: ; preds = %if.then9 | |
| - %4 = load i32* %v1, align 4 | |
| - %5 = load i32* %v2, align 4 | |
| - %cmp11 = icmp eq i32 %4, %5 | |
| + %12 = load i32* %v1, align 4 | |
| + %13 = load i32* %v2, align 4 | |
| + %cmp11 = icmp eq i32 %12, %13 | |
| br i1 %cmp11, label %cond.true, label %cond.false | |
| cond.true: ; preds = %while.end | |
| @@ -122,7 +146,7 @@ | |
| ; No predecessors! | |
| br label %cond.end | |
| -cond.end: ; preds = %6, %cond.true | |
| +cond.end: ; preds = %14, %cond.true | |
| %arrayinit.begin = getelementptr inbounds [1 x %struct.timespec]* %.compoundliteral, i32 0, i32 0 | |
| %tv_sec = getelementptr inbounds %struct.timespec* %arrayinit.begin, i32 0, i32 0 | |
| store i32 0, i32* %tv_sec, align 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment