From 04d61afa23a64d9fc5f95648509bd5ec002da53e Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Thu, 25 Jul 2013 09:40:48 -0700 Subject: [PATCH] Fix bug in lEmitVaryingSelect() for targets with i1 mask types. Commit 53414f12e6c introduced a but where lEmitVaryingSelect() would try to truncate a vector of i1s to a vector of i1s, which in turn made LLVM's IR analyzer unhappy. --- expr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/expr.cpp b/expr.cpp index f81037f6..856d363c 100644 --- a/expr.cpp +++ b/expr.cpp @@ -3124,7 +3124,8 @@ lEmitVaryingSelect(FunctionEmitContext *ctx, llvm::Value *test, llvm::Value *expr1, llvm::Value *expr2, const Type *type) { #if !defined(LLVM_3_1) - test = ctx->TruncInst(test, LLVMTypes::Int1VectorType); + if (test->getType() != LLVMTypes::Int1VectorType) + test = ctx->TruncInst(test, LLVMTypes::Int1VectorType); return ctx->SelectInst(test, expr1, expr2, "select"); #else llvm::Value *resultPtr = ctx->AllocaInst(expr1->getType(), "selectexpr_tmp");