Skip to content

Commit b8f24a5

Browse files
kwkkcloudy0717
authored andcommitted
Add parentheses around '&&' within '||' (llvm#170652)
Addresses this warning: ``` /home/fedora/src/llvm-project/main/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:3358 79: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] 3358 | (getImm(I.getOperand(4), MRI) && foldImm(I.getOperand(4), MRI) == 0) && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ 3359 | "Cannot translate GEP to OpAccessChain. First index must be 0."); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
1 parent 3f47097 commit b8f24a5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,10 +3353,11 @@ bool SPIRVInstructionSelector::selectGEP(Register ResVReg,
33533353
.addUse(GR.getSPIRVTypeID(ResType))
33543354
// Object to get a pointer to.
33553355
.addUse(I.getOperand(3).getReg());
3356-
assert(Opcode == SPIRV::OpPtrAccessChain ||
3357-
Opcode == SPIRV::OpInBoundsPtrAccessChain ||
3358-
(getImm(I.getOperand(4), MRI) && foldImm(I.getOperand(4), MRI) == 0) &&
3359-
"Cannot translate GEP to OpAccessChain. First index must be 0.");
3356+
assert(
3357+
(Opcode == SPIRV::OpPtrAccessChain ||
3358+
Opcode == SPIRV::OpInBoundsPtrAccessChain ||
3359+
(getImm(I.getOperand(4), MRI) && foldImm(I.getOperand(4), MRI) == 0)) &&
3360+
"Cannot translate GEP to OpAccessChain. First index must be 0.");
33603361

33613362
// Adding indices.
33623363
const unsigned StartingIndex =

0 commit comments

Comments
 (0)