https://bugs.kde.org/show_bug.cgi?id=523626

--- Comment #5 from [email protected] ---
Created attachment 194712
  --> https://bugs.kde.org/attachment.cgi?id=194712&action=edit
a workaround

Trying to point a finger to a specific function where disabling the
optimization helps to work around this failure.  The MPSADBW x86 support comes
from commit 57f44ba4eb902b2f3a9276a7382ddae37f241109.  Going through functions
it touches it turns out that disabling optimizations for  g_calc_mpsadbw()
works the problem around.  Going deeper into that function, disabling the
optimization for sad_8x4() works the problem around too.  That said, the
attached patch is a work around.

During the bisection (Comment #3) earlier, the offending optimization was
identified as slp-vectorizer.  But, alas, clang doesn't allow for disabling
specific optimization.  It only allows to disable all optimizations using
__attribute__((optnone)) or nothing.

That said, the attached patch most likely shows the area where the root cause
of this problem might be.  But the root cause is a black box for me.

The attached patch doesn't have any significant effect on whole the testsuite. 
It only fixes this specific testcase and nothing else:
$ grep ^CC= config.log 
CC='clang'
$ tests/vg_regtest none/tests/x86/sse4-x86
sse4-x86:        valgrind   -q ./sse4-x86 

== 1 test, 0 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB
failures, 0 post failures ==

$ git diff
diff --git a/VEX/priv/guest_generic_helpers.h
b/VEX/priv/guest_generic_helpers.h
index 3584b7c2d..a7ffad749 100644
--- a/VEX/priv/guest_generic_helpers.h
+++ b/VEX/priv/guest_generic_helpers.h
@@ -105,6 +105,12 @@ static inline ULong g_calculate_sse_phminposuw ( ULong
sLo, ULong sHi )
    return ((ULong)(idx << 16)) | ((ULong)min);
 }

+#if defined(__clang__)
+// Work around https://bugs.kde.org/show_bug.cgi?id=523626
+// It would be sufficient to disable slp-vectorizer, but
+// clang can only disable all or nothing, it seems:
+__attribute__((optnone))
+#endif
 static inline ULong sad_8x4 ( ULong xx, ULong yy )
 {
    UInt t = 0;
$

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to