-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SystemZ][XRay] Make xray work with gcc #126154
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
Conversation
It seems that depending on the platform, gcc acceptts or does not accept `-mvx` without specifying an architecture actually having vector instructions. The solution which seems to work across different versions of gcc and clang is to specify the least architecture which has vector instructions. In addition, initialization of the unused variable CPU prevents a compiler warning from gcc.
@llvm/pr-subscribers-xray Author: Kai Nacke (redstar) ChangesIt seems that depending on the platform, gcc acceptts or does not accept In addition, initialization of the unused variable CPU prevents a compiler warning from gcc. Full diff: https://github.com/llvm/llvm-project/pull/126154.diff 2 Files Affected:
diff --git a/compiler-rt/lib/xray/CMakeLists.txt b/compiler-rt/lib/xray/CMakeLists.txt
index 673091807e348d..c79b0b634ddf16 100644
--- a/compiler-rt/lib/xray/CMakeLists.txt
+++ b/compiler-rt/lib/xray/CMakeLists.txt
@@ -111,7 +111,7 @@ set(riscv64_SOURCES
xray_trampoline_s390x.S
)
# Enable vector instructions in the assembly file.
-set_source_files_properties(xray_trampoline_s390x.S PROPERTIES COMPILE_FLAGS -mvx)
+set_source_files_properties(xray_trampoline_s390x.S PROPERTIES COMPILE_FLAGS -march=z13)
set(XRAY_SOURCE_ARCHS
arm
diff --git a/compiler-rt/lib/xray/xray_tsc.h b/compiler-rt/lib/xray/xray_tsc.h
index 118b6f00e33ea5..c8a8b2f16fef84 100644
--- a/compiler-rt/lib/xray/xray_tsc.h
+++ b/compiler-rt/lib/xray/xray_tsc.h
@@ -96,6 +96,7 @@ namespace __xray {
inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT { return true; }
ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
+ CPU = 0;
#if __has_builtin(__builtin_readcyclecounter)
return __builtin_readcyclecounter();
#else
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to fix my build problems, thanks.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/12221 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/22211 Here is the relevant piece of the build log for the reference
|
It seems that depending on the platform, gcc acceptts or does not accept `-mvx` without specifying an architecture actually having vector instructions. The solution which seems to work across different versions of gcc and clang is to specify the least architecture which has vector instructions. In addition, initialization of the unused variable CPU prevents a compiler warning from gcc.
It seems that depending on the platform, gcc acceptts or does not accept
-mvx
without specifying an architecture actually having vector instructions. The solution which seems to work across different versions of gcc and clang is to specify the least architecture which has vector instructions.In addition, initialization of the unused variable CPU prevents a compiler warning from gcc.