[Beignet] [PATCH] GBE: don't try to erase a llvm:Constant.
Ruiling Song
ruiling.song at intel.com
Mon Mar 7 07:08:07 UTC 2016
If it is a llvm::Constant, don't add it to erase candidate.
The reason I make this change is it cannot cast to llvm::Instruction.
I think we still need to make clear whether or not we should
delete a constant and how.
Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
backend/src/llvm/ExpandLargeIntegers.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/backend/src/llvm/ExpandLargeIntegers.cpp b/backend/src/llvm/ExpandLargeIntegers.cpp
index 00987cb..e466665 100644
--- a/backend/src/llvm/ExpandLargeIntegers.cpp
+++ b/backend/src/llvm/ExpandLargeIntegers.cpp
@@ -324,12 +324,14 @@ static Value *buildVectorOrScalar(ConversionState &State, IRBuilder<> &IRB, Smal
Value * vec = NULL;
unsigned ElemNo = Elements.size();
Type *ElemTy = Elements[0]->getType();
+ // if it is illegal integer type, these instructions will be further
+ // splited, that's why these temporary values should be erased.
bool KeepInsert = isLegalBitSize(ElemTy->getPrimitiveSizeInBits() * ElemNo);
for (unsigned i = 0; i < ElemNo; ++i) {
Value *tmp = vec ? vec : UndefValue::get(VectorType::get(ElemTy, ElemNo));
Value *idx = ConstantInt::get(IntTy, i);
vec = IRB.CreateInsertElement(tmp, Elements[i], idx);
- if (!KeepInsert) {
+ if (!KeepInsert && !isa<Constant>(vec)) {
State.addEraseCandidate(cast<Instruction>(vec));
}
}
--
2.4.1
More information about the Beignet
mailing list