Skip to content

[SandboxIR] Implement InvokeInst #100796

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
merged 1 commit into from
Jul 26, 2024
Merged

[SandboxIR] Implement InvokeInst #100796

merged 1 commit into from
Jul 26, 2024

Conversation

vporpo
Copy link
Contributor

@vporpo vporpo commented Jul 26, 2024

This patch implements sandboxir::InvokeInst which mirrors llvm::InvokeInst.

BasicBlock *IfNormal, BasicBlock *IfException,
ArrayRef<Value *> Args, Instruction *InsertBefore,
Context &Ctx, const Twine &NameStr = "");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is InvokeInstr missing a constructor with "InsertAtEnd" parameter? CallInstr has it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the issue is that in other instructions we had just two create() functions, one with InsertBefore and one with InsertAtEnd. But both of these can be replaced by one create() function that takes as arguments a BasicBlock::Iterator WhereIt and a BasicBlock *WhereBB. Anyway, it's probably OK to either keep all three variants, or keep only one. I would need to revisit them with a refactoring patch. Any preference?

But anyway, I will add the missing create() function with the InsertAtEnd parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a preference but the LLVM IR has InsertPosition. Should we just create one for SandboxIR too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should introduce a similar class in SandboxIR.

This patch implements sandboxir::InvokeInst which mirrors llvm::InvokeInst.
@vporpo vporpo merged commit db2aa50 into llvm:main Jul 26, 2024
5 of 7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 26, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux running on sanitizer-buildbot1 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/2191

Here is the relevant piece of the build log for the reference:

Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
[373/377] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[374/377] Generating Msan-x86_64-with-call-Test
[375/377] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[376/377] Generating Msan-x86_64-Test
[376/377] Running compiler_rt regression tests
llvm-lit: /b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/rtsan/X86_64LinuxConfig' contained no tests
llvm-lit: /b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10075 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
TIMEOUT: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c (10075 of 10075)
******************** TEST 'SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c' FAILED ********************
Exit Code: -9
Timeout: Reached timeout of 900 seconds

Command Output (stderr):
--
RUN: at line 1: /b/sanitizer-x86_64-linux/build/build_default/./bin/clang  -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing  -m64 -funwind-tables  -I/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp && env HWASAN_OPTIONS=die_after_fork=0  /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ /b/sanitizer-x86_64-linux/build/build_default/./bin/clang -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -m64 -funwind-tables -I/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ env HWASAN_OPTIONS=die_after_fork=0 /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
==2013922==ERROR: HWAddressSanitizer: tag-mismatch on address 0x581400005140 at pc 0x631ac7160e37
READ of size 155 at 0x581400005140 tags: 02/00 (ptr/mem) in thread T0

=================================================================
==2013751==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 780 byte(s) in 1 object(s) allocated from:
    #0 0x631ac715508d in calloc /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp:127:3
    #1 0x631ac72360f9 in llvm::safe_calloc(unsigned long, unsigned long) llvm-link

SUMMARY: HWAddressSanitizer: 780 byte(s) leaked in 1 allocation(s).

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 

1 warning(s) in tests
Slowest Tests:
--------------------------------------------------------------------------
900.11s: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c
142.33s: libFuzzer-x86_64-default-Linux :: out-of-process-fuzz.test
137.81s: libFuzzer-x86_64-libcxx-Linux :: out-of-process-fuzz.test
133.84s: libFuzzer-x86_64-static-libcxx-Linux :: out-of-process-fuzz.test
39.05s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
38.33s: libFuzzer-i386-static-libcxx-Linux :: fork.test
37.65s: libFuzzer-i386-libcxx-Linux :: fork.test
37.36s: libFuzzer-x86_64-default-Linux :: fork_corpus_groups.test
37.31s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
37.23s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test
Step 9 (test compiler-rt symbolizer) failure: test compiler-rt symbolizer (failure)
...
[373/377] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[374/377] Generating Msan-x86_64-with-call-Test
[375/377] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[376/377] Generating Msan-x86_64-Test
[376/377] Running compiler_rt regression tests
llvm-lit: /b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/rtsan/X86_64LinuxConfig' contained no tests
llvm-lit: /b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10075 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
TIMEOUT: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c (10075 of 10075)
******************** TEST 'SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c' FAILED ********************
Exit Code: -9
Timeout: Reached timeout of 900 seconds

Command Output (stderr):
--
RUN: at line 1: /b/sanitizer-x86_64-linux/build/build_default/./bin/clang  -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing  -m64 -funwind-tables  -I/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp && env HWASAN_OPTIONS=die_after_fork=0  /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ /b/sanitizer-x86_64-linux/build/build_default/./bin/clang -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -m64 -funwind-tables -I/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ env HWASAN_OPTIONS=die_after_fork=0 /b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
==2013922==ERROR: HWAddressSanitizer: tag-mismatch on address 0x581400005140 at pc 0x631ac7160e37
READ of size 155 at 0x581400005140 tags: 02/00 (ptr/mem) in thread T0

=================================================================
==2013751==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 780 byte(s) in 1 object(s) allocated from:
    #0 0x631ac715508d in calloc /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp:127:3
    #1 0x631ac72360f9 in llvm::safe_calloc(unsigned long, unsigned long) llvm-link

SUMMARY: HWAddressSanitizer: 780 byte(s) leaked in 1 allocation(s).

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..

1 warning(s) in tests
Slowest Tests:
--------------------------------------------------------------------------
900.11s: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c
142.33s: libFuzzer-x86_64-default-Linux :: out-of-process-fuzz.test
137.81s: libFuzzer-x86_64-libcxx-Linux :: out-of-process-fuzz.test
133.84s: libFuzzer-x86_64-static-libcxx-Linux :: out-of-process-fuzz.test
39.05s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
38.33s: libFuzzer-i386-static-libcxx-Linux :: fork.test
37.65s: libFuzzer-i386-libcxx-Linux :: fork.test
37.36s: libFuzzer-x86_64-default-Linux :: fork_corpus_groups.test
37.31s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
37.23s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants