@@ -847,8 +847,7 @@ struct MemoryDefWrapper {
847847
848848bool hasInitializesAttr (Instruction *I) {
849849 CallBase *CB = dyn_cast<CallBase>(I);
850- return CB != nullptr &&
851- CB->getArgOperandWithAttribute (Attribute::Initializes) != nullptr ;
850+ return CB && CB->getArgOperandWithAttribute (Attribute::Initializes);
852851}
853852
854853struct ArgumentInitInfo {
@@ -1196,7 +1195,7 @@ struct DSEState {
11961195 return MemoryLocation::getOrNone (I);
11971196 }
11981197
1199- // Returns a list of <MemoryLocation, bool> pairs wrote by I.
1198+ // Returns a list of <MemoryLocation, bool> pairs written by I.
12001199 // The bool means whether the write is from Initializes attr.
12011200 SmallVector<std::pair<MemoryLocation, bool >, 1 >
12021201 getLocForInst (Instruction *I, bool ConsiderInitializesAttr) {
@@ -1666,7 +1665,7 @@ struct DSEState {
16661665 // Uses which may read the original MemoryDef mean we cannot eliminate the
16671666 // original MD. Stop walk.
16681667 // If KillingDef is a CallInst with "initializes" attribute, the reads in
1669- // Callee would be dominated by initializations, so this should be safe.
1668+ // the callee would be dominated by initializations, so it should be safe.
16701669 bool IsKillingDefFromInitAttr = false ;
16711670 if (IsInitializesAttrMemLoc) {
16721671 if (KillingI == UseInst &&
@@ -2246,7 +2245,7 @@ struct DSEState {
22462245 // Note that this function considers:
22472246 // 1. Unwind edge: use "initializes" attribute only if the callee has
22482247 // "nounwind" attribute, or the argument has "dead_on_unwind" attribute,
2249- // or the argument is invisble to caller on unwind. That is, we don't
2248+ // or the argument is invisible to caller on unwind. That is, we don't
22502249 // perform incorrect DSE on unwind edges in the current function.
22512250 // 2. Argument alias: for aliasing arguments, the "initializes" attribute is
22522251 // the intersected range list of their "initializes" attributes.
@@ -2282,11 +2281,11 @@ DSEState::getInitializesArgMemLoc(const Instruction *I) {
22822281 // and use the "initializes" attribute to kill dead stores if:
22832282 // - The call does not throw exceptions, "CB->doesNotThrow()".
22842283 // - Or the callee parameter has "dead_on_unwind" attribute.
2285- // - Or the argument is invisible to caller on unwind, and CB isa<CallInst>
2286- // which means no unwind edges from this call in the current function.
2284+ // - Or the argument is invisible to caller on unwind, and there are no
2285+ // unwind edges from this call in the current function (e.g. `CallInst`) .
22872286 bool IsDeadOrInvisibleOnUnwind =
22882287 CB->paramHasAttr (Idx, Attribute::DeadOnUnwind) ||
2289- (isInvisibleToCallerOnUnwind (CurArg ) && isa<CallInst>(CB ));
2288+ (isa<CallInst>(CB ) && isInvisibleToCallerOnUnwind (CurArg ));
22902289 ArgumentInitInfo InitInfo{Idx, IsDeadOrInvisibleOnUnwind, Inits};
22912290 bool FoundAliasing = false ;
22922291 for (auto &[Arg, AliasList] : Arguments) {
0 commit comments