Skip to content

Commit f2dd02c

Browse files
Implemented suggested changes
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent 73b228a commit f2dd02c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

llvm/include/llvm/CodeGen/TargetPassConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class TargetPassConfig : public ImmutablePass {
457457

458458
/// Add a CodeGen pass at this point in the pipeline after checking overrides.
459459
/// Return the pass that was added, or zero if no pass was added.
460-
AnalysisID addPass(AnalysisID PassID);
460+
AnalysisID addPass(IdentifyingPassPtr PassID);
461461

462462
/// Add a pass to the PassManager if that pass is supposed to be run, as
463463
/// determined by the StartAfter and StopAfter options. Takes ownership of the

llvm/lib/CodeGen/TargetPassConfig.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,9 @@ void TargetPassConfig::addPass(Pass *P) {
745745
///
746746
/// addPass cannot return a pointer to the pass instance because is internal the
747747
/// PassManager and the instance we create here may already be freed.
748-
AnalysisID TargetPassConfig::addPass(AnalysisID PassID) {
748+
AnalysisID TargetPassConfig::addPass(IdentifyingPassPtr PassPtr) {
749+
AnalysisID PassID = PassPtr.isInstance() ? PassPtr.getInstance()->getPassID()
750+
: PassPtr.getID();
749751
IdentifyingPassPtr TargetID = getPassSubstitution(PassID);
750752
IdentifyingPassPtr FinalPtr = overridePass(PassID, TargetID);
751753
if (!FinalPtr.isValid())
@@ -1513,8 +1515,7 @@ void TargetPassConfig::addMachineLateOptimization() {
15131515
// Cleanup of redundant immediate/address loads.
15141516
addPass(&MachineLateInstrsCleanupID);
15151517

1516-
// Branch folding must be run after regalloc and prolog/epilog insertion.
1517-
addPass(createBranchFolderPass(getEnableTailMerge()));
1518+
addPass(IdentifyingPassPtr(createBranchFolderPass(getEnableTailMerge())));
15181519

15191520
// Tail duplication.
15201521
// Note that duplicating tail just increases code size and degrades

0 commit comments

Comments
 (0)