Skip to content

Commit 1f9c292

Browse files
committed
[FastISel] NFC: Clean up unnecessary bookkeeping
Now that we flush the local value map for every instruction, we don't need any extra flushes for specific cases. Also, LastFlushPoint is not used for anything. Follow-ups to #c161665 (D91734). This reapplies #3fd39d3. Differential Revision: https://reviews.llvm.org/D92338
1 parent 171771e commit 1f9c292

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

llvm/include/llvm/CodeGen/FastISel.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ class FastISel {
224224
/// makes sense (for example, on function calls)
225225
MachineInstr *EmitStartPt;
226226

227-
/// Last local value flush point. On a subsequent flush, no local value will
228-
/// sink past this point.
229-
MachineBasicBlock::iterator LastFlushPoint;
230-
231227
public:
232228
virtual ~FastISel();
233229

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ void FastISel::flushLocalValueMap() {
236236
LastLocalValue = EmitStartPt;
237237
recomputeInsertPt();
238238
SavedInsertPt = FuncInfo.InsertPt;
239-
LastFlushPoint = FuncInfo.InsertPt;
240239
}
241240

242241
bool FastISel::hasTrivialKill(const Value *V) {
@@ -458,8 +457,6 @@ void FastISel::removeDeadCode(MachineBasicBlock::iterator I,
458457
assert(I.isValid() && E.isValid() && std::distance(I, E) > 0 &&
459458
"Invalid iterator!");
460459
while (I != E) {
461-
if (LastFlushPoint == I)
462-
LastFlushPoint = E;
463460
if (SavedInsertPt == I)
464461
SavedInsertPt = E;
465462
if (EmitStartPt == I)
@@ -1210,11 +1207,6 @@ bool FastISel::selectCall(const User *I) {
12101207

12111208
// Handle simple inline asms.
12121209
if (const InlineAsm *IA = dyn_cast<InlineAsm>(Call->getCalledOperand())) {
1213-
// If the inline asm has side effects, then make sure that no local value
1214-
// lives across by flushing the local value map.
1215-
if (IA->hasSideEffects())
1216-
flushLocalValueMap();
1217-
12181210
// Don't attempt to handle constraints.
12191211
if (!IA->getConstraintString().empty())
12201212
return false;
@@ -1244,15 +1236,6 @@ bool FastISel::selectCall(const User *I) {
12441236
if (const auto *II = dyn_cast<IntrinsicInst>(Call))
12451237
return selectIntrinsicCall(II);
12461238

1247-
// Usually, it does not make sense to initialize a value,
1248-
// make an unrelated function call and use the value, because
1249-
// it tends to be spilled on the stack. So, we move the pointer
1250-
// to the last local value to the beginning of the block, so that
1251-
// all the values which have already been materialized,
1252-
// appear after the call. It also makes sense to skip intrinsics
1253-
// since they tend to be inlined.
1254-
flushLocalValueMap();
1255-
12561239
return lowerCall(Call);
12571240
}
12581241

@@ -1409,20 +1392,6 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
14091392
return selectXRayCustomEvent(II);
14101393
case Intrinsic::xray_typedevent:
14111394
return selectXRayTypedEvent(II);
1412-
1413-
case Intrinsic::memcpy:
1414-
case Intrinsic::memcpy_element_unordered_atomic:
1415-
case Intrinsic::memcpy_inline:
1416-
case Intrinsic::memmove:
1417-
case Intrinsic::memmove_element_unordered_atomic:
1418-
case Intrinsic::memset:
1419-
case Intrinsic::memset_element_unordered_atomic:
1420-
// Flush the local value map just like we do for regular calls,
1421-
// to avoid excessive spills and reloads.
1422-
// These intrinsics mostly turn into library calls at O0; and
1423-
// even memcpy_inline should be treated like one for this purpose.
1424-
flushLocalValueMap();
1425-
break;
14261395
}
14271396

14281397
return fastLowerIntrinsicCall(II);

0 commit comments

Comments
 (0)