[llvm-bugs] [Bug 50145] New: [InstructionCombiner (?)] WRONG CODE involving @llvm.vector.reduce.xor

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 27 09:31:12 PDT 2021


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

            Bug ID: 50145
           Summary: [InstructionCombiner (?)]  WRONG CODE involving
                    @llvm.vector.reduce.xor
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24806
  --> https://bugs.llvm.org/attachment.cgi?id=24806&action=edit
reduced testcase

The attached program should print '0' but currently it prints '119' on
SystemZ...

A bisect leads to 79b1b4a "[Vectorizers][TTI] remove option to bypass creation
of vector reduction intrinsics". The only difference in the IR after SLP is
then:

 %rdx.shuf = shufflevector <4 x i8> %32, <4 x i8> poison, <4 x i32> <i32 2, i32
3, i32 undef, i32 undef>
 %bin.rdx = xor <4 x i8> %32, %rdx.shuf                                         
 %rdx.shuf11 = shufflevector <4 x i8> %bin.rdx, <4 x i8> poison, <4 x i32> <i32
1, i32 undef, i32 undef, i32 undef>       
 %bin.rdx12 = xor <4 x i8> %bin.rdx, %rdx.shuf11                                
 %47 = extractelement <4 x i8> %bin.rdx12, i32 0                               
 <>
     %47 = call i8 @llvm.vector.reduce.xor.v4i8(<4 x i8> %32)

This then later gets different treatment of InstCombiner. With the shuffles,
the store to @d dissapears, but with the intrinsic it seems some poison value
ends up being stored...

clang -march=z13 -O3 wrong0.i -o a.out -w ; ./a.out

-- 
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/20210427/9d561ff2/attachment.html>


More information about the llvm-bugs mailing list