[PATCH] D110179: [NFC][IR] Remove unused assignment to Offset
Alf via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 07:53:01 PST 2022
gAlfonso-bit updated this revision to Diff 480913.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110179/new/
https://reviews.llvm.org/D110179
Files:
llvm/lib/IR/Operator.cpp
Index: llvm/lib/IR/Operator.cpp
===================================================================
--- llvm/lib/IR/Operator.cpp
+++ llvm/lib/IR/Operator.cpp
@@ -63,7 +63,7 @@
Align Result = Align(llvm::Value::MaximumAlignment);
for (gep_type_iterator GTI = gep_type_begin(this), GTE = gep_type_end(this);
GTI != GTE; ++GTI) {
- int64_t Offset = 1;
+ uint64_t Offset;
ConstantInt *OpC = dyn_cast<ConstantInt>(GTI.getOperand());
if (StructType *STy = GTI.getStructTypeOrNull()) {
@@ -71,11 +71,9 @@
Offset = SL->getElementOffset(OpC->getZExtValue());
} else {
assert(GTI.isSequential() && "should be sequencial");
- /// If the index isn't know we take 1 because it is the index that will
+ /// If the index isn't known, we take 1 because it is the index that will
/// give the worse alignment of the offset.
- int64_t ElemCount = 1;
- if (OpC)
- ElemCount = OpC->getZExtValue();
+ const uint64_t ElemCount = OpC ? OpC->getZExtValue() : 1;
Offset = DL.getTypeAllocSize(GTI.getIndexedType()) * ElemCount;
}
Result = Align(MinAlign(Offset, Result.value()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110179.480913.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221207/ff44730a/attachment-0001.bin>
More information about the llvm-commits
mailing list