Avoid re-uniquing the constant when it already is an i32
http://reviews.llvm.org/D10838
Files:
lib/CodeGen/CGExprScalar.cpp
Index: lib/CodeGen/CGExprScalar.cpp
===================================================================
--- lib/CodeGen/CGExprScalar.cpp
+++ lib/CodeGen/CGExprScalar.cpp
@@ -1216,7 +1216,15 @@
Value *LHS = nullptr, *RHS = nullptr;
if (CurIdx == 0) {
// insert into undef -> shuffle (src, undef)
- Args.push_back(C);
+ // shufflemask must use an i32
+ if (C->getBitWidth() == 32) {
+ Args.push_back(C);
+ } else {
+ assert(llvm::ConstantInt::isValueValidForType(CGF.Int32Ty,
+
C->getZExtValue())
+ && "Index operand too large for shufflevector mask!");
+ Args.push_back(Builder.getInt32(C->getZExtValue()));
+ }
Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
LHS = EI->getVectorOperand();
Index: lib/CodeGen/CGExprScalar.cpp
===================================================================
--- lib/CodeGen/CGExprScalar.cpp
+++ lib/CodeGen/CGExprScalar.cpp
@@ -1216,7 +1216,15 @@
Value *LHS = nullptr, *RHS = nullptr;
if (CurIdx == 0) {
// insert into undef -> shuffle (src, undef)
- Args.push_back(C);
+ // shufflemask must use an i32
+ if (C->getBitWidth() == 32) {
+ Args.push_back(C);
+ } else {
+ assert(llvm::ConstantInt::isValueValidForType(CGF.Int32Ty,
+ C->getZExtValue())
+ && "Index operand too large for shufflevector mask!");
+ Args.push_back(Builder.getInt32(C->getZExtValue()));
+ }
Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
LHS = EI->getVectorOperand();
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits