Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -10673,6 +10673,10 @@ bool NoVectors = DAG.getMachineFunction().getFunction()->hasFnAttribute( Attribute::NoImplicitFloat); + // This function cannot currently deal with non-byte-sized memory sizes. + if (ElementSizeBytes * 8 != MemVT.getSizeInBits()) + return false; + // Don't merge vectors into wider inputs. if (MemVT.isVector() || !MemVT.isSimple()) return false; Index: llvm/trunk/test/CodeGen/X86/merge-consecutive-stores-i1.ll =================================================================== --- llvm/trunk/test/CodeGen/X86/merge-consecutive-stores-i1.ll +++ llvm/trunk/test/CodeGen/X86/merge-consecutive-stores-i1.ll @@ -0,0 +1,15 @@ +; RUN: llc -march=x86-64 < %s + +; Ensure that MergeConsecutiveStores doesn't crash when dealing with +; i1 operands. + +%struct.X = type { i1, i1 } + +@b = common global %struct.X zeroinitializer, align 4 + +define void @foo() { +entry: + store i1 0, i1* getelementptr inbounds (%struct.X, %struct.X* @b, i64 0, i32 0), align 4 + store i1 0, i1* getelementptr inbounds (%struct.X, %struct.X* @b, i64 0, i32 1), align 1 + ret void +}