It would seem cleaner to build an ImplicitCastExpr node in Sema between the operand and the splat node. On Nov 20, 2015 11:04 AM, "George Burgess IV" <george.burgess...@gmail.com> wrote:
> george.burgess.iv created this revision. > george.burgess.iv added a reviewer: rsmith. > george.burgess.iv added a subscriber: cfe-commits. > > When evaluating constexpr vector splats, we weren't doing appropriate type > conversions on the literal we were splatting, causing assertion failures in > cases like: > > ``` > void foo(vector float FloatInput, vector short ShortInput) { > (void)(FloatInput == (vector float)0); // OK > (void)(ShortInput == (vector short)0); // OK > > constexpr vector float Floats = (vector float)0; > (void)(FloatInput == Floats); // ICE -- fcmp between [4 x i32] and [4 x > f32] > > constexpr vector short Shorts = (vector short)0; > (void)(ShortInput == Shorts); // ICE -- fcmp between vec of i16 and vec > of i32 > } > ``` > > (The same issue applied for cases like `(vector short)0`; it would be > lowered as a vector of `i32`.) > > 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. > > 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. :) > > http://reviews.llvm.org/D14877 > > Files: > lib/AST/ExprConstant.cpp > lib/CodeGen/CGExprConstant.cpp > test/CodeGenCXX/builtins-systemz-zvector.cpp > >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits