forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BitcodeReader] Fixing bug that caused BitcodeReader to fail to proce…
…ss Tapir sync instructions correctly. This change addresses issue #56.
- Loading branch information
Showing
2 changed files
with
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
; Test that bitcode reader and writer can handle Tapir extensions. | ||
; | ||
; Thanks to @joshbohde for the code for this test case. | ||
;; | ||
; RUN: llvm-as %s -o=- | llvm-dis | ||
|
||
declare token @llvm.syncregion.start() #3 | ||
|
||
declare void @print(i32) | ||
|
||
define void @test (i32 %n) { | ||
entry: | ||
%i = alloca i32 | ||
store i32 0, i32* %i ; store it back | ||
br label %loop.1.entry | ||
|
||
loop.1.entry: | ||
%tmp = load i32, i32* %i | ||
%cmp = icmp ne i32 %tmp, %n | ||
br i1 %cmp, label %loop.1.body, label %loop.1.exit | ||
|
||
loop.1.body: | ||
%syncreg = call token @llvm.syncregion.start() | ||
detach within %syncreg, label %loop.1.body.1, label %loop.1.body.2 | ||
|
||
loop.1.body.1: | ||
%tmp2 = load i32, i32* %i | ||
call void @print(i32 %tmp2) | ||
reattach within %syncreg, label %loop.1.body.2 | ||
|
||
loop.1.body.2: | ||
%tmp3 = load i32, i32* %i | ||
%tmp4 = add i32 %tmp3, 1 ; increment it | ||
store i32 %tmp4, i32* %i ; store it back | ||
br label %loop.1.final | ||
|
||
loop.1.final: | ||
sync within %syncreg, label %loop.1.entry | ||
|
||
loop.1.exit: | ||
ret void | ||
} |