This repository has been archived by the owner on Jan 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Hardware tracing and optimisations #66
Comments
Just to add: I'm not certain that this isn't an LLVM bug. |
bors bot
pushed a commit
that referenced
this issue
Jul 9, 2020
…s recently merged This commit updates rustc's LLVM submodule to include new AVR-specific fixes recently merged on the Rust LLVM 'rustc/10.0-2020-05-05' branch. All of these cherry-picked commits exist in upstream LLVM and were cherry-picked into Rust's LLVM fork in commit 6c040dd86ed. |- 6c040dd86ed Merge pull request #66 from dylanmckay/avr-pick-upstream-llvm-fixes |- 12dfdd3aed7 [AVR] Rewrite the function calling convention. |- 118ac53f12b [AVR] Don't adjust for instruction size |- bc27c282e13 [AVR] Fix miscompilation of zext + add |- cfbe205a7e8 [AVR] Remove faulty stack pushing behavior |- 143e1469e96 [AVR] Fix stack size in functions with a frame pointer |- 6b2445d841e [LLVM][AVR] Support for R_AVR_6 fixup |- 93ee4da19cf [AVR] Fix I/O instructions on XMEGA |- 962c2415ffb [AVR] Do not place functions in .progmem.data |- 65b8b170aef [AVR] Do not use divmod calls for bigger integers |- 93a3b595d1c [AVR] Generalize the previous interrupt bugfix to signal |- handlers too |- cc4286349b4 [AVR] Respect the 'interrupt' function attribute |- 954d0a92205 [AVR] Fix reads of uninitialized variables from constructor of AVRSubtarget |- 1c0ddae73c9 [AVR] Fix read of uninitialized variable AVRSubtarget:::ELFArch |- 0ed0823fe60 [AVR] Fix incorrect register state for LDRdPtr |- 96075fc433d [AVR] Don't adjust addresses by 2 for absolute values |- 6dfc55ba53b [AVR] Use correct register class for mul instructions These changes include both correctness fixes and LLVM assertion error fixes. Once all of these commits have been cherry-picked, all of the LLVM plumbing for rust-lang/master to compile the AVR blink program will be in place. Once this commit is merged, only PR rust-lang/rust#73270 will be blocking successful compilation and emission of the AVR LED blink program.
bors bot
pushed a commit
that referenced
this issue
Jul 9, 2020
…s, r=cuviper [AVR] Update the rust-lang/llvm-project submodule to include AVR fixes recently merged This PR updates rustc's LLVM submodule to include new AVR-specific fixes recently merged on the Rust LLVM 'rustc/10.0-2020-05-05' branch. All of these cherry-picked commits exist in upstream LLVM and were cherry-picked into Rust's LLVM fork in commit 6c040dd86ed. Relates to rust-lang/llvm-project#66 ``` |- 6c040dd86ed Merge pull request #66 from dylanmckay/avr-pick-upstream-llvm-fixes |- 12dfdd3aed7 [AVR] Rewrite the function calling convention. |- 118ac53f12b [AVR] Don't adjust for instruction size |- bc27c282e13 [AVR] Fix miscompilation of zext + add |- cfbe205a7e8 [AVR] Remove faulty stack pushing behavior |- 143e1469e96 [AVR] Fix stack size in functions with a frame pointer |- 6b2445d841e [LLVM][AVR] Support for R_AVR_6 fixup |- 93ee4da19cf [AVR] Fix I/O instructions on XMEGA |- 962c2415ffb [AVR] Do not place functions in .progmem.data |- 65b8b170aef [AVR] Do not use divmod calls for bigger integers |- 93a3b595d1c [AVR] Generalize the previous interrupt bugfix to signal |- handlers too |- cc4286349b4 [AVR] Respect the 'interrupt' function attribute |- 954d0a92205 [AVR] Fix reads of uninitialized variables from constructor of AVRSubtarget |- 1c0ddae73c9 [AVR] Fix read of uninitialized variable AVRSubtarget:::ELFArch |- 0ed0823fe60 [AVR] Fix incorrect register state for LDRdPtr |- 96075fc433d [AVR] Don't adjust addresses by 2 for absolute values |- 6dfc55ba53b [AVR] Use correct register class for mul instructions ``` These changes include both correctness fixes and LLVM assertion error fixes. Once all of these commits have been cherry-picked, all of the LLVM plumbing for rust-lang/master to compile the AVR blink program will be in place. Once this commit is merged, only PR rust-lang/rust#73270 will be blocking successful compilation and emission of the AVR LED blink program.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When we add hardware tracing some programs using specific libraries currently make the compiler segfault. The segfault happens in LLVM in a method called
getInstructionIndex
. This function essentially walks through a Bundle and skips all debug instructions until it finds a "real" instruction. LLVM expects to find at least 1 "real" instruction. The segfault happens, when the only instruction within the Bundle is a debug instruction. The segfault only happens when we enabled optimisations with-O
.What I think happens (though I'm not entirely sure), is that when enabling optimisations, LLVM optimises away some stuff, leaving an empty Bundle. Typically this Bundle would also be optimised away, however, since we inserted YK debug labels, the Bundle isn't actually empty and thus LLVM can't/doesn't remove it. Then LLVM tries to codegen the empty Bundle, but expects there to be at least one "real" instruction, which it cannot find and segfaults.
A possible solution to this problem is to disable hardware tracing when optimisations are enabled. I believe currently the debug labels are inaccurate anyways with optimisations on, since LLVM moves things around after they were inserted. So we may not be able to use optimisations anyways for the time being.
The text was updated successfully, but these errors were encountered: