Skip to content

Commit 9af7da6

Browse files
code clean up
1 parent 9d2df70 commit 9af7da6

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ void SPIRVInstPrinter::printOpConstantVarOps(const MCInst *MI,
5252
const unsigned Opcode = MI->getOpcode();
5353

5454
// We support up to 1024 bits for integers, and 64 bits for floats
55-
assert(((NumVarOps <= 32 && Opcode == SPIRV::OpConstantI) ||
56-
(NumVarOps <= 2 && Opcode == SPIRV::OpConstantF)) &&
55+
assert(((NumVarOps <= 32 && Opcode == SPIRV::OpConstantI) ||
56+
(NumVarOps <= 2 && Opcode == SPIRV::OpConstantF)) &&
5757
"Unsupported number of operands for constant");
5858

5959
O << ' ';

llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ Register SPIRVGlobalRegistry::createConstFP(const ConstantFP *CF,
343343
return Res;
344344
}
345345

346-
Register SPIRVGlobalRegistry::getOrCreateConstInt(const APInt Val, MachineInstr &I,
346+
Register SPIRVGlobalRegistry::getOrCreateConstInt(const APInt Val,
347+
MachineInstr &I,
347348
SPIRVType *SpvType,
348349
const SPIRVInstrInfo &TII,
349350
bool ZeroAsNull) {
@@ -361,7 +362,7 @@ Register SPIRVGlobalRegistry::getOrCreateConstInt(uint64_t Val, MachineInstr &I,
361362
const SPIRVInstrInfo &TII,
362363
bool ZeroAsNull) {
363364
const IntegerType *Ty = cast<IntegerType>(getTypeForSPIRVType(SpvType));
364-
ConstantInt *const CI = ConstantInt::get(const_cast<IntegerType *>(Ty), Val);
365+
auto *const CI = ConstantInt::get(const_cast<IntegerType *>(Ty), Val);
365366
const MachineInstr *MI = findMI(CI, CurMF);
366367
if (MI && (MI->getOpcode() == SPIRV::OpConstantNull ||
367368
MI->getOpcode() == SPIRV::OpConstantI))
@@ -388,7 +389,7 @@ Register SPIRVGlobalRegistry::createConstInt(const Constant *CA,
388389
if (BitWidth == 1) {
389390
MIB = MIRBuilder
390391
.buildInstr(CA->isZeroValue() ? SPIRV::OpConstantFalse
391-
: SPIRV::OpConstantTrue)
392+
: SPIRV::OpConstantTrue)
392393
.addDef(Res)
393394
.addUse(getSPIRVTypeID(SpvType));
394395
} else if (!CA->isZeroValue() || !ZeroAsNull) {

llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ class SPIRVGlobalRegistry : public SPIRVIRMapping {
515515
Register buildConstantInt(uint64_t Val, MachineIRBuilder &MIRBuilder,
516516
SPIRVType *SpvType, bool EmitIR,
517517
bool ZeroAsNull = true);
518-
Register getOrCreateConstInt(APInt Val, MachineInstr &I,
519-
SPIRVType *SpvType, const SPIRVInstrInfo &TII,
518+
Register getOrCreateConstInt(APInt Val, MachineInstr &I, SPIRVType *SpvType,
519+
const SPIRVInstrInfo &TII,
520520
bool ZeroAsNull = true);
521521
Register getOrCreateConstInt(uint64_t Val, MachineInstr &I,
522522
SPIRVType *SpvType, const SPIRVInstrInfo &TII,

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,12 +2939,12 @@ bool SPIRVInstructionSelector::selectConst(Register ResVReg,
29392939
Reg = GR.getOrCreateConstFP(I.getOperand(1).getFPImm()->getValue(), I,
29402940
ResType, TII, !STI.isShader());
29412941
} else {
2942-
if(GR.getScalarOrVectorBitWidth(ResType) <= 64) {
2942+
if (GR.getScalarOrVectorBitWidth(ResType) <= 64) {
29432943
Reg = GR.getOrCreateConstInt(I.getOperand(1).getCImm()->getZExtValue(), I,
2944-
ResType, TII, !STI.isShader());
2944+
ResType, TII, !STI.isShader());
29452945
} else {
29462946
Reg = GR.getOrCreateConstInt(I.getOperand(1).getCImm()->getValue(), I,
2947-
ResType, TII, !STI.isShader());
2947+
ResType, TII, !STI.isShader());
29482948
}
29492949
}
29502950
return Reg == ResVReg ? true : BuildCOPY(ResVReg, Reg, I);

0 commit comments

Comments
 (0)