forked from OSchip/llvm-project
[Hexagon] Use InstSimplify instead of ConstantProp
This is the last remaining use of ConstantProp, migrate it to InstSimplify in the goal of removing ConstantProp. Add -hexagon-instsimplify option to enable skipping of instsimplify in tests that can't handle the extra optimization. Differential Revision: https://reviews.llvm.org/D85047
This commit is contained in:
parent
4a47f1c4ce
commit
f50b3ff02e
|
@ -530,6 +530,13 @@ Pass *createLoopSimplifyCFGPass();
|
|||
// transformations.
|
||||
//
|
||||
Pass *createWarnMissedTransformationsPass();
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This pass does instruction simplification on each
|
||||
// instruction in a function.
|
||||
//
|
||||
FunctionPass *createInstSimplifyLegacyPass();
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,10 +36,6 @@ public:
|
|||
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
|
||||
};
|
||||
|
||||
/// Create a legacy pass that does instruction simplification on each
|
||||
/// instruction in a function.
|
||||
FunctionPass *createInstSimplifyLegacyPass();
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_TRANSFORMS_UTILS_INSTSIMPLIFYPASS_H
|
||||
|
|
|
@ -101,6 +101,10 @@ static cl::opt<bool> EnableInitialCFGCleanup("hexagon-initial-cfg-cleanup",
|
|||
cl::Hidden, cl::ZeroOrMore, cl::init(true),
|
||||
cl::desc("Simplify the CFG after atomic expansion pass"));
|
||||
|
||||
static cl::opt<bool> EnableInstSimplify("hexagon-instsimplify", cl::Hidden,
|
||||
cl::ZeroOrMore, cl::init(true),
|
||||
cl::desc("Enable instsimplify"));
|
||||
|
||||
/// HexagonTargetMachineModule - Note that this is used on hosts that
|
||||
/// cannot link in a library unless there are references into the
|
||||
/// library. In particular, it seems that it is not possible to get
|
||||
|
@ -312,7 +316,8 @@ void HexagonPassConfig::addIRPasses() {
|
|||
bool NoOpt = (getOptLevel() == CodeGenOpt::None);
|
||||
|
||||
if (!NoOpt) {
|
||||
addPass(createConstantPropagationPass());
|
||||
if (EnableInstSimplify)
|
||||
addPass(createInstSimplifyLegacyPass());
|
||||
addPass(createDeadCodeEliminationPass());
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
using namespace llvm;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; Make sure we can select QFALSE.
|
||||
; CHECK: vcmp.gt(v0.w,v0.w)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; Check that a setcc of a vector pair is handled (without crashing).
|
||||
; CHECK: vcmp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; Check for successful compilation.
|
||||
; CHECK: r{{[0-9]+}} = insert(r{{[0-9]+}},#1,#31)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; Test that LLVM does not assert and bitcast v64i1 to i64 is lowered
|
||||
; without crashing.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; This used to crash in SimplifyDemandedBits due to a type mismatch
|
||||
; caused by a missing bitcast in vectorizing mul.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon -O3 < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -O3 -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; CHECK-LABEL: f0:
|
||||
; CHECK: loop0(.LBB{{[0-9]+}}_{{[0-9]+}},#3)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon -O3 -verify-machineinstrs -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -O3 -verify-machineinstrs -hexagon-initial-cfg-cleanup=0 -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
;
|
||||
; Check that this testcase compiles successfully and that a new-value jump
|
||||
; has been created.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
; REQUIRES: asserts
|
||||
|
||||
; Test that the compiler doesn't assert because IMPLICIT_DEF instructions are
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; This test checks that store a vector predicate of type v128i1 is lowered
|
||||
; without crashing.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc -march=hexagon < %s | FileCheck %s
|
||||
; RUN: llc -march=hexagon -hexagon-instsimplify=0 < %s | FileCheck %s
|
||||
|
||||
; Check that this compiles successfully.
|
||||
; CHECK: vcmph.eq
|
||||
|
|
Loading…
Reference in New Issue