hanchenye-llvm-project/llvm/lib/CodeGen/SelectionDAG
Daniel Sanders 2038747fce Fix vector splitting for extract_vector_elt and vector elements of <8-bits.
Summary:
One of the vector splitting paths for extract_vector_elt tries to lower:
    define i1 @via_stack_bug(i8 signext %idx) {
      %1 = extractelement <2 x i1> <i1 false, i1 true>, i8 %idx
      ret i1 %1
    }
to:
    define i1 @via_stack_bug(i8 signext %idx) {
      %base = alloca <2 x i1>
      store <2 x i1> <i1 false, i1 true>, <2 x i1>* %base
      %2 = getelementptr <2 x i1>, <2 x i1>* %base, i32 %idx
      %3 = load i1, i1* %2
      ret i1 %3
    }
However, the elements of <2 x i1> are not byte-addressible. The result of this
is that the getelementptr expands to '%base + %idx * (1 / 8)' which simplifies
to '%base + %idx * 0', and then simply '%base' causing all values of %idx to
extract element zero.

This commit fixes this by promoting the vector elements of <8-bits to i8 before
splitting the vector.

This fixes a number of test failures in pocl.

Reviewers: pekka.jaaskelainen

Subscribers: pekka.jaaskelainen, llvm-commits

Differential Revision: http://reviews.llvm.org/D12591

llvm-svn: 247128
2015-09-09 09:53:20 +00:00
..
CMakeLists.txt [Statepoints 3/4] Statepoint infrastructure for garbage collection: SelectionDAGBuilder 2014-12-02 18:50:36 +00:00
DAGCombiner.cpp check for fastness before merging in DAGCombiner::MergeConsecutiveStores() 2015-09-03 15:03:19 +00:00
FastISel.cpp FastISel: Avoid adding a successor block twice for degenerate IR. 2015-08-26 20:46:49 +00:00
FunctionLoweringInfo.cpp [WinEH] Avoid creating MBBs for LLVM BBs that cannot contain code 2015-09-08 23:28:38 +00:00
InstrEmitter.cpp Redirect DataLayout from TargetMachine to Module in SelectionDAG 2015-07-07 19:07:19 +00:00
InstrEmitter.h [SDAG] Give InstrEmitter hidden visibility 2015-07-01 14:55:10 +00:00
LLVMBuild.txt
LegalizeDAG.cpp SelectionDAG: Support Expand of f16 extloads 2015-09-09 01:12:27 +00:00
LegalizeFloatTypes.cpp Make TargetLowering::getShiftAmountTy() taking DataLayout as an argument 2015-07-09 02:09:20 +00:00
LegalizeIntegerTypes.cpp [CodeGen] Support (and default to) expanding READCYCLECOUNTER to 0. 2015-08-28 01:49:59 +00:00
LegalizeTypes.cpp Fix vector splitting for extract_vector_elt and vector elements of <8-bits. 2015-09-09 09:53:20 +00:00
LegalizeTypes.h [CodeGen] Support (and default to) expanding READCYCLECOUNTER to 0. 2015-08-28 01:49:59 +00:00
LegalizeTypesGeneric.cpp PseudoSourceValue: Replace global manager with a manager in a machine function. 2015-08-11 23:09:45 +00:00
LegalizeVectorOps.cpp Add new ISD nodes: ISD::FMINNAN and ISD::FMAXNAN 2015-08-11 09:13:05 +00:00
LegalizeVectorTypes.cpp Fix vector splitting for extract_vector_elt and vector elements of <8-bits. 2015-09-09 09:53:20 +00:00
Makefile
ResourcePriorityQueue.cpp Fix some comment typos. 2015-08-08 18:27:36 +00:00
SDNodeDbgValue.h Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
ScheduleDAGFast.cpp Add allnodes() iterator range to SelectionDAG. NFC. 2015-07-14 22:10:54 +00:00
ScheduleDAGRRList.cpp Convert a bunch of loops to foreach. NFC. 2015-06-26 19:18:49 +00:00
ScheduleDAGSDNodes.cpp Add allnodes() iterator range to SelectionDAG. NFC. 2015-07-14 22:10:54 +00:00
ScheduleDAGSDNodes.h Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
ScheduleDAGVLIW.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
SelectionDAG.cpp [SelectionDAG] Swap commutative binops before constant-based folding 2015-09-06 05:42:13 +00:00
SelectionDAGBuilder.cpp [WinEH] Avoid creating MBBs for LLVM BBs that cannot contain code 2015-09-08 23:28:38 +00:00
SelectionDAGBuilder.h [WinEH] Avoid creating MBBs for LLVM BBs that cannot contain code 2015-09-08 23:28:38 +00:00
SelectionDAGDumper.cpp [WinEH] Add some support for code generating catchpad 2015-08-27 23:27:47 +00:00
SelectionDAGISel.cpp [WinEH] Avoid creating MBBs for LLVM BBs that cannot contain code 2015-09-08 23:28:38 +00:00
SelectionDAGPrinter.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
StatepointLowering.cpp [WinEH] Avoid creating MBBs for LLVM BBs that cannot contain code 2015-09-08 23:28:38 +00:00
StatepointLowering.h [StatepointLowering] Support of the gc.relocates for invoke statepoints. 2015-05-20 11:37:25 +00:00
TargetLowering.cpp Pass function attributes instead of boolean in isIntDivCheap(). 2015-08-25 02:31:21 +00:00
TargetSelectionDAGInfo.cpp Remove getDataLayout() from TargetSelectionDAGInfo (had no users) 2015-07-09 02:10:08 +00:00