-
Notifications
You must be signed in to change notification settings - Fork 375
[RegressionTest] Add bitcode E2E test by SAP for cost-based function outlining with indirectbr/blockaddr #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marcauberer
merged 6 commits into
llvm:main
from
marcauberer:sap-fct-splitting-test-case
Nov 17, 2025
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
04f9128
Add regression bitcode test for SAP usecase
marcauberer 968232e
Add purpose section to README of test
marcauberer 4c7d2a5
Apply feedback
marcauberer 6d1606a
Delete ll file
marcauberer 4564cf0
Rephase purpose
marcauberer a735510
Remove llvm-as section in README
marcauberer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/sap_fct_splitting.bc PROPERTIES LANGUAGE C) | ||
| SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/mocks.c PROPERTIES LANGUAGE C) | ||
|
|
||
| llvm_multisource(sap_fct_splitting | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/sap_fct_splitting.bc | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/mocks.c | ||
| ) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # SAP function splitting regression test | ||
|
|
||
| ## Purpose | ||
| This tests the correct compilation of `indirectbr` and `blockaddr`, that led to issues downstream, due to a not | ||
| yet fixed issue, which was reported here: | ||
| https://github.com/llvm/llvm-project/issues/161164 | ||
|
|
||
| ## Regenerate bitcode file | ||
| This bitcode test was generated from this high level program: | ||
|
|
||
| ``` | ||
| Int32 main() { | ||
| Bool x; | ||
| Int32 counter = test::produce(5); | ||
| while (counter < 10) { | ||
| counter++; | ||
| // Creation of subfunction forced here - start | ||
| if (counter >= 8) { | ||
| break; // triggers indirectbr | ||
| } else if (counter >= 4) { | ||
| continue; // triggers indirectbr | ||
| } | ||
| // Creation of subfunction forced here - end | ||
| test::consume(counter); | ||
| } | ||
| return 1; | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
| convert IR to bitcode using this command: | ||
|
|
||
| ```sh | ||
| llvm-as <ir-file> -o <bitcode-file> | ||
| ``` | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include <stdint.h> | ||
|
|
||
| typedef char* opaque_ptr; | ||
|
|
||
| // Globals | ||
| opaque_ptr _debugInfo = 0; | ||
| opaque_ptr _sourceCodeObj = 0; | ||
|
|
||
| // Mock functions | ||
| uint64_t llangStackTracePushVoid(opaque_ptr context, uint32_t lineNumber, uint64_t returnCode, opaque_ptr literal, opaque_ptr debugInfo, opaque_ptr sourceCodeObj) { | ||
| return 0; | ||
| } | ||
|
|
||
| int64_t llangTestProduce(opaque_ptr obj, int64_t input) { | ||
| return input; | ||
| } | ||
|
|
||
| int64_t llangTestConsume(opaque_ptr obj, int64_t input) { | ||
| return input; | ||
| } |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.