Skip to content

Commit ab1327f

Browse files
committed
drive by clean up
1 parent e938943 commit ab1327f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/lib/Target/DirectX/DXILDataScalarization.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,11 @@ bool DataScalarizerVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
307307
bool NeedsTransform = false;
308308

309309
// Unwrap GEP ConstantExprs to find the base operand and element type
310-
while (auto *CE = dyn_cast<ConstantExpr>(PtrOperand)) {
311-
if (auto *GEPCE = dyn_cast<GEPOperator>(CE)) {
312-
GOp = GEPCE;
313-
PtrOperand = GEPCE->getPointerOperand();
314-
NewGEPType = GEPCE->getSourceElementType();
315-
} else
316-
break;
310+
while (auto *GEPCE = dyn_cast_or_null<GEPOperator>(
311+
dyn_cast<ConstantExpr>(PtrOperand))) {
312+
GOp = GEPCE;
313+
PtrOperand = GEPCE->getPointerOperand();
314+
NewGEPType = GEPCE->getSourceElementType();
317315
}
318316

319317
if (GlobalVariable *NewGlobal = lookupReplacementGlobal(PtrOperand)) {

0 commit comments

Comments
 (0)