Skip to content

Commit

Permalink
Update LLVM (google#1328)
Browse files Browse the repository at this point in the history
- getAsInstruction do not insert the node anymore. Need to be done
  separately.
- getInRangeIndex is now getInRange
  • Loading branch information
rjodinchr authored Mar 20, 2024
1 parent d73ecb6 commit 93f7e06
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"subrepo" : "llvm/llvm-project",
"branch" : "main",
"subdir" : "third_party/llvm",
"commit" : "276847a65af67bdc4eb79989f196d1968cb50ae6"
"commit" : "1b5b4eebb6a012cf223954013d34c6e896720822"
},
{
"name" : "SPIRV-Headers",
Expand Down
9 changes: 6 additions & 3 deletions lib/BitcastUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,8 @@ bool RemoveCstExprFromFunction(Function *F) {
Value *Scalar = B.CreateExtractValue(CstArray, i);
auto *ScalarCst = dyn_cast<ConstantExpr>(Scalar);
if (ScalarCst) {
auto *ScalarInst = ScalarCst->getAsInstruction(InsertBefore);
auto *ScalarInst = ScalarCst->getAsInstruction();
ScalarInst->insertBefore(InsertBefore);
ArrayNew = B.CreateInsertValue(ArrayNew, ScalarInst, i);
WorkList.push_back(std::make_pair(ScalarInst, OperandId));
} else {
Expand All @@ -878,7 +879,8 @@ bool RemoveCstExprFromFunction(Function *F) {
for (unsigned i = 0; i < numEle; ++i) {
Value *Scalar = B.CreateExtractElement(CstVector, i);
if (auto *CstScalar = dyn_cast<ConstantExpr>(Scalar)) {
auto ScalarInst = CstScalar->getAsInstruction(InsertBefore);
auto ScalarInst = CstScalar->getAsInstruction();
ScalarInst->insertBefore(InsertBefore);
VecNew = B.CreateInsertElement(VecNew, ScalarInst, i);
WorkList.push_back(std::make_pair(ScalarInst, OperandId));
} else {
Expand All @@ -888,7 +890,8 @@ bool RemoveCstExprFromFunction(Function *F) {
I->setOperand(OperandId, VecNew);
} else if (auto CstExpr =
dyn_cast<ConstantExpr>(I->getOperand(OperandId))) {
auto Operand = CstExpr->getAsInstruction(InsertBefore);
auto Operand = CstExpr->getAsInstruction();
Operand->insertBefore(InsertBefore);
CheckInstruction(Operand);
I->setOperand(OperandId, Operand);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/LongVectorLoweringPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ Value *clspv::LongVectorLoweringPass::visitConstant(Constant &Cst) {

auto *EquivalentGEP = ConstantExpr::getGetElementPtr(
EquivalentSourceTy, EquivalentPointer, Indices, GEP->isInBounds(),
GEP->getInRangeIndex());
GEP->getInRange());

return EquivalentGEP;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/SPIRVProducerPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2368,8 +2368,8 @@ SPIRVID SPIRVProducerPassImpl::getSPIRVConstant(Constant *C) {
// If there is exactly one use we know where to insert the instruction
if (ConstExpr->getNumUses() == 1) {
auto *User = *ConstExpr->user_begin();
auto *EquivInstr =
ConstExpr->getAsInstruction(dyn_cast<Instruction>(User));
auto *EquivInstr = ConstExpr->getAsInstruction();
EquivInstr->insertBefore(dyn_cast<Instruction>(User));
GenerateInstruction(*EquivInstr);
RID = VMap[EquivInstr];
} else {
Expand Down
3 changes: 2 additions & 1 deletion lib/SimplifyPointerBitcastPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ bool clspv::SimplifyPointerBitcastPass::runOnBitcastFromBitcast(
if (!OtherBitcast) {
auto CE = dyn_cast<ConstantExpr>(Bitcast->getOperand(0));
assert(CE && CE->getOpcode() == Instruction::BitCast);
OtherBitcast = CE->getAsInstruction(Bitcast);
OtherBitcast = CE->getAsInstruction();
OtherBitcast->insertBefore(Bitcast);
}
LLVM_DEBUG(dbgs() << "\n##runOnBitcastFromBitcast:\nremove:";
Bitcast->dump());
Expand Down
2 changes: 1 addition & 1 deletion lib/ThreeElementVectorLoweringPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ Value *clspv::ThreeElementVectorLoweringPass::visitConstant(Constant &Cst) {

auto *EquivalentGEP = ConstantExpr::getGetElementPtr(
EquivalentSourceTy, EquivalentPointer, Indices, GEP->isInBounds(),
GEP->getInRangeIndex());
GEP->getInRange());

return EquivalentGEP;
}
Expand Down

0 comments on commit 93f7e06

Please sign in to comment.