Skip to content

Commit c51e91e

Browse files
committed
Revert "[Passes] Add relative lookup table converter pass"
This reverts commit 5178ffc. Compiling `llvm-profdata` with a compiler build from this produces a crashing binary.
1 parent 6b3fb47 commit c51e91e

26 files changed

Lines changed: 16 additions & 743 deletions

‎llvm/docs/Passes.rst‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -973,11 +973,6 @@ corresponding to the reverse post order traversal of current function (starting
973973
at 2), which effectively gives values in deep loops higher rank than values not
974974
in loops.
975975

976-
``-rel-lookup-table-converter``: Relative lookup table converter
977-
----------------------------------------------------------------
978-
979-
This pass converts lookup tables to PIC-friendly relative lookup tables.
980-
981976
``-reg2mem``: Demote all values to stack slots
982977
----------------------------------------------
983978

‎llvm/include/llvm/Analysis/TargetTransformInfo.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,6 @@ class TargetTransformInfo {
718718
/// containing this constant value for the target.
719719
bool shouldBuildLookupTablesForConstant(Constant *C) const;
720720

721-
/// Return true if lookup tables should be turned into relative lookup tables.
722-
bool shouldBuildRelLookupTables() const;
723-
724721
/// Return true if the input function which is cold at all call sites,
725722
/// should use coldcc calling convention.
726723
bool useColdCCForColdCall(Function &F) const;
@@ -1484,7 +1481,6 @@ class TargetTransformInfo::Concept {
14841481
virtual unsigned getRegUsageForType(Type *Ty) = 0;
14851482
virtual bool shouldBuildLookupTables() = 0;
14861483
virtual bool shouldBuildLookupTablesForConstant(Constant *C) = 0;
1487-
virtual bool shouldBuildRelLookupTables() = 0;
14881484
virtual bool useColdCCForColdCall(Function &F) = 0;
14891485
virtual unsigned getScalarizationOverhead(VectorType *Ty,
14901486
const APInt &DemandedElts,
@@ -1871,9 +1867,6 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
18711867
bool shouldBuildLookupTablesForConstant(Constant *C) override {
18721868
return Impl.shouldBuildLookupTablesForConstant(C);
18731869
}
1874-
bool shouldBuildRelLookupTables() override {
1875-
return Impl.shouldBuildRelLookupTables();
1876-
}
18771870
bool useColdCCForColdCall(Function &F) override {
18781871
return Impl.useColdCCForColdCall(F);
18791872
}

‎llvm/include/llvm/Analysis/TargetTransformInfoImpl.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,8 @@ class TargetTransformInfoImplBase {
292292
unsigned getRegUsageForType(Type *Ty) const { return 1; }
293293

294294
bool shouldBuildLookupTables() const { return true; }
295-
296295
bool shouldBuildLookupTablesForConstant(Constant *C) const { return true; }
297296

298-
bool shouldBuildRelLookupTables() const { return false; }
299-
300297
bool useColdCCForColdCall(Function &F) const { return false; }
301298

302299
unsigned getScalarizationOverhead(VectorType *Ty, const APInt &DemandedElts,

‎llvm/include/llvm/CodeGen/BasicTTIImpl.h‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "llvm/Support/ErrorHandling.h"
4646
#include "llvm/Support/MachineValueType.h"
4747
#include "llvm/Support/MathExtras.h"
48-
#include "llvm/Target/TargetMachine.h"
4948
#include <algorithm>
5049
#include <cassert>
5150
#include <cstdint>
@@ -380,25 +379,6 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
380379
TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other);
381380
}
382381

383-
bool shouldBuildRelLookupTables() {
384-
const TargetMachine &TM = getTLI()->getTargetMachine();
385-
// If non-PIC mode, do not generate a relative lookup table.
386-
if (!TM.isPositionIndependent())
387-
return false;
388-
389-
if (!TM.getTargetTriple().isArch64Bit())
390-
return false;
391-
392-
/// Relative lookup table entries consist of 32-bit offsets.
393-
/// Do not generate relative lookup tables for large code models
394-
/// in 64-bit achitectures where 32-bit offsets might not be enough.
395-
if (TM.getCodeModel() == CodeModel::Medium ||
396-
TM.getCodeModel() == CodeModel::Large)
397-
return false;
398-
399-
return true;
400-
}
401-
402382
bool haveFastSqrt(Type *Ty) {
403383
const TargetLoweringBase *TLI = getTLI();
404384
EVT VT = TLI->getValueType(DL, Ty);

‎llvm/include/llvm/InitializePasses.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ void initializeModuloScheduleTestPass(PassRegistry&);
318318
void initializeMustExecutePrinterPass(PassRegistry&);
319319
void initializeMustBeExecutedContextPrinterPass(PassRegistry&);
320320
void initializeNameAnonGlobalLegacyPassPass(PassRegistry&);
321-
void initializeRelLookupTableConverterLegacyPassPass(PassRegistry &);
322321
void initializeNaryReassociateLegacyPassPass(PassRegistry&);
323322
void initializeNewGVNLegacyPassPass(PassRegistry&);
324323
void initializeObjCARCAAWrapperPassPass(PassRegistry&);

‎llvm/include/llvm/Transforms/Scalar.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ FunctionPass *createLoopDataPrefetchPass();
517517

518518
///===---------------------------------------------------------------------===//
519519
ModulePass *createNameAnonGlobalPass();
520-
ModulePass *createRelLookupTableConverterPass();
521520
ModulePass *createCanonicalizeAliasesPass();
522521

523522
//===----------------------------------------------------------------------===//

‎llvm/include/llvm/Transforms/Utils/RelLookupTableConverter.h‎

Lines changed: 0 additions & 70 deletions
This file was deleted.

‎llvm/lib/Analysis/TargetTransformInfo.cpp‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,16 +456,11 @@ unsigned TargetTransformInfo::getRegUsageForType(Type *Ty) const {
456456
bool TargetTransformInfo::shouldBuildLookupTables() const {
457457
return TTIImpl->shouldBuildLookupTables();
458458
}
459-
460459
bool TargetTransformInfo::shouldBuildLookupTablesForConstant(
461460
Constant *C) const {
462461
return TTIImpl->shouldBuildLookupTablesForConstant(C);
463462
}
464463

465-
bool TargetTransformInfo::shouldBuildRelLookupTables() const {
466-
return TTIImpl->shouldBuildRelLookupTables();
467-
}
468-
469464
bool TargetTransformInfo::useColdCCForColdCall(Function &F) const {
470465
return TTIImpl->useColdCCForColdCall(F);
471466
}

‎llvm/lib/Passes/PassBuilder.cpp‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@
227227
#include "llvm/Transforms/Utils/Mem2Reg.h"
228228
#include "llvm/Transforms/Utils/MetaRenamer.h"
229229
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
230-
#include "llvm/Transforms/Utils/RelLookupTableConverter.h"
231230
#include "llvm/Transforms/Utils/StripGCRelocates.h"
232231
#include "llvm/Transforms/Utils/StripNonLineTableDebugInfo.h"
233232
#include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -1409,8 +1408,6 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
14091408
MPM.addPass(GlobalDCEPass());
14101409
MPM.addPass(ConstantMergePass());
14111410

1412-
MPM.addPass(RelLookupTableConverterPass());
1413-
14141411
return MPM;
14151412
}
14161413

‎llvm/lib/Passes/PassRegistry.def‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ MODULE_PASS("khwasan", HWAddressSanitizerPass(true, true))
6363
MODULE_PASS("inferattrs", InferFunctionAttrsPass())
6464
MODULE_PASS("inliner-wrapper", ModuleInlinerWrapperPass())
6565
MODULE_PASS("inliner-wrapper-no-mandatory-first", ModuleInlinerWrapperPass(
66-
getInlineParams(),
67-
DebugLogging,
66+
getInlineParams(),
67+
DebugLogging,
6868
false))
6969
MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
7070
MODULE_PASS("instrorderfile", InstrOrderFilePass())
@@ -93,7 +93,6 @@ MODULE_PASS("print-lcg-dot", LazyCallGraphDOTPrinterPass(dbgs()))
9393
MODULE_PASS("print-must-be-executed-contexts", MustBeExecutedContextPrinterPass(dbgs()))
9494
MODULE_PASS("print-stack-safety", StackSafetyGlobalPrinterPass(dbgs()))
9595
MODULE_PASS("print<module-debuginfo>", ModuleDebugInfoPrinterPass(dbgs()))
96-
MODULE_PASS("rel-lookup-table-converter", RelLookupTableConverterPass())
9796
MODULE_PASS("rewrite-statepoints-for-gc", RewriteStatepointsForGC())
9897
MODULE_PASS("rewrite-symbols", RewriteSymbolPass())
9998
MODULE_PASS("rpo-function-attrs", ReversePostOrderFunctionAttrsPass())
@@ -282,7 +281,7 @@ FUNCTION_PASS("print<demanded-bits>", DemandedBitsPrinterPass(dbgs()))
282281
FUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
283282
FUNCTION_PASS("print<func-properties>", FunctionPropertiesPrinterPass(dbgs()))
284283
FUNCTION_PASS("print<inline-cost>", InlineCostAnnotationPrinterPass(dbgs()))
285-
FUNCTION_PASS("print<inliner-size-estimator>",
284+
FUNCTION_PASS("print<inliner-size-estimator>",
286285
InlineSizeEstimatorAnalysisPrinterPass(dbgs()))
287286
FUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
288287
FUNCTION_PASS("print<memoryssa>", MemorySSAPrinterPass(dbgs()))

0 commit comments

Comments
 (0)