llvm-6502/lib
Andrea Di Biagio 05a76eb9f2 [DAGCombiner] Improved target independent vector shuffle combine rule.
This patch improves the existing algorithm in DAGCombiner that
attempts to fold shuffles according to rule:
  shuffle(shuffle(x, y, M1), undef, M2) -> shuffle(y, undef, M3)

Before this change, there were cases where the DAGCombiner conservatively
avoided folding shuffles even if the resulting mask would have been legal.
That is because the algorithm wrongly assumed that commuting
an illegal shuffle mask would always produce an illegal mask.

With this change, we now correctly compute the commuted shuffle mask before
calling method 'isShuffleMaskLegal' on it.
On X86, this improves for example the codegen for the following function:

define <4 x i32> @test(<4 x i32> %A, <4 x i32> %B) {
  %1 = shufflevector <4 x i32> %B, <4 x i32> %A, <4 x i32> <i32 1, i32 2, i32 6, i32 7>
  %2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3>
  ret <4 x i32> %2
}

Before this change the X86 backend (-mcpu=corei7) generated
the following assembly code for function @test:
  shufps $-23, %xmm0, %xmm1  # xmm1 = xmm1[1,2],xmm0[2,3]
  movhlps %xmm1, %xmm1       # xmm1 = xmm1[1,1]
  movaps %xmm1, %xmm0

Now we produce:
  movhlps %xmm0, %xmm0       # xmm0 = xmm0[1,1]

Added extra test cases in combine-vec-shuffle-2.ll to verify that we correctly
fold according to the above-mentioned rule.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215555 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 16:09:40 +00:00
..
Analysis In LVI(Lazy Value Info), originally value on a BB can only be caculated once, 2014-08-11 05:02:04 +00:00
AsmParser Remove dead code in condition 2014-08-05 18:22:58 +00:00
Bitcode BitcodeReader: Fix non-determinism in use-list order 2014-08-05 17:49:48 +00:00
CodeGen [DAGCombiner] Improved target independent vector shuffle combine rule. 2014-08-13 16:09:40 +00:00
DebugInfo DWOHolder takes ownership of the argument constructor, use std::unique_ptr. 2014-07-31 20:26:42 +00:00
ExecutionEngine [MCJIT] Simplify immediate decoding code in the RuntimeDyldMachO hierarchy. 2014-08-08 23:12:22 +00:00
IR Don't upgrade global constructors when reading bitcode 2014-08-12 16:46:37 +00:00
IRReader
LineEditor
Linker Don't upgrade global constructors when reading bitcode 2014-08-12 16:46:37 +00:00
LTO Don't internalize all but main by default. 2014-08-05 20:10:38 +00:00
MC MC: Diagnose an unexpected token in COFF .section instead of asserting 2014-08-11 18:34:43 +00:00
Object AArch64: add support for dynamic-loader relocations 2014-08-11 10:10:27 +00:00
Option
ProfileData Coverage: add HasCodeBefore flag to a mapping region. 2014-08-04 18:00:51 +00:00
Support ADT: remove MinGW32 and Cygwin OSType enum 2014-08-09 23:12:20 +00:00
TableGen [tablegen] - Eliminate memory leaks in TGParser.cpp 2014-08-08 00:29:54 +00:00
Target [mips] Refactor calls to setCanHaveModuleDir. 2014-08-13 12:48:12 +00:00
Transforms [optnone] Make the optnone attribute effective at suppressing function 2014-08-13 10:49:33 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile