[llvm-commits] [llvm] r161565 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/ARM/2012-08-08-legalize-unaligned.ll
Nadav Rotem
nadav.rotem at intel.com
Wed Aug 8 18:56:45 PDT 2012
Author: nadav
Date: Wed Aug 8 20:56:44 2012
New Revision: 161565
URL: http://llvm.org/viewvc/llvm-project?rev=161565&view=rev
Log:
Fix the legalization of ExtLoad on ARM. ExpandUnalignedLoad did not properly
handle the cases where the memory value type was illegal.
PR 13111.
Added:
llvm/trunk/test/CodeGen/ARM/2012-08-08-legalize-unaligned.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=161565&r1=161564&r2=161565&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Aug 8 20:56:44 2012
@@ -428,7 +428,7 @@
DebugLoc dl = LD->getDebugLoc();
if (VT.isFloatingPoint() || VT.isVector()) {
EVT intVT = EVT::getIntegerVT(*DAG.getContext(), LoadedVT.getSizeInBits());
- if (TLI.isTypeLegal(intVT)) {
+ if (TLI.isTypeLegal(intVT) && TLI.isTypeLegal(LoadedVT)) {
// Expand to a (misaligned) integer load of the same size,
// then bitconvert to floating point or vector.
SDValue newLoad = DAG.getLoad(intVT, dl, Chain, Ptr, LD->getPointerInfo(),
@@ -436,8 +436,9 @@
LD->isNonTemporal(),
LD->isInvariant(), LD->getAlignment());
SDValue Result = DAG.getNode(ISD::BITCAST, dl, LoadedVT, newLoad);
- if (VT.isFloatingPoint() && LoadedVT != VT)
- Result = DAG.getNode(ISD::FP_EXTEND, dl, VT, Result);
+ if (LoadedVT != VT)
+ Result = DAG.getNode(VT.isFloatingPoint() ? ISD::FP_EXTEND :
+ ISD::ANY_EXTEND, dl, VT, Result);
ValResult = Result;
ChainResult = Chain;
Added: llvm/trunk/test/CodeGen/ARM/2012-08-08-legalize-unaligned.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2012-08-08-legalize-unaligned.ll?rev=161565&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2012-08-08-legalize-unaligned.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/2012-08-08-legalize-unaligned.ll Wed Aug 8 20:56:44 2012
@@ -0,0 +1,12 @@
+; RUN: llc < %s
+; PR13111
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32"
+target triple = "armv7-none-linux-gnueabi"
+
+define void @test_hi_char8() noinline {
+entry:
+ %0 = load <4 x i8>* undef, align 1
+ store <4 x i8> %0, <4 x i8>* null, align 4
+ ret void
+}
More information about the llvm-commits
mailing list