-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Crystal 0.22.0 not using previous .o files with LLVM 4.0 #4336
Comments
It might be related to #4015? |
Can you try using the |
@luislavena it's still the same
|
In my testing ( |
Building with |
@RX14, yes, but in 0.21.1 second release build of the same code, was much faster, (10times or more), in 0.22 it the same time. so i think 0.21.1 generate the same obj file, but 0.22 generate different obj file every time. |
I am also experiencing some differences in the .o/.bc generated from build to build. While I will try to investigate what's happening, if someone has time/wants to collaborate in this issue it will be appreciated. Maybe is an llvm 4.0 issue? It would be worth to try other llvm versions. |
I have an llvm build set up on my desktop, maybe I'll try bisecting. |
@RX14 Note that I am not saying it is definitely an llvm issue. But everyone in the thread is in llvm 4.0 |
If it's not an LLVm issue i'll just bisect the compiler :) |
It was a crystal issue. First bad commit was 0f85b6e. Here's the ir diff between 2 runs. The only difference is the macro name in the (debug info?) diff --git a/tmp/1.ll b/tmp/2.ll
index 4468c82..e75d08f 100644
--- a/tmp/1.ll
+++ b/tmp/2.ll
@@ -980,16 +980,16 @@ target triple = "x86_64-unknown-linux-gnu"
@"'UInt64'" = private constant { i32, i32, i32, [7 x i8] } { i32 1, i32 6, i32 6, [7 x i8] c"UInt64\00" }
@"'UInt8'" = private constant { i32, i32, i32, [6 x i8] } { i32 1, i32 5, i32 5, [6 x i8] c"UInt8\00" }
@"' to (UInt32 | UInt6...'" = private constant { i32, i32, i32, [29 x i8] } { i32 1, i32 28, i32 28, [29 x i8] c" to (UInt32 | UInt64) failed\00" }
-@"', at expanded macro...'" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94073737108992:36\00" }
+@"', at expanded macro...'" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94014612524544:36\00" }
@"'Nil'" = private constant { i32, i32, i32, [4 x i8] } { i32 1, i32 3, i32 3, [4 x i8] c"Nil\00" }
@"' to String failed'" = private constant { i32, i32, i32, [18 x i8] } { i32 1, i32 17, i32 17, [18 x i8] c" to String failed\00" }
-@"', at expanded macro...'.4" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94073737108992:37\00" }
+@"', at expanded macro...'.4" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94014612524544:37\00" }
@"Debug::DWARF::AT::DW_AT_low_pc:init" = internal global i1 false
@"' to UInt64 failed'" = private constant { i32, i32, i32, [18 x i8] } { i32 1, i32 17, i32 17, [18 x i8] c" to UInt64 failed\00" }
-@"', at expanded macro...'.5" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94073737108992:39\00" }
+@"', at expanded macro...'.5" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94014612524544:39\00" }
@"Debug::DWARF::AT::DW_AT_high_pc:init" = internal global i1 false
-@"', at expanded macro...'.6" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94073737108992:42\00" }
-@"', at expanded macro...'.7" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94073737108992:44\00" }
+@"', at expanded macro...'.6" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94014612524544:42\00" }
+@"', at expanded macro...'.7" = private constant { i32, i32, i32, [45 x i8] } { i32 1, i32 44, i32 44, [45 x i8] c", at expanded macro: macro_94014612524544:44\00" }
@"UInt64::MIN:init" = internal global i1 false
@"'Overflow: UInt64::M...'" = private constant { i32, i32, i32, [27 x i8] } { i32 1, i32 26, i32 26, [27 x i8] c"Overflow: UInt64::MIN / -1\00" }
@"'Invalid Int32: '" = private constant { i32, i32, i32, [16 x i8] } { i32 1, i32 15, i32 15, [16 x i8] c"Invalid Int32: \00" } |
But I thought is also happen with Note that although the macro could differ in it's name, since they are intepreted they should not be present in the .ll / .o. Maybe the name of the macro that expanded appear in the stacktrace, even if Can you share the code and build command? |
To save you some time, the culprit is this line. It should probably use |
Thanks @RX14 for the research! ❤️ |
@asterite could be possible to use a fingerprint/hash of the macro instead of a number? That way if there is no change in the macro, it doesn't produces a difference. 🤔 |
@luislavena the challenge with caching macros is that they are very powerful. They depend on other resources the compiler is unaware. For this fix, the debug location needed to be the original_location since otherwise it leads to a spurious location and not a file:line the use can access. |
For now second
and third ok. |
OS X 10.12.1
Crystal Version
Test
The text was updated successfully, but these errors were encountered: