This fixes lowering of mm*_undefined* intrinsics to use freeze poison instead of zeroinitializer.
(mentioned & discussed in D103874)
There are tests like test/CodeGen/X86/avx-intrinsics-fast-isel.ll that are supposed to contain the IR the frontend generates. They mostly contain optimized IR, but then run fast-isel in the backend. I don't think all intrinsics are tested this way.
- Update llvm's fast-isels tests for undefined intrinsics to compile freeze(poison)
- Update X86ISelLowering's getAVX2GatherNode and getGatherNode to consider freeze(poison) as well
- Update DAGCombiner to fold bitcast(freeze(poison)) -> freeze(poison)
I think to correctly emit IR for intrinsics like mm256_castsi128_si256 (D103874 has more context) efficient handling of this kind of pattern is necessary:
%v = freeze <n x ty> poison %w = shufflevector %a, %v, mask
The zeroinitializer folding is done by InstCombine's visitFreeze, which should be fixed maybe.
I'll play with some patterns and create patches for this.