Skip to content

Commit

Permalink
Refine code style
Browse files Browse the repository at this point in the history
Update the cast/dyn_cast style

Change auto to explicit variable type when there is no hint

Using ! to check nullptr
  • Loading branch information
LiyangLingIntel committed Apr 28, 2024
1 parent 5e2d17d commit c5847b2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions third_party/intel/lib/TritonIntelGPUToLLVM/LoadStoreOpToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ struct LoadOpConversion

// Only lower loadOp with dpas layout encoding
Attribute layoutEncoding = tensorType.getEncoding();
if (layoutEncoding == nullptr)
if (!layoutEncoding)
return failure();
DotOperandEncodingAttr dotLayout =
layoutEncoding.dyn_cast<DotOperandEncodingAttr>();
if (dotLayout == nullptr)
dyn_cast<DotOperandEncodingAttr>(layoutEncoding);
if (!dotLayout)
return failure();
DpasEncodingAttr dpasLayout =
dotLayout.getParent().dyn_cast<DpasEncodingAttr>();
if (dpasLayout == nullptr)
dyn_cast<DpasEncodingAttr>(dotLayout.getParent());
if (!dpasLayout)
return failure();

unsigned opIdx = dotLayout.getOpIdx();
Expand Down Expand Up @@ -287,8 +287,8 @@ struct LoadOpConversion
}

SmallVector<Value> loadedVals;
for (auto &ret : rets) {
VectorType loadTy = unpackType.cast<VectorType>();
for (Value &ret : rets) {
VectorType loadTy = cast<VectorType>(unpackType);
for (size_t i = 0; i < loadTy.getNumElements(); ++i) {
Value loaded = extract_element(ret, i32_val(i));
loadedVals.push_back(loaded);
Expand Down

0 comments on commit c5847b2

Please sign in to comment.