[llvm-bugs] [Bug 40491] New: Passing float2 as varargs broken (regression)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 28 01:10:24 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40491

            Bug ID: 40491
           Summary: Passing float2 as varargs broken (regression)
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pekka.jaaskelainen at tuni.fi
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

It seems 8.0 broke passing float2s (__ext_vector_type__(2)) as varargs. See the
reproducer in pocl github: https://github.com/pocl/pocl/issues/689

It looks like the difference in IR boils down to passing the promoted <2 x
double> as a value instead of a pointer, like was done by 7.0 while not
modifying the callee side:

The diff 7.0 vs. 8.0.  

-define dso_local i32 @main() #0 {
+define dso_local i32 @main() #3 {
 entry:
   %retval = alloca i32, align 4
   %x = alloca <2 x float>, align 8
-  %coerce = alloca <2 x float>, align 8
   store i32 0, i32* %retval, align 4
   %0 = load <2 x float>, <2 x float>* %x, align 8
   %1 = insertelement <2 x float> %0, float 9.000000e+00, i64 0
@@ -80,19 +79,18 @@
   %3 = insertelement <2 x float> %2, float 1.200000e+01, i64 1
   store <2 x float> %3, <2 x float>* %x, align 8
   %4 = load <2 x float>, <2 x float>* %x, align 8
-  store <2 x float> %4, <2 x float>* %coerce, align 8
-  %5 = bitcast <2 x float>* %coerce to double*
-  %6 = load double, double* %5, align 8
-  call void (i8*, ...) @print_float2(i8* getelementptr inbounds ([15 x i8],
[15 x i8]* @.str, i32 0, i32 0), double %6)
+  %conv = fpext <2 x float> %4 to <2 x double>
+  call void (i8*, ...) @print_float2(i8* getelementptr inbounds ([15 x i8],
[15 x i8]* @.str, i32 0, i32 0), <2 x double> %conv)
   ret i32 0
 }

Commit b30dcee6c976abb67f (r324098) seems remotely related. I did not yet have
the time to look into the generated ISA, but perhaps this rings someone's bell?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190128/897d5ee3/attachment-0001.html>


More information about the llvm-bugs mailing list