LLVM error in PMINSD or PMAXSD when combined with LTO

Hello all,

I am reporting this here since it is displayed as an LLVM error, but
let me know if it is a clang issue instead. Here is the repro case:

#include <smmintrin.h>

int main() {
    __m128i a = _mm_set1_epi32(2);
    __m128i b = _mm_set1_epi32(1);
    __m128i c = _mm_min_epi32(a, b); // or _mm_max_epi32
    return c[0] == 0; // just so c doesn't opt away

And here is the error that occurs when compiling with "clang -flto
-msse4.1 test.c":

LLVM ERROR: Cannot select: 0x1d866d0: v4i32 = X86ISD::SMIN 0x1d85dd0,
0x1d89410 [ORD=1] [ID=16]
  0x1d85dd0: v4i32 = bitcast 0x1d85cd0 [ORD=1] [ID=14]
    0x1d85cd0: v2i64,ch = load 0x1d560f8, 0x1d89310,
0x1d860d0<LD16[ConstantPool]> [ORD=1] [ID=12]
      0x1d89310: i64 = X86ISD::Wrapper 0x1d85fd0 [ID=10]
        0x1d85fd0: i64 = TargetConstantPool<<4 x i32> <i32 2, i32 2,
i32 2, i32 2>> 0 [ID=6]
      0x1d860d0: i64 = undef [ID=5]
  0x1d89410: v4i32 = bitcast 0x1d85ed0 [ORD=1] [ID=15]
    0x1d85ed0: v2i64,ch = load 0x1d560f8, 0x1d89510,
0x1d860d0<LD16[ConstantPool]> [ORD=1] [ID=13]
      0x1d89510: i64 = X86ISD::Wrapper 0x1d862d0 [ID=11]
        0x1d862d0: i64 = TargetConstantPool<<4 x i32> <i32 1, i32 1,
i32 1, i32 1>> 0 [ID=7]
      0x1d860d0: i64 = undef [ID=5]

However everything works as expected without "-flto".

I've reproduced this in LLVM 3.4.2 as well as the trunk (built a few
days ago) on Linux and OS X.

Thanks for your help!