<p dir="ltr">It would seem cleaner to build an ImplicitCastExpr node in Sema between the operand and the splat node.</p>
<div class="gmail_quote">On Nov 20, 2015 11:04 AM, "George Burgess IV" <<a href="mailto:george.burgess.iv@gmail.com">george.burgess.iv@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">george.burgess.iv created this revision.<br>
george.burgess.iv added a reviewer: rsmith.<br>
george.burgess.iv added a subscriber: cfe-commits.<br>
<br>
When evaluating constexpr vector splats, we weren't doing appropriate type conversions on the literal we were splatting, causing assertion failures in cases like:<br>
<br>
```<br>
void foo(vector float FloatInput, vector short ShortInput) {<br>
  (void)(FloatInput == (vector float)0); // OK<br>
  (void)(ShortInput == (vector short)0); // OK<br>
<br>
  constexpr vector float Floats = (vector float)0;<br>
  (void)(FloatInput == Floats); // ICE -- fcmp between [4 x i32] and [4 x f32]<br>
<br>
  constexpr vector short Shorts = (vector short)0;<br>
  (void)(ShortInput == Shorts); // ICE -- fcmp between vec of i16 and vec of i32<br>
}<br>
```<br>
<br>
(The same issue applied for cases like `(vector short)0`; it would be lowered as a vector of `i32`.)<br>
<br>
This patch fixes these in ExprConstant rather than CodeGen, because it allows us to more sanely model overflow/complain to the user/... in the evaluator.<br>
<br>
This patch also contains a few generic code cleanliness changes. I'm happy to drop any/all of them if we decide they're not helpful. :)<br>
<br>
<a href="http://reviews.llvm.org/D14877" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14877</a><br>
<br>
Files:<br>
  lib/AST/ExprConstant.cpp<br>
  lib/CodeGen/CGExprConstant.cpp<br>
  test/CodeGenCXX/builtins-systemz-zvector.cpp<br>
<br>
</blockquote></div>