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
// transformations.
//
Pass *createWarnMissedTransformationsPass();
+
+//===----------------------------------------------------------------------===//
+//
+// This pass does instruction simplification on each
+// instruction in a function.
+//
+FunctionPass *createInstSimplifyLegacyPass();
} // End llvm namespace
#endif
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
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
bool NoOpt = (getOptLevel() == CodeGenOpt::None);
if (!NoOpt) {
- addPass(createConstantPropagationPass());
+ if (EnableInstSimplify)
+ addPass(createInstSimplifyLegacyPass());
addPass(createDeadCodeEliminationPass());
}
#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;
-; 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)
-; 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
-; 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)
-; 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.
-; 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.
-; 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)
-; 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.
-; 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
-; 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.
-; 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