| Index: lib/CodeGen/BranchFolding.cpp
|
| diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
|
| index 2128da1b8aac0673c84eac151f59765ccaa90bc8..353c8450505da8f1d7a62b4d7f40a3a9f2466da4 100644
|
| --- a/lib/CodeGen/BranchFolding.cpp
|
| +++ b/lib/CodeGen/BranchFolding.cpp
|
| @@ -22,6 +22,7 @@
|
| #include "llvm/ADT/Statistic.h"
|
| #include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
|
| #include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
|
| +#include "llvm/CodeGen/MachineConstantPool.h" // @LOCALMOD
|
| #include "llvm/CodeGen/MachineFunctionPass.h"
|
| #include "llvm/CodeGen/MachineJumpTableInfo.h"
|
| #include "llvm/CodeGen/MachineModuleInfo.h"
|
| @@ -247,6 +248,20 @@ bool BranchFolder::OptimizeFunction(MachineFunction &MF,
|
| }
|
| }
|
|
|
| + // @LOCALMOD-START
|
| + // This currently only used on ARM targets where the ConstantPool
|
| + // subclass is overloading getJumpTableIndex()
|
| + const std::vector<MachineConstantPoolEntry>& CPs =
|
| + MF.getConstantPool()->getConstants();
|
| + for (unsigned i = 0, e = CPs.size(); i != e; ++i) {
|
| + if (!CPs[i].isMachineConstantPoolEntry()) continue;
|
| + unsigned *JTIndex = CPs[i].Val.MachineCPVal->getJumpTableIndex();
|
| + if (!JTIndex) continue;
|
| + // Remember that this JT is live.
|
| + JTIsLive.set(*JTIndex);
|
| + }
|
| + // @LOCALMOD-END
|
| +
|
| // Finally, remove dead jump tables. This happens when the
|
| // indirect jump was unreachable (and thus deleted).
|
| for (unsigned i = 0, e = JTIsLive.size(); i != e; ++i)
|
|
|