diff --git a/llvm/bindings/go/llvm/executionengine_test.go b/llvm/bindings/go/llvm/executionengine_test.go --- a/llvm/bindings/go/llvm/executionengine_test.go +++ b/llvm/bindings/go/llvm/executionengine_test.go @@ -80,7 +80,6 @@ pass := NewPassManager() defer pass.Dispose() - pass.AddConstantPropagationPass() pass.AddInstructionCombiningPass() pass.AddPromoteMemoryToRegisterPass() pass.AddGVNPass() diff --git a/llvm/bindings/go/llvm/transforms_scalar.go b/llvm/bindings/go/llvm/transforms_scalar.go --- a/llvm/bindings/go/llvm/transforms_scalar.go +++ b/llvm/bindings/go/llvm/transforms_scalar.go @@ -40,6 +40,5 @@ } func (pm PassManager) AddSimplifyLibCallsPass() { C.LLVMAddSimplifyLibCallsPass(pm.C) } func (pm PassManager) AddTailCallEliminationPass() { C.LLVMAddTailCallEliminationPass(pm.C) } -func (pm PassManager) AddConstantPropagationPass() { C.LLVMAddConstantPropagationPass(pm.C) } func (pm PassManager) AddDemoteMemoryToRegisterPass() { C.LLVMAddDemoteMemoryToRegisterPass(pm.C) } func (pm PassManager) AddVerifierPass() { C.LLVMAddVerifierPass(pm.C) } diff --git a/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli b/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli --- a/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli +++ b/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli @@ -161,11 +161,6 @@ : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit = "llvm_add_tail_call_elimination" -(** See the [llvm::createConstantPropagationPass] function. *) -external add_constant_propagation - : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit - = "llvm_add_constant_propagation" - (** See the [llvm::createDemoteMemoryToRegisterPass] function. *) external add_memory_to_register_demotion : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit diff --git a/llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c b/llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c --- a/llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c +++ b/llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c @@ -200,12 +200,6 @@ return Val_unit; } -/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ -CAMLprim value llvm_add_constant_propagation(LLVMPassManagerRef PM) { - LLVMAddConstantPropagationPass(PM); - return Val_unit; -} - /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ CAMLprim value llvm_add_demote_memory_to_register(LLVMPassManagerRef PM) { LLVMAddDemoteMemoryToRegisterPass(PM); diff --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst --- a/llvm/docs/CommandLine.rst +++ b/llvm/docs/CommandLine.rst @@ -475,7 +475,7 @@ Now that we have the standard run-of-the-mill argument types out of the way, lets get a little wild and crazy. Lets say that we want our optimizer to accept a **list** of optimizations to perform, allowing duplicates. For example, we -might want to run: "``compiler -dce -constprop -inline -dce -strip``". In this +might want to run: "``compiler -dce -instsimplify -inline -dce -strip``". In this case, the order of the arguments and the number of appearances is very important. This is what the "``cl::list``" template is for. First, start by defining an enum of the optimizations that you would like to perform: @@ -484,7 +484,7 @@ enum Opts { // 'inline' is a C++ keyword, so name it 'inlining' - dce, constprop, inlining, strip + dce, instsimplify, inlining, strip }; Then define your "``cl::list``" variable: @@ -494,7 +494,7 @@ cl::list<Opts> OptimizationList(cl::desc("Available Optimizations:"), cl::values( clEnumVal(dce , "Dead Code Elimination"), - clEnumVal(constprop , "Constant Propagation"), + clEnumVal(instsimplify , "Instruction Simplification"), clEnumValN(inlining, "inline", "Procedure Integration"), clEnumVal(strip , "Strip Symbols"))); @@ -553,16 +553,16 @@ cl::bits<Opts> OptimizationBits(cl::desc("Available Optimizations:"), cl::values( clEnumVal(dce , "Dead Code Elimination"), - clEnumVal(constprop , "Constant Propagation"), + clEnumVal(instsimplify , "Instruction Simplification"), clEnumValN(inlining, "inline", "Procedure Integration"), clEnumVal(strip , "Strip Symbols"))); -To test to see if ``constprop`` was specified, we can use the ``cl:bits::isSet`` +To test to see if ``instsimplify`` was specified, we can use the ``cl:bits::isSet`` function: .. code-block:: c++ - if (OptimizationBits.isSet(constprop)) { + if (OptimizationBits.isSet(instsimplify)) { ... } diff --git a/llvm/docs/Passes.rst b/llvm/docs/Passes.rst --- a/llvm/docs/Passes.rst +++ b/llvm/docs/Passes.rst @@ -460,27 +460,6 @@ string constants into the program, regardless of whether or not an existing string is available. -``-constprop``: Simple constant propagation -------------------------------------------- - -This pass implements constant propagation and merging. It looks for -instructions involving only constant operands and replaces them with a constant -value instead of an instruction. For example: - -.. code-block:: llvm - - add i32 1, 2 - -becomes - -.. code-block:: llvm - - i32 3 - -NOTE: this pass has a habit of making definitions be dead. It is a good idea -to run a :ref:`Dead Instruction Elimination <passes-die>` pass sometime after -running this pass. - .. _passes-dce: ``-dce``: Dead Code Elimination diff --git a/llvm/include/llvm-c/Transforms/Scalar.h b/llvm/include/llvm-c/Transforms/Scalar.h --- a/llvm/include/llvm-c/Transforms/Scalar.h +++ b/llvm/include/llvm-c/Transforms/Scalar.h @@ -125,9 +125,6 @@ /** See llvm::createTailCallEliminationPass function. */ void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM); -/** See llvm::createConstantPropagationPass function. */ -void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM); - /** See llvm::demotePromoteMemoryToRegisterPass function. */ void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM); diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -113,7 +113,6 @@ void initializeCodeGenPreparePass(PassRegistry&); void initializeConstantHoistingLegacyPassPass(PassRegistry&); void initializeConstantMergeLegacyPassPass(PassRegistry&); -void initializeConstantPropagationPass(PassRegistry&); void initializeControlHeightReductionLegacyPassPass(PassRegistry&); void initializeCorrelatedValuePropagationPass(PassRegistry&); void initializeCostModelAnalysisPass(PassRegistry&); diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -89,7 +89,6 @@ (void) llvm::createLibCallsShrinkWrapPass(); (void) llvm::createCalledValuePropagationPass(); (void) llvm::createConstantMergePass(); - (void) llvm::createConstantPropagationPass(); (void) llvm::createControlHeightReductionLegacyPass(); (void) llvm::createCostModelAnalysisPass(); (void) llvm::createDeadArgEliminationPass(); diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -24,12 +24,6 @@ class ModulePass; class Pass; -//===----------------------------------------------------------------------===// -// -// ConstantPropagation - A worklist driven constant propagation pass -// -FunctionPass *createConstantPropagationPass(); - //===----------------------------------------------------------------------===// // // AlignmentFromAssumptions - Use assume intrinsics to set load/store diff --git a/llvm/lib/Transforms/Scalar/CMakeLists.txt b/llvm/lib/Transforms/Scalar/CMakeLists.txt --- a/llvm/lib/Transforms/Scalar/CMakeLists.txt +++ b/llvm/lib/Transforms/Scalar/CMakeLists.txt @@ -4,7 +4,6 @@ BDCE.cpp CallSiteSplitting.cpp ConstantHoisting.cpp - ConstantProp.cpp CorrelatedValuePropagation.cpp DCE.cpp DeadStoreElimination.cpp diff --git a/llvm/lib/Transforms/Scalar/ConstantProp.cpp b/llvm/lib/Transforms/Scalar/ConstantProp.cpp deleted file mode 100644 --- a/llvm/lib/Transforms/Scalar/ConstantProp.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//===- ConstantProp.cpp - Code to perform Simple Constant Propagation -----===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements constant propagation and merging: -// -// Specifically, this: -// * Converts instructions like "add int 1, 2" into 3 -// -// Notice that: -// * This pass has a habit of making definitions be dead. It is a good idea -// to run a DIE pass sometime after running this pass. -// -//===----------------------------------------------------------------------===// - -#include "llvm/ADT/SmallPtrSet.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Analysis/ConstantFolding.h" -#include "llvm/Analysis/TargetLibraryInfo.h" -#include "llvm/IR/Constant.h" -#include "llvm/IR/InstIterator.h" -#include "llvm/IR/Instruction.h" -#include "llvm/InitializePasses.h" -#include "llvm/Pass.h" -#include "llvm/Support/DebugCounter.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/Utils/Local.h" -using namespace llvm; - -#define DEBUG_TYPE "constprop" - -STATISTIC(NumInstKilled, "Number of instructions killed"); -DEBUG_COUNTER(CPCounter, "constprop-transform", - "Controls which instructions are killed"); - -namespace { - struct ConstantPropagation : public FunctionPass { - static char ID; // Pass identification, replacement for typeid - ConstantPropagation() : FunctionPass(ID) { - initializeConstantPropagationPass(*PassRegistry::getPassRegistry()); - } - - bool runOnFunction(Function &F) override; - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.setPreservesCFG(); - AU.addRequired<TargetLibraryInfoWrapperPass>(); - } - }; -} - -char ConstantPropagation::ID = 0; -INITIALIZE_PASS_BEGIN(ConstantPropagation, "constprop", - "Simple constant propagation", false, false) -INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) -INITIALIZE_PASS_END(ConstantPropagation, "constprop", - "Simple constant propagation", false, false) - -FunctionPass *llvm::createConstantPropagationPass() { - return new ConstantPropagation(); -} - -bool ConstantPropagation::runOnFunction(Function &F) { - if (skipFunction(F)) - return false; - - // Initialize the worklist to all of the instructions ready to process... - SmallPtrSet<Instruction *, 16> WorkList; - // The SmallVector of WorkList ensures that we do iteration at stable order. - // We use two containers rather than one SetVector, since remove is - // linear-time, and we don't care enough to remove from Vec. - SmallVector<Instruction *, 16> WorkListVec; - for (Instruction &I : instructions(&F)) { - WorkList.insert(&I); - WorkListVec.push_back(&I); - } - - bool Changed = false; - const DataLayout &DL = F.getParent()->getDataLayout(); - TargetLibraryInfo *TLI = - &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); - - while (!WorkList.empty()) { - SmallVector<Instruction*, 16> NewWorkListVec; - for (auto *I : WorkListVec) { - WorkList.erase(I); // Remove element from the worklist... - - if (!I->use_empty()) // Don't muck with dead instructions... - if (Constant *C = ConstantFoldInstruction(I, DL, TLI)) { - if (!DebugCounter::shouldExecute(CPCounter)) - continue; - - // Add all of the users of this instruction to the worklist, they might - // be constant propagatable now... - for (User *U : I->users()) { - // If user not in the set, then add it to the vector. - if (WorkList.insert(cast<Instruction>(U)).second) - NewWorkListVec.push_back(cast<Instruction>(U)); - } - - // Replace all of the uses of a variable with uses of the constant. - I->replaceAllUsesWith(C); - - if (isInstructionTriviallyDead(I, TLI)) { - I->eraseFromParent(); - ++NumInstKilled; - } - - // We made a change to the function... - Changed = true; - } - } - WorkListVec = std::move(NewWorkListVec); - } - return Changed; -} diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -38,7 +38,6 @@ initializeAlignmentFromAssumptionsPass(Registry); initializeCallSiteSplittingLegacyPassPass(Registry); initializeConstantHoistingLegacyPassPass(Registry); - initializeConstantPropagationPass(Registry); initializeCorrelatedValuePropagationPass(Registry); initializeDCELegacyPassPass(Registry); initializeDeadInstEliminationPass(Registry); @@ -248,10 +247,6 @@ unwrap(PM)->add(createTailCallEliminationPass()); } -void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM) { - unwrap(PM)->add(createConstantPropagationPass()); -} - void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createDemoteRegisterToMemoryPass()); } diff --git a/llvm/test/Assembler/2002-04-07-HexFloatConstants.ll b/llvm/test/Assembler/2002-04-07-HexFloatConstants.ll --- a/llvm/test/Assembler/2002-04-07-HexFloatConstants.ll +++ b/llvm/test/Assembler/2002-04-07-HexFloatConstants.ll @@ -5,8 +5,8 @@ ; of the bug that was causing the Olden Health benchmark to output incorrect ; results! ; -; RUN: opt -constprop -S > %t.1 < %s -; RUN: llvm-as < %s | llvm-dis | llvm-as | opt -constprop | \ +; RUN: opt -instsimplify -S > %t.1 < %s +; RUN: llvm-as < %s | llvm-dis | llvm-as | opt -instsimplify | \ ; RUN: llvm-dis > %t.2 ; RUN: diff %t.1 %t.2 ; RUN: verify-uselistorder %s diff --git a/llvm/test/Bitcode/extractelement.ll b/llvm/test/Bitcode/extractelement.ll --- a/llvm/test/Bitcode/extractelement.ll +++ b/llvm/test/Bitcode/extractelement.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop | llvm-dis -disable-output +; RUN: opt < %s -instsimplify | llvm-dis -disable-output ; RUN: verify-uselistorder < %s ; PR3465 diff --git a/llvm/test/Other/2002-03-11-ConstPropCrash.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2002-03-11-ConstPropCrash.ll rename from llvm/test/Other/2002-03-11-ConstPropCrash.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2002-03-11-ConstPropCrash.ll --- a/llvm/test/Other/2002-03-11-ConstPropCrash.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2002-03-11-ConstPropCrash.ll @@ -5,7 +5,7 @@ ; ; Fixed by adding new arguments to ConstantFoldTerminator ; -; RUN: opt < %s -constprop +; RUN: opt < %s -instsimplify define void @build_tree(i32 %ml) { ; <label>:0 diff --git a/llvm/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2002-05-03-DivideByZeroException.ll rename from llvm/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2002-05-03-DivideByZeroException.ll --- a/llvm/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2002-05-03-DivideByZeroException.ll @@ -1,6 +1,6 @@ ; Make sure that the constant propogator doesn't divide by zero! ; -; RUN: opt < %s -constprop +; RUN: opt < %s -instsimplify ; define i32 @test() { diff --git a/llvm/test/Transforms/ConstProp/2002-05-03-NotOperator.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2002-05-03-NotOperator.ll rename from llvm/test/Transforms/ConstProp/2002-05-03-NotOperator.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2002-05-03-NotOperator.ll --- a/llvm/test/Transforms/ConstProp/2002-05-03-NotOperator.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2002-05-03-NotOperator.ll @@ -4,7 +4,7 @@ ; Fix #2: The unary not instruction now no longer exists. Change to xor. -; RUN: opt < %s -constprop -S | \ +; RUN: opt < %s -instsimplify -S | \ ; RUN: not grep "i32 0" define i32 @test1() { diff --git a/llvm/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2002-09-03-SetCC-Bools.ll rename from llvm/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2002-09-03-SetCC-Bools.ll --- a/llvm/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2002-09-03-SetCC-Bools.ll @@ -1,6 +1,6 @@ ; SetCC on boolean values was not implemented! -; RUN: opt < %s -constprop -die -S | \ +; RUN: opt < %s -instsimplify -die -S | \ ; RUN: not grep set define i1 @test1() { diff --git a/llvm/test/Transforms/ConstProp/2003-05-12-DivideError.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2003-05-12-DivideError.ll rename from llvm/test/Transforms/ConstProp/2003-05-12-DivideError.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2003-05-12-DivideError.ll --- a/llvm/test/Transforms/ConstProp/2003-05-12-DivideError.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2003-05-12-DivideError.ll @@ -1,6 +1,6 @@ ; Make sure that the constant propagator doesn't cause a sigfpe ; -; RUN: opt < %s -constprop +; RUN: opt < %s -instsimplify ; define i32 @test() { diff --git a/llvm/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2005-01-28-SetCCGEP.ll rename from llvm/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2005-01-28-SetCCGEP.ll --- a/llvm/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2005-01-28-SetCCGEP.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | \ +; RUN: opt < %s -instsimplify -S | \ ; RUN: not grep "ret i1 false" @b = external global [2 x { }] ; <[2 x { }]*> [#uses=2] diff --git a/llvm/test/Transforms/ConstProp/2006-11-30-vector-cast.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2006-11-30-vector-cast.ll rename from llvm/test/Transforms/ConstProp/2006-11-30-vector-cast.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2006-11-30-vector-cast.ll --- a/llvm/test/Transforms/ConstProp/2006-11-30-vector-cast.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2006-11-30-vector-cast.ll @@ -1,6 +1,6 @@ -; RUN: opt < %s -constprop -S | \ +; RUN: opt < %s -instsimplify -S | \ ; RUN: grep "i32 -1" -; RUN: opt < %s -constprop -S | \ +; RUN: opt < %s -instsimplify -S | \ ; RUN: not grep zeroinitializer define <4 x i32> @test() { diff --git a/llvm/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2006-12-01-TruncBoolBug.ll rename from llvm/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2006-12-01-TruncBoolBug.ll diff --git a/llvm/test/Transforms/ConstProp/2006-12-01-bool-casts.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2006-12-01-bool-casts.ll rename from llvm/test/Transforms/ConstProp/2006-12-01-bool-casts.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2006-12-01-bool-casts.ll --- a/llvm/test/Transforms/ConstProp/2006-12-01-bool-casts.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2006-12-01-bool-casts.ll @@ -1,6 +1,6 @@ -; RUN: opt < %s -constprop -S | \ +; RUN: opt < %s -instsimplify -S | \ ; RUN: grep "ret i32 -1" -; RUN: opt < %s -constprop -S | \ +; RUN: opt < %s -instsimplify -S | \ ; RUN: grep "ret i32 1" define i32 @test1() { diff --git a/llvm/test/Transforms/ConstProp/2007-02-05-BitCast.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2007-02-05-BitCast.ll rename from llvm/test/Transforms/ConstProp/2007-02-05-BitCast.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2007-02-05-BitCast.ll --- a/llvm/test/Transforms/ConstProp/2007-02-05-BitCast.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2007-02-05-BitCast.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | grep 1065353216 +; RUN: opt < %s -instsimplify -S | grep 1065353216 define i32 @test() { %A = bitcast float 1.000000e+00 to i32 ; <i32> [#uses=1] diff --git a/llvm/test/Transforms/ConstProp/2007-02-23-sdiv.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2007-02-23-sdiv.ll rename from llvm/test/Transforms/ConstProp/2007-02-23-sdiv.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2007-02-23-sdiv.ll diff --git a/llvm/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2008-07-07-VectorCompare.ll rename from llvm/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2008-07-07-VectorCompare.ll --- a/llvm/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2008-07-07-VectorCompare.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -disable-output +; RUN: opt < %s -instsimplify -disable-output ; PR2529 define <4 x i1> @test1(i32 %argc, i8** %argv) { entry: diff --git a/llvm/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2009-06-20-constexpr-zero-lhs.ll rename from llvm/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2009-06-20-constexpr-zero-lhs.ll diff --git a/llvm/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll b/llvm/test/Transforms/InstSimplify/ConstProp/2009-09-01-GEP-Crash.ll rename from llvm/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/2009-09-01-GEP-Crash.ll --- a/llvm/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/2009-09-01-GEP-Crash.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop | llvm-dis +; RUN: opt < %s -instsimplify | llvm-dis ; PR4848 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/cos.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cos.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/cos.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cos.ll diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/cubeid.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubeid.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/cubeid.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubeid.ll diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/cubema.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubema.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/cubema.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubema.ll diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/cubesc.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubesc.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/cubesc.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubesc.ll diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/cubetc.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubetc.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/cubetc.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/cubetc.ll diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/fmul_legacy.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/fmul_legacy.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/fmul_legacy.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/fmul_legacy.ll diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/fract.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/fract.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/fract.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/fract.ll diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/lit.local.cfg b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/lit.local.cfg rename from llvm/test/Analysis/ConstantFolding/AMDGPU/lit.local.cfg rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/lit.local.cfg diff --git a/llvm/test/Analysis/ConstantFolding/AMDGPU/sin.ll b/llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/sin.ll rename from llvm/test/Analysis/ConstantFolding/AMDGPU/sin.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/AMDGPU/sin.ll diff --git a/llvm/test/Analysis/ConstantFolding/ARM/lit.local.cfg b/llvm/test/Transforms/InstSimplify/ConstProp/ARM/lit.local.cfg rename from llvm/test/Analysis/ConstantFolding/ARM/lit.local.cfg rename to llvm/test/Transforms/InstSimplify/ConstProp/ARM/lit.local.cfg diff --git a/llvm/test/Analysis/ConstantFolding/ARM/mve-vctp.ll b/llvm/test/Transforms/InstSimplify/ConstProp/ARM/mve-vctp.ll rename from llvm/test/Analysis/ConstantFolding/ARM/mve-vctp.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/ARM/mve-vctp.ll diff --git a/llvm/test/Transforms/ConstProp/InsertElement.ll b/llvm/test/Transforms/InstSimplify/ConstProp/InsertElement.ll rename from llvm/test/Transforms/ConstProp/InsertElement.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/InsertElement.ll --- a/llvm/test/Transforms/ConstProp/InsertElement.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/InsertElement.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s define i32 @test1() { ; CHECK-LABEL: @test1( @@ -25,7 +25,6 @@ define <4 x i64> @insertelement_undef() { ; CHECK-LABEL: @insertelement_undef( -; CHECK-NEXT: [[VEC4:%.*]] = insertelement <4 x i64> <i64 -1, i64 -2, i64 -3, i64 undef>, i64 -4, i32 3 ; CHECK-NEXT: ret <4 x i64> undef ; %vec1 = insertelement <4 x i64> undef, i64 -1, i32 0 diff --git a/llvm/test/Analysis/ConstantFolding/WebAssembly/trunc.ll b/llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc.ll rename from llvm/test/Analysis/ConstantFolding/WebAssembly/trunc.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc.ll diff --git a/llvm/test/Analysis/ConstantFolding/WebAssembly/trunc_saturate.ll b/llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc_saturate.ll rename from llvm/test/Analysis/ConstantFolding/WebAssembly/trunc_saturate.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc_saturate.ll diff --git a/llvm/test/Analysis/ConstantFolding/abs.ll b/llvm/test/Transforms/InstSimplify/ConstProp/abs.ll rename from llvm/test/Analysis/ConstantFolding/abs.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/abs.ll --- a/llvm/test/Analysis/ConstantFolding/abs.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/abs.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s declare i8 @llvm.abs.i8(i8, i1) declare <8 x i8> @llvm.abs.v8i8(<8 x i8>, i1) diff --git a/llvm/test/Analysis/ConstantFolding/allones.ll b/llvm/test/Transforms/InstSimplify/ConstProp/allones.ll rename from llvm/test/Analysis/ConstantFolding/allones.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/allones.ll diff --git a/llvm/test/Transforms/ConstProp/avx512.ll b/llvm/test/Transforms/InstSimplify/ConstProp/avx512.ll rename from llvm/test/Transforms/ConstProp/avx512.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/avx512.ll --- a/llvm/test/Transforms/ConstProp/avx512.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/avx512.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ; REQUIRES: x86-registered-target define i1 @test_avx512_cvts_exact() nounwind readnone { diff --git a/llvm/test/Transforms/ConstProp/basictest.ll b/llvm/test/Transforms/InstSimplify/ConstProp/basictest.ll rename from llvm/test/Transforms/ConstProp/basictest.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/basictest.ll --- a/llvm/test/Transforms/ConstProp/basictest.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/basictest.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -die -S | FileCheck %s +; RUN: opt < %s -instsimplify -die -S | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.7.2" diff --git a/llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll b/llvm/test/Transforms/InstSimplify/ConstProp/binop-identity-undef.ll rename from llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/binop-identity-undef.ll --- a/llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/binop-identity-undef.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -constprop -S %s | FileCheck %s +; RUN: opt -instsimplify -S %s | FileCheck %s define i32 @and1() { ; CHECK-LABEL: @and1( diff --git a/llvm/test/Transforms/ConstProp/bitcast.ll b/llvm/test/Transforms/InstSimplify/ConstProp/bitcast.ll rename from llvm/test/Transforms/ConstProp/bitcast.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/bitcast.ll --- a/llvm/test/Transforms/ConstProp/bitcast.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/bitcast.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ; PR2165 define <1 x i64> @test1() { diff --git a/llvm/test/Analysis/ConstantFolding/bitcount.ll b/llvm/test/Transforms/InstSimplify/ConstProp/bitcount.ll rename from llvm/test/Analysis/ConstantFolding/bitcount.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/bitcount.ll --- a/llvm/test/Analysis/ConstantFolding/bitcount.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/bitcount.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s declare i31 @llvm.ctpop.i31(i31 %val) declare i32 @llvm.cttz.i32(i32 %val, i1) diff --git a/llvm/test/Transforms/ConstProp/bswap.ll b/llvm/test/Transforms/InstSimplify/ConstProp/bswap.ll rename from llvm/test/Transforms/ConstProp/bswap.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/bswap.ll --- a/llvm/test/Transforms/ConstProp/bswap.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/bswap.ll @@ -1,6 +1,6 @@ ; bswap should be constant folded when it is passed a constant argument -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s declare i16 @llvm.bswap.i16(i16) diff --git a/llvm/test/Transforms/ConstProp/calls-math-finite.ll b/llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll rename from llvm/test/Transforms/ConstProp/calls-math-finite.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll --- a/llvm/test/Transforms/ConstProp/calls-math-finite.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s -; RUN: opt < %s -constprop -S -mtriple=unknown-unknown-linux-musl | FileCheck -check-prefix=MUSL %s +; RUN: opt < %s -instsimplify -S | FileCheck %s +; RUN: opt < %s -instsimplify -S -mtriple=unknown-unknown-linux-musl | FileCheck -check-prefix=MUSL %s ; Test to verify constant folding can occur when math routines are mapped ; to the __<func>_finite versions of functions due to __FINITE_MATH_ONLY__ diff --git a/llvm/test/Transforms/ConstProp/calls.ll b/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll rename from llvm/test/Transforms/ConstProp/calls.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/calls.ll --- a/llvm/test/Transforms/ConstProp/calls.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -constprop -S | FileCheck %s -; RUN: opt < %s -constprop -disable-simplify-libcalls -S | FileCheck %s --check-prefix=FNOBUILTIN +; RUN: opt < %s -instsimplify -S | FileCheck %s +; RUN: opt < %s -instsimplify -disable-simplify-libcalls -S | FileCheck %s --check-prefix=FNOBUILTIN declare double @acos(double) readnone nounwind declare double @asin(double) readnone nounwind diff --git a/llvm/test/Analysis/ConstantFolding/cast-vector.ll b/llvm/test/Transforms/InstSimplify/ConstProp/cast-vector.ll rename from llvm/test/Analysis/ConstantFolding/cast-vector.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/cast-vector.ll --- a/llvm/test/Analysis/ConstantFolding/cast-vector.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/cast-vector.ll @@ -1,32 +1,32 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -instsimplify -S | FileCheck %s - -; Test constant fold of constant expression GEP used by ptrtoint (the -; "offsetof-like expression" case). -; This used to hit an assert due to not supporting vectors in -; llvm::ConstantFoldCastInstruction when handling ptrtoint. -define <2 x i16> @test1() { -; CHECK-LABEL: @test1( -; CHECK-NEXT: entry: -; CHECK-NEXT: ret <2 x i16> ptrtoint (<2 x i32*> getelementptr ([10 x i32], [10 x i32]* null, <2 x i64> zeroinitializer, <2 x i64> <i64 5, i64 7>) to <2 x i16>) -; -entry: - %gep = getelementptr inbounds [10 x i32], [10 x i32]* null, i16 0, <2 x i16> <i16 5, i16 7> - %vec = ptrtoint <2 x i32*> %gep to <2 x i16> - ret <2 x i16> %vec -} - -; Test constant fold of constant expression GEP used by ptrtoint (the -; "sizeof-like expression" case). -; This used to hit an assert due to not supporting vectors in -; llvm::ConstantFoldCastInstruction when handling ptrtoint. -define <2 x i16> @test2() { -; CHECK-LABEL: @test2( -; CHECK-NEXT: entry: -; CHECK-NEXT: ret <2 x i16> ptrtoint (<2 x i32*> getelementptr (i32, i32* null, <2 x i64> <i64 5, i64 7>) to <2 x i16>) -; -entry: - %gep = getelementptr i32, i32* null, <2 x i16> <i16 5, i16 7> - %vec = ptrtoint <2 x i32*> %gep to <2 x i16> - ret <2 x i16> %vec -} +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instsimplify -S | FileCheck %s + +; Test constant fold of constant expression GEP used by ptrtoint (the +; "offsetof-like expression" case). +; This used to hit an assert due to not supporting vectors in +; llvm::ConstantFoldCastInstruction when handling ptrtoint. +define <2 x i16> @test1() { +; CHECK-LABEL: @test1( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x i16> ptrtoint (<2 x i32*> getelementptr ([10 x i32], [10 x i32]* null, <2 x i64> zeroinitializer, <2 x i64> <i64 5, i64 7>) to <2 x i16>) +; +entry: + %gep = getelementptr inbounds [10 x i32], [10 x i32]* null, i16 0, <2 x i16> <i16 5, i16 7> + %vec = ptrtoint <2 x i32*> %gep to <2 x i16> + ret <2 x i16> %vec +} + +; Test constant fold of constant expression GEP used by ptrtoint (the +; "sizeof-like expression" case). +; This used to hit an assert due to not supporting vectors in +; llvm::ConstantFoldCastInstruction when handling ptrtoint. +define <2 x i16> @test2() { +; CHECK-LABEL: @test2( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x i16> ptrtoint (<2 x i32*> getelementptr (i32, i32* null, <2 x i64> <i64 5, i64 7>) to <2 x i16>) +; +entry: + %gep = getelementptr i32, i32* null, <2 x i16> <i16 5, i16 7> + %vec = ptrtoint <2 x i32*> %gep to <2 x i16> + ret <2 x i16> %vec +} diff --git a/llvm/test/Transforms/ConstProp/cast.ll b/llvm/test/Transforms/InstSimplify/ConstProp/cast.ll rename from llvm/test/Transforms/ConstProp/cast.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/cast.ll --- a/llvm/test/Transforms/ConstProp/cast.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/cast.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ; Overflow on a float to int or int to float conversion is undefined (PR21130). diff --git a/llvm/test/Transforms/ConstProp/constant-expr.ll b/llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll rename from llvm/test/Transforms/ConstProp/constant-expr.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll diff --git a/llvm/test/Transforms/ConstProp/convert-from-fp16.ll b/llvm/test/Transforms/InstSimplify/ConstProp/convert-from-fp16.ll rename from llvm/test/Transforms/ConstProp/convert-from-fp16.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/convert-from-fp16.ll --- a/llvm/test/Transforms/ConstProp/convert-from-fp16.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/convert-from-fp16.ll @@ -1,4 +1,4 @@ -; RUN: opt -constprop -S < %s | FileCheck %s +; RUN: opt -instsimplify -S < %s | FileCheck %s ; Verify that we don't crash with an assertion failure when constant folding ; a call to intrinsic 'convert.from.fp16' if the return type is not 'float'. diff --git a/llvm/test/Analysis/ConstantFolding/copysign.ll b/llvm/test/Transforms/InstSimplify/ConstProp/copysign.ll rename from llvm/test/Analysis/ConstantFolding/copysign.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/copysign.ll --- a/llvm/test/Analysis/ConstantFolding/copysign.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/copysign.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -constprop < %s | FileCheck %s +; RUN: opt -S -instsimplify < %s | FileCheck %s declare float @llvm.copysign.f32(float, float) declare double @llvm.copysign.f64(double, double) diff --git a/llvm/test/Transforms/ConstProp/div-zero.ll b/llvm/test/Transforms/InstSimplify/ConstProp/div-zero.ll rename from llvm/test/Transforms/ConstProp/div-zero.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/div-zero.ll diff --git a/llvm/test/Analysis/ConstantFolding/extractelement-vscale.ll b/llvm/test/Transforms/InstSimplify/ConstProp/extractelement-vscale.ll rename from llvm/test/Analysis/ConstantFolding/extractelement-vscale.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/extractelement-vscale.ll diff --git a/llvm/test/Transforms/ConstProp/extractvalue.ll b/llvm/test/Transforms/InstSimplify/ConstProp/extractvalue.ll rename from llvm/test/Transforms/ConstProp/extractvalue.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/extractvalue.ll --- a/llvm/test/Transforms/ConstProp/extractvalue.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/extractvalue.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s %struct = type { i32, [4 x i8] } diff --git a/llvm/test/Transforms/ConstProp/float-to-ptr-cast.ll b/llvm/test/Transforms/InstSimplify/ConstProp/float-to-ptr-cast.ll rename from llvm/test/Transforms/ConstProp/float-to-ptr-cast.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/float-to-ptr-cast.ll --- a/llvm/test/Transforms/ConstProp/float-to-ptr-cast.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/float-to-ptr-cast.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s define i32* @test1() { %X = inttoptr i64 0 to i32* ; <i32*> [#uses=1] diff --git a/llvm/test/Transforms/ConstProp/fma.ll b/llvm/test/Transforms/InstSimplify/ConstProp/fma.ll rename from llvm/test/Transforms/ConstProp/fma.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/fma.ll --- a/llvm/test/Transforms/ConstProp/fma.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/fma.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -constprop -S < %s | FileCheck %s +; RUN: opt -instsimplify -S < %s | FileCheck %s ; Fixes PR20832 ; Make sure that we correctly fold a fused multiply-add where operands diff --git a/llvm/test/Analysis/ConstantFolding/fneg.ll b/llvm/test/Transforms/InstSimplify/ConstProp/fneg.ll rename from llvm/test/Analysis/ConstantFolding/fneg.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/fneg.ll --- a/llvm/test/Analysis/ConstantFolding/fneg.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/fneg.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s define float @fneg_constant() { ; CHECK-LABEL: @fneg_constant( diff --git a/llvm/test/Analysis/ConstantFolding/fp-undef.ll b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll rename from llvm/test/Analysis/ConstantFolding/fp-undef.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll --- a/llvm/test/Analysis/ConstantFolding/fp-undef.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ; Constant folding - undef undef. diff --git a/llvm/test/Analysis/ConstantFolding/freeze.ll b/llvm/test/Transforms/InstSimplify/ConstProp/freeze.ll rename from llvm/test/Analysis/ConstantFolding/freeze.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/freeze.ll --- a/llvm/test/Analysis/ConstantFolding/freeze.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/freeze.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s @g = external global i16, align 1 @g2 = external global i16, align 1 diff --git a/llvm/test/Analysis/ConstantFolding/funnel-shift.ll b/llvm/test/Transforms/InstSimplify/ConstProp/funnel-shift.ll rename from llvm/test/Analysis/ConstantFolding/funnel-shift.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/funnel-shift.ll --- a/llvm/test/Analysis/ConstantFolding/funnel-shift.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/funnel-shift.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S -o - | FileCheck %s +; RUN: opt < %s -instsimplify -S -o - | FileCheck %s declare i32 @llvm.fshl.i32(i32, i32, i32) declare i32 @llvm.fshr.i32(i32, i32, i32) diff --git a/llvm/test/Analysis/ConstantFolding/gep-alias.ll b/llvm/test/Transforms/InstSimplify/ConstProp/gep-alias.ll rename from llvm/test/Analysis/ConstantFolding/gep-alias.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/gep-alias.ll --- a/llvm/test/Analysis/ConstantFolding/gep-alias.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/gep-alias.ll @@ -1,17 +1,17 @@ -; RUN: opt -instcombine -S -o - %s | FileCheck %s -; Test that we don't replace an alias with its aliasee when simplifying GEPs. -; In this test case the transformation is invalid because it replaces the -; reference to the symbol "b" (which refers to whichever instance of "b" -; was chosen by the linker) with a reference to "a" (which refers to the -; specific instance of "b" in this module). - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@a = internal global [3 x i8*] zeroinitializer -@b = linkonce_odr alias [3 x i8*], [3 x i8*]* @a - -define i8** @f() { - ; CHECK: ret i8** getelementptr ([3 x i8*], [3 x i8*]* @b, i64 0, i64 1) - ret i8** getelementptr ([3 x i8*], [3 x i8*]* @b, i64 0, i64 1) -} +; RUN: opt -instcombine -S -o - %s | FileCheck %s +; Test that we don't replace an alias with its aliasee when simplifying GEPs. +; In this test case the transformation is invalid because it replaces the +; reference to the symbol "b" (which refers to whichever instance of "b" +; was chosen by the linker) with a reference to "a" (which refers to the +; specific instance of "b" in this module). + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@a = internal global [3 x i8*] zeroinitializer +@b = linkonce_odr alias [3 x i8*], [3 x i8*]* @a + +define i8** @f() { + ; CHECK: ret i8** getelementptr ([3 x i8*], [3 x i8*]* @b, i64 0, i64 1) + ret i8** getelementptr ([3 x i8*], [3 x i8*]* @b, i64 0, i64 1) +} diff --git a/llvm/test/Analysis/ConstantFolding/gep-constanfolding-error.ll b/llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll rename from llvm/test/Analysis/ConstantFolding/gep-constanfolding-error.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll --- a/llvm/test/Analysis/ConstantFolding/gep-constanfolding-error.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/gep-constanfolding-error.ll @@ -1,52 +1,52 @@ -; RUN: opt -gvn -S -o - %s | FileCheck %s -; RUN: opt -newgvn -S -o - %s | FileCheck %s -; Test that the constantfolding getelementptr computation results in -; j[5][4][1] (j+239) -; and not [1][4][4][1] (#449) which is an incorrect out-of-range error -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" -target triple = "armv7-none-eabi" - -@f = local_unnamed_addr global i32 2, align 4 -@t6 = local_unnamed_addr global i32 1, align 4 -@j = local_unnamed_addr global [6 x [6 x [7 x i8]]] [[6 x [7 x i8]] [[7 x i8] c"\06\00\00\00\00\00\00", [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer], [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer], align 1 -@p = internal global i64 0, align 8 -@y = local_unnamed_addr global i64* @p, align 4 -@b = internal unnamed_addr global i32 0, align 4 -@h = common local_unnamed_addr global i16 0, align 2 -@a = common local_unnamed_addr global i32 0, align 4 -@k = common local_unnamed_addr global i32 0, align 4 -@t11 = common local_unnamed_addr global i32 0, align 4 - -; Function Attrs: nounwind -define i32 @main() local_unnamed_addr { -entry: - %0 = load i32, i32* @t6, align 4 - %inc = add nsw i32 %0, 1 - store i32 %inc, i32* @t6, align 4 - store i16 4, i16* @h, align 2 - %1 = load i32, i32* @a, align 4 - %conv = trunc i32 %1 to i8 - store i32 1, i32* @f, align 4 - %2 = load i64, i64* @p, align 8 - %cmp4 = icmp slt i64 %2, 2 - %conv6 = zext i1 %cmp4 to i8 - %3 = load i16, i16* @h, align 2 - %conv7 = sext i16 %3 to i32 - %add = add nsw i32 %conv7, 1 - %f.promoted = load i32, i32* @f, align 4 - %4 = mul i32 %conv7, 7 - %5 = add i32 %4, 5 - %6 = sub i32 -1, %f.promoted - %7 = icmp sgt i32 %6, -2 - %smax = select i1 %7, i32 %6, i32 -2 - %8 = sub i32 6, %smax - %scevgep = getelementptr [6 x [6 x [7 x i8]]], [6 x [6 x [7 x i8]]]* @j, i32 0, i32 0, i32 %5, i32 %8 - %9 = add i32 %f.promoted, %smax - %10 = add i32 %9, 2 - call void @llvm.memset.p0i8.i32(i8* %scevgep, i8 %conv6, i32 %10, i1 false) -; CHECK: call void @llvm.memset.p0i8.i32(i8* getelementptr inbounds ([6 x [6 x [7 x i8]]], [6 x [6 x [7 x i8]]]* @j, i32 0, i{{32|64}} 5, i{{32|64}} 4, i32 1), i8 %conv6, i32 1, i1 false) -; CHECK-NOT: call void @llvm.memset.p0i8.i32(i8* getelementptr ([6 x [6 x [7 x i8]]], [6 x [6 x [7 x i8]]]* @j, i64 1, i64 4, i64 4, i32 1) - ret i32 0 -} -; Function Attrs: argmemonly nounwind -declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1) +; RUN: opt -gvn -S -o - %s | FileCheck %s +; RUN: opt -newgvn -S -o - %s | FileCheck %s +; Test that the constantfolding getelementptr computation results in +; j[5][4][1] (j+239) +; and not [1][4][4][1] (#449) which is an incorrect out-of-range error +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "armv7-none-eabi" + +@f = local_unnamed_addr global i32 2, align 4 +@t6 = local_unnamed_addr global i32 1, align 4 +@j = local_unnamed_addr global [6 x [6 x [7 x i8]]] [[6 x [7 x i8]] [[7 x i8] c"\06\00\00\00\00\00\00", [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer, [7 x i8] zeroinitializer], [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer, [6 x [7 x i8]] zeroinitializer], align 1 +@p = internal global i64 0, align 8 +@y = local_unnamed_addr global i64* @p, align 4 +@b = internal unnamed_addr global i32 0, align 4 +@h = common local_unnamed_addr global i16 0, align 2 +@a = common local_unnamed_addr global i32 0, align 4 +@k = common local_unnamed_addr global i32 0, align 4 +@t11 = common local_unnamed_addr global i32 0, align 4 + +; Function Attrs: nounwind +define i32 @main() local_unnamed_addr { +entry: + %0 = load i32, i32* @t6, align 4 + %inc = add nsw i32 %0, 1 + store i32 %inc, i32* @t6, align 4 + store i16 4, i16* @h, align 2 + %1 = load i32, i32* @a, align 4 + %conv = trunc i32 %1 to i8 + store i32 1, i32* @f, align 4 + %2 = load i64, i64* @p, align 8 + %cmp4 = icmp slt i64 %2, 2 + %conv6 = zext i1 %cmp4 to i8 + %3 = load i16, i16* @h, align 2 + %conv7 = sext i16 %3 to i32 + %add = add nsw i32 %conv7, 1 + %f.promoted = load i32, i32* @f, align 4 + %4 = mul i32 %conv7, 7 + %5 = add i32 %4, 5 + %6 = sub i32 -1, %f.promoted + %7 = icmp sgt i32 %6, -2 + %smax = select i1 %7, i32 %6, i32 -2 + %8 = sub i32 6, %smax + %scevgep = getelementptr [6 x [6 x [7 x i8]]], [6 x [6 x [7 x i8]]]* @j, i32 0, i32 0, i32 %5, i32 %8 + %9 = add i32 %f.promoted, %smax + %10 = add i32 %9, 2 + call void @llvm.memset.p0i8.i32(i8* %scevgep, i8 %conv6, i32 %10, i1 false) +; CHECK: call void @llvm.memset.p0i8.i32(i8* getelementptr inbounds ([6 x [6 x [7 x i8]]], [6 x [6 x [7 x i8]]]* @j, i32 0, i{{32|64}} 5, i{{32|64}} 4, i32 1), i8 %conv6, i32 1, i1 false) +; CHECK-NOT: call void @llvm.memset.p0i8.i32(i8* getelementptr ([6 x [6 x [7 x i8]]], [6 x [6 x [7 x i8]]]* @j, i64 1, i64 4, i64 4, i32 1) + ret i32 0 +} +; Function Attrs: argmemonly nounwind +declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1) diff --git a/llvm/test/Analysis/ConstantFolding/gep-zeroinit-vector.ll b/llvm/test/Transforms/InstSimplify/ConstProp/gep-zeroinit-vector.ll rename from llvm/test/Analysis/ConstantFolding/gep-zeroinit-vector.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/gep-zeroinit-vector.ll --- a/llvm/test/Analysis/ConstantFolding/gep-zeroinit-vector.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/gep-zeroinit-vector.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S -o - | FileCheck %s +; RUN: opt < %s -instsimplify -S -o - | FileCheck %s ; Testcase that verify that we don't get a faulty bitcast that cast between ; different sizes. diff --git a/llvm/test/Analysis/ConstantFolding/gep.ll b/llvm/test/Transforms/InstSimplify/ConstProp/gep.ll rename from llvm/test/Analysis/ConstantFolding/gep.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/gep.ll --- a/llvm/test/Analysis/ConstantFolding/gep.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/gep.ll @@ -1,27 +1,27 @@ -; RUN: opt -instcombine -S -o - %s | FileCheck %s -; Tests that we preserve the inrange attribute on indices where possible. - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -%struct.A = type { i32 (...)** } - -@vt = external global [3 x i8*] - -; CHECK: define i32 (...)** @f0() -define i32 (...)** @f0() { - ; CHECK-NEXT: ret i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, inrange i64 0, i64 2) to i32 (...)** - ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, inrange i64 0, i64 1) to i32 (...)**), i64 1) -} - -; CHECK: define i32 (...)** @f1() -define i32 (...)** @f1() { - ; CHECK-NEXT: ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 1) - ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 1) -} - -; CHECK: define i32 (...)** @f2() -define i32 (...)** @f2() { - ; CHECK-NEXT: ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 3) - ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 3) -} +; RUN: opt -instcombine -S -o - %s | FileCheck %s +; Tests that we preserve the inrange attribute on indices where possible. + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%struct.A = type { i32 (...)** } + +@vt = external global [3 x i8*] + +; CHECK: define i32 (...)** @f0() +define i32 (...)** @f0() { + ; CHECK-NEXT: ret i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, inrange i64 0, i64 2) to i32 (...)** + ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, inrange i64 0, i64 1) to i32 (...)**), i64 1) +} + +; CHECK: define i32 (...)** @f1() +define i32 (...)** @f1() { + ; CHECK-NEXT: ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 1) + ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 1) +} + +; CHECK: define i32 (...)** @f2() +define i32 (...)** @f2() { + ; CHECK-NEXT: ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 3) + ret i32 (...)** getelementptr (i32 (...)*, i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @vt, i64 0, inrange i64 1) to i32 (...)**), i64 3) +} diff --git a/llvm/test/Transforms/ConstProp/insertvalue.ll b/llvm/test/Transforms/InstSimplify/ConstProp/insertvalue.ll rename from llvm/test/Transforms/ConstProp/insertvalue.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/insertvalue.ll --- a/llvm/test/Transforms/ConstProp/insertvalue.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/insertvalue.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s %struct = type { i32, [4 x i8] } diff --git a/llvm/test/Transforms/ConstProp/loads.ll b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll rename from llvm/test/Transforms/ConstProp/loads.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/loads.ll diff --git a/llvm/test/Transforms/ConstProp/logicaltest.ll b/llvm/test/Transforms/InstSimplify/ConstProp/logicaltest.ll rename from llvm/test/Transforms/ConstProp/logicaltest.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/logicaltest.ll --- a/llvm/test/Transforms/ConstProp/logicaltest.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/logicaltest.ll @@ -1,6 +1,6 @@ ; Ensure constant propagation of logical instructions is working correctly. -; RUN: opt < %s -constprop -die -S | FileCheck %s +; RUN: opt < %s -instsimplify -die -S | FileCheck %s ; CHECK-NOT: {{and|or|xor}} define i32 @test1() { diff --git a/llvm/test/Analysis/ConstantFolding/math-1.ll b/llvm/test/Transforms/InstSimplify/ConstProp/math-1.ll rename from llvm/test/Analysis/ConstantFolding/math-1.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/math-1.ll --- a/llvm/test/Analysis/ConstantFolding/math-1.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/math-1.ll @@ -1,195 +1,195 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -early-cse -S -o - %s | FileCheck %s - -declare double @acos(double) -define double @f_acos() { -; CHECK-LABEL: @f_acos( -; CHECK-NEXT: ret double 0.000000e+00 -; - %res = tail call fast double @acos(double 1.0) - ret double %res -} - -declare float @asinf(float) -define float @f_asinf() { -; CHECK-LABEL: @f_asinf( -; CHECK-NEXT: ret float 0x3FF921FB{{.+}} -; - %res = tail call fast float @asinf(float 1.0) - ret float %res -} - -declare double @atan(double) -define double @f_atan() { -; CHECK-LABEL: @f_atan( -; CHECK-NEXT: [[RES:%.*]] = tail call fast double @atan(double 1.000000e+00) -; CHECK-NEXT: ret double 0x3FE921FB -; - %res = tail call fast double @atan(double 1.0) - ret double %res -} - -declare float @cosf(float) -define float @f_cosf() { -; CHECK-LABEL: @f_cosf( -; CHECK-NEXT: ret float 0x3FE14A2{{.+}} -; - %res = tail call fast float @cosf(float 1.0) - ret float %res -} - -declare float @llvm.cos.f32(float) -define float @i_cosf() { -; CHECK-LABEL: @i_cosf( -; CHECK-NEXT: ret float 0x3FE14A2 -; - %res = tail call fast float @llvm.cos.f32(float 1.0) - ret float %res -} - -declare double @cosh(double) -define double @f_cosh() { -; CHECK-LABEL: @f_cosh( -; CHECK-NEXT: ret double 0x3FF8B075{{.+}} -; - %res = tail call fast double @cosh(double 1.0) - ret double %res -} - -declare float @expf(float) -define float @f_expf() { -; CHECK-LABEL: @f_expf( -; CHECK-NEXT: ret float 0x4005BF0A{{.+}} -; - %res = tail call fast float @expf(float 1.0) - ret float %res -} - -declare float @llvm.exp.f32(float) -define float @i_expf() { -; CHECK-LABEL: @i_expf( -; CHECK-NEXT: ret float 0x4005BF0A{{.+}} -; - %res = tail call fast float @llvm.exp.f32(float 1.0) - ret float %res -} - -declare double @exp2(double) -define double @f_exp2() { -; CHECK-LABEL: @f_exp2( -; CHECK-NEXT: ret double 2.000000e+00 -; - %res = tail call fast double @exp2(double 1.0) - ret double %res -} - -declare double @llvm.exp2.f64(double) -define double @i_exp2() { -; CHECK-LABEL: @i_exp2( -; CHECK-NEXT: ret double 2.000000e+00 -; - %res = tail call fast double @llvm.exp2.f64(double 1.0) - ret double %res -} - -; FIXME: exp10() is not widely supported. -declare float @exp10f(float) -define float @f_exp10f() { -; CHECK-LABEL: @f_exp10f( -; CHECK-NEXT: [[RES:%.*]] = tail call float @exp10f(float 1.000000e+00) -; CHECK-NEXT: ret float [[RES]] -; - %res = tail call float @exp10f(float 1.0) - ret float %res -} - -declare double @log(double) -define double @f_log() { -; CHECK-LABEL: @f_log( -; CHECK-NEXT: ret double 0.000000e+00 -; - %res = tail call fast double @log(double 1.0) - ret double %res -} - -declare double @llvm.log.f64(double) -define double @i_log() { -; CHECK-LABEL: @i_log( -; CHECK-NEXT: ret double 0.000000e+00 -; - %res = tail call fast double @llvm.log.f64(double 1.0) - ret double %res -} - -declare float @log2f(float) -define float @f_log2f() { -; CHECK-LABEL: @f_log2f( -; CHECK-NEXT: ret float 0.000000e+00 -; - %res = tail call fast float @log2f(float 1.0) - ret float %res -} - -declare float @llvm.log2.f32(float) -define float @i_log2f() { -; CHECK-LABEL: @i_log2f( -; CHECK-NEXT: ret float 0.000000e+00 -; - %res = tail call fast float @llvm.log2.f32(float 1.0) - ret float %res -} - -declare double @log10(double) -define double @f_log10() { -; CHECK-LABEL: @f_log10( -; CHECK-NEXT: ret double 0.000000e+00 -; - %res = tail call fast double @log10(double 1.0) - ret double %res -} - -declare float @sinf(float) -define float @f_sinf() { -; CHECK-LABEL: @f_sinf( -; CHECK-NEXT: ret float 0x3FEAED54{{.+}} -; - %res = tail call fast float @sinf(float 1.0) - ret float %res -} - -declare double @sinh(double) -define double @f_sinh() { -; CHECK-LABEL: @f_sinh( -; CHECK-NEXT: ret double 0x3FF2CD9F{{.+}} -; - %res = tail call fast double @sinh(double 1.0) - ret double %res -} - -declare float @sqrtf(float) -define float @f_sqrtf() { -; CHECK-LABEL: @f_sqrtf( -; CHECK-NEXT: ret float 1.000000e+00 -; - %res = tail call fast float @sqrtf(float 1.0) - ret float %res -} - -declare double @tan(double) -define double @f_tan() { -; CHECK-LABEL: @f_tan( -; CHECK-NEXT: ret double 0x3FF8EB24{{.+}} -; - %res = tail call fast double @tan(double 1.0) - ret double %res -} - -declare float @tanhf(float) -define float @f_tanhf() { -; CHECK-LABEL: @f_tanhf( -; CHECK-NEXT: [[RES:%.*]] = tail call fast float @tanhf(float 1.000000e+00) -; CHECK-NEXT: ret float 0x3FE85EFA{{.+}} -; - %res = tail call fast float @tanhf(float 1.0) - ret float %res -} +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -early-cse -S -o - %s | FileCheck %s + +declare double @acos(double) +define double @f_acos() { +; CHECK-LABEL: @f_acos( +; CHECK-NEXT: ret double 0.000000e+00 +; + %res = tail call fast double @acos(double 1.0) + ret double %res +} + +declare float @asinf(float) +define float @f_asinf() { +; CHECK-LABEL: @f_asinf( +; CHECK-NEXT: ret float 0x3FF921FB{{.+}} +; + %res = tail call fast float @asinf(float 1.0) + ret float %res +} + +declare double @atan(double) +define double @f_atan() { +; CHECK-LABEL: @f_atan( +; CHECK-NEXT: [[RES:%.*]] = tail call fast double @atan(double 1.000000e+00) +; CHECK-NEXT: ret double 0x3FE921FB +; + %res = tail call fast double @atan(double 1.0) + ret double %res +} + +declare float @cosf(float) +define float @f_cosf() { +; CHECK-LABEL: @f_cosf( +; CHECK-NEXT: ret float 0x3FE14A2{{.+}} +; + %res = tail call fast float @cosf(float 1.0) + ret float %res +} + +declare float @llvm.cos.f32(float) +define float @i_cosf() { +; CHECK-LABEL: @i_cosf( +; CHECK-NEXT: ret float 0x3FE14A2 +; + %res = tail call fast float @llvm.cos.f32(float 1.0) + ret float %res +} + +declare double @cosh(double) +define double @f_cosh() { +; CHECK-LABEL: @f_cosh( +; CHECK-NEXT: ret double 0x3FF8B075{{.+}} +; + %res = tail call fast double @cosh(double 1.0) + ret double %res +} + +declare float @expf(float) +define float @f_expf() { +; CHECK-LABEL: @f_expf( +; CHECK-NEXT: ret float 0x4005BF0A{{.+}} +; + %res = tail call fast float @expf(float 1.0) + ret float %res +} + +declare float @llvm.exp.f32(float) +define float @i_expf() { +; CHECK-LABEL: @i_expf( +; CHECK-NEXT: ret float 0x4005BF0A{{.+}} +; + %res = tail call fast float @llvm.exp.f32(float 1.0) + ret float %res +} + +declare double @exp2(double) +define double @f_exp2() { +; CHECK-LABEL: @f_exp2( +; CHECK-NEXT: ret double 2.000000e+00 +; + %res = tail call fast double @exp2(double 1.0) + ret double %res +} + +declare double @llvm.exp2.f64(double) +define double @i_exp2() { +; CHECK-LABEL: @i_exp2( +; CHECK-NEXT: ret double 2.000000e+00 +; + %res = tail call fast double @llvm.exp2.f64(double 1.0) + ret double %res +} + +; FIXME: exp10() is not widely supported. +declare float @exp10f(float) +define float @f_exp10f() { +; CHECK-LABEL: @f_exp10f( +; CHECK-NEXT: [[RES:%.*]] = tail call float @exp10f(float 1.000000e+00) +; CHECK-NEXT: ret float [[RES]] +; + %res = tail call float @exp10f(float 1.0) + ret float %res +} + +declare double @log(double) +define double @f_log() { +; CHECK-LABEL: @f_log( +; CHECK-NEXT: ret double 0.000000e+00 +; + %res = tail call fast double @log(double 1.0) + ret double %res +} + +declare double @llvm.log.f64(double) +define double @i_log() { +; CHECK-LABEL: @i_log( +; CHECK-NEXT: ret double 0.000000e+00 +; + %res = tail call fast double @llvm.log.f64(double 1.0) + ret double %res +} + +declare float @log2f(float) +define float @f_log2f() { +; CHECK-LABEL: @f_log2f( +; CHECK-NEXT: ret float 0.000000e+00 +; + %res = tail call fast float @log2f(float 1.0) + ret float %res +} + +declare float @llvm.log2.f32(float) +define float @i_log2f() { +; CHECK-LABEL: @i_log2f( +; CHECK-NEXT: ret float 0.000000e+00 +; + %res = tail call fast float @llvm.log2.f32(float 1.0) + ret float %res +} + +declare double @log10(double) +define double @f_log10() { +; CHECK-LABEL: @f_log10( +; CHECK-NEXT: ret double 0.000000e+00 +; + %res = tail call fast double @log10(double 1.0) + ret double %res +} + +declare float @sinf(float) +define float @f_sinf() { +; CHECK-LABEL: @f_sinf( +; CHECK-NEXT: ret float 0x3FEAED54{{.+}} +; + %res = tail call fast float @sinf(float 1.0) + ret float %res +} + +declare double @sinh(double) +define double @f_sinh() { +; CHECK-LABEL: @f_sinh( +; CHECK-NEXT: ret double 0x3FF2CD9F{{.+}} +; + %res = tail call fast double @sinh(double 1.0) + ret double %res +} + +declare float @sqrtf(float) +define float @f_sqrtf() { +; CHECK-LABEL: @f_sqrtf( +; CHECK-NEXT: ret float 1.000000e+00 +; + %res = tail call fast float @sqrtf(float 1.0) + ret float %res +} + +declare double @tan(double) +define double @f_tan() { +; CHECK-LABEL: @f_tan( +; CHECK-NEXT: ret double 0x3FF8EB24{{.+}} +; + %res = tail call fast double @tan(double 1.0) + ret double %res +} + +declare float @tanhf(float) +define float @f_tanhf() { +; CHECK-LABEL: @f_tanhf( +; CHECK-NEXT: [[RES:%.*]] = tail call fast float @tanhf(float 1.000000e+00) +; CHECK-NEXT: ret float 0x3FE85EFA{{.+}} +; + %res = tail call fast float @tanhf(float 1.0) + ret float %res +} diff --git a/llvm/test/Analysis/ConstantFolding/math-2.ll b/llvm/test/Transforms/InstSimplify/ConstProp/math-2.ll rename from llvm/test/Analysis/ConstantFolding/math-2.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/math-2.ll diff --git a/llvm/test/Analysis/ConstantFolding/min-max.ll b/llvm/test/Transforms/InstSimplify/ConstProp/min-max.ll rename from llvm/test/Analysis/ConstantFolding/min-max.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/min-max.ll --- a/llvm/test/Analysis/ConstantFolding/min-max.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/min-max.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -constprop -S < %s | FileCheck %s +; RUN: opt -instsimplify -S < %s | FileCheck %s declare float @llvm.minnum.f32(float, float) declare <4 x float> @llvm.minnum.v4f32(<4 x float>, <4 x float>) diff --git a/llvm/test/Transforms/ConstProp/overflow-ops.ll b/llvm/test/Transforms/InstSimplify/ConstProp/overflow-ops.ll rename from llvm/test/Transforms/ConstProp/overflow-ops.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/overflow-ops.ll --- a/llvm/test/Transforms/ConstProp/overflow-ops.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/overflow-ops.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s --check-prefixes=CHECK,CONSTPROP +; RUN: opt < %s -instsimplify -S | FileCheck %s --check-prefixes=CHECK,CONSTPROP ; RUN: opt < %s -instsimplify -S | FileCheck %s --check-prefixes=CHECK,INSTSIMPLIFY ; We must *NOT* have any check-lines with prefixes other than CHECK here. ; If we do, that means the rules are different between the passes. diff --git a/llvm/test/Transforms/ConstProp/phi.ll b/llvm/test/Transforms/InstSimplify/ConstProp/phi.ll rename from llvm/test/Transforms/ConstProp/phi.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/phi.ll --- a/llvm/test/Transforms/ConstProp/phi.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/phi.ll @@ -1,7 +1,7 @@ ; This is a basic sanity check for constant propagation. The add instruction ; should be eliminated. -; RUN: opt < %s -constprop -die -S | not grep phi +; RUN: opt < %s -instsimplify -die -S | not grep phi define i32 @test(i1 %B) { BB0: diff --git a/llvm/test/Transforms/ConstProp/remtest.ll b/llvm/test/Transforms/InstSimplify/ConstProp/remtest.ll rename from llvm/test/Transforms/ConstProp/remtest.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/remtest.ll --- a/llvm/test/Transforms/ConstProp/remtest.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/remtest.ll @@ -1,6 +1,6 @@ ; Ensure constant propagation of remainder instructions is working correctly. -; RUN: opt < %s -constprop -die -S | not grep rem +; RUN: opt < %s -instsimplify -die -S | not grep rem define i32 @test1() { %R = srem i32 4, 3 ; <i32> [#uses=1] diff --git a/llvm/test/Analysis/ConstantFolding/rint.ll b/llvm/test/Transforms/InstSimplify/ConstProp/rint.ll rename from llvm/test/Analysis/ConstantFolding/rint.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/rint.ll --- a/llvm/test/Analysis/ConstantFolding/rint.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/rint.ll @@ -1,109 +1,109 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -early-cse < %s | FileCheck %s - -declare float @nearbyintf(float) #0 -declare float @llvm.nearbyint.f32(float) #0 -declare double @nearbyint(double) #0 -declare double @llvm.nearbyint.f64(double) #0 -declare float @rintf(float) #0 -declare float @llvm.rint.f32(float) #0 -declare double @rint(double) #0 -declare double @llvm.rint.f64(double) #0 - -define float @constant_fold_rint_f32_01() #0 { -; CHECK-LABEL: @constant_fold_rint_f32_01( -; CHECK-NEXT: ret float 1.000000e+00 -; - %x = call float @nearbyintf(float 1.25) #0 - ret float %x -} - -define float @constant_fold_rint_f32_02() #0 { -; CHECK-LABEL: @constant_fold_rint_f32_02( -; CHECK-NEXT: ret float -1.000000e+00 -; - %x = call float @llvm.nearbyint.f32(float -1.25) #0 - ret float %x -} - -define float @constant_fold_rint_f32_03() #0 { -; CHECK-LABEL: @constant_fold_rint_f32_03( -; CHECK-NEXT: ret float 2.000000e+00 -; - %x = call float @rintf(float 1.5) #0 - ret float %x -} - -define float @constant_fold_rint_f32_04() #0 { -; CHECK-LABEL: @constant_fold_rint_f32_04( -; CHECK-NEXT: ret float -2.000000e+00 -; - %x = call float @llvm.rint.f32(float -1.5) #0 - ret float %x -} - -define float @constant_fold_rint_f32_05() #0 { -; CHECK-LABEL: @constant_fold_rint_f32_05( -; CHECK-NEXT: ret float 3.000000e+00 -; - %x = call float @nearbyintf(float 2.75) #0 - ret float %x -} - -define float @constant_fold_rint_f32_06() #0 { -; CHECK-LABEL: @constant_fold_rint_f32_06( -; CHECK-NEXT: ret float -3.000000e+00 -; - %x = call float @llvm.nearbyint.f32(float -2.75) #0 - ret float %x -} - -define double @constant_fold_rint_f64_01() #0 { -; CHECK-LABEL: @constant_fold_rint_f64_01( -; CHECK-NEXT: ret double 1.000000e+00 -; - %x = call double @rint(double 1.3) #0 - ret double %x -} - -define double @constant_fold_rint_f64_02() #0 { -; CHECK-LABEL: @constant_fold_rint_f64_02( -; CHECK-NEXT: ret double -1.000000e+00 -; - %x = call double @llvm.rint.f64(double -1.3) #0 - ret double %x -} - -define double @constant_fold_rint_f64_03() #0 { -; CHECK-LABEL: @constant_fold_rint_f64_03( -; CHECK-NEXT: ret double 2.000000e+00 -; - %x = call double @nearbyint(double 1.5) #0 - ret double %x -} - -define double @constant_fold_rint_f64_04() #0 { -; CHECK-LABEL: @constant_fold_rint_f64_04( -; CHECK-NEXT: ret double -2.000000e+00 -; - %x = call double @llvm.nearbyint.f64(double -1.5) #0 - ret double %x -} - -define double @constant_fold_rint_f64_05() #0 { -; CHECK-LABEL: @constant_fold_rint_f64_05( -; CHECK-NEXT: ret double 3.000000e+00 -; - %x = call double @rint(double 2.7) #0 - ret double %x -} - -define double @constant_fold_rint_f64_06() #0 { -; CHECK-LABEL: @constant_fold_rint_f64_06( -; CHECK-NEXT: ret double -3.000000e+00 -; - %x = call double @llvm.rint.f64(double -2.7) #0 - ret double %x -} - -attributes #0 = { nounwind readnone } +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -early-cse < %s | FileCheck %s + +declare float @nearbyintf(float) #0 +declare float @llvm.nearbyint.f32(float) #0 +declare double @nearbyint(double) #0 +declare double @llvm.nearbyint.f64(double) #0 +declare float @rintf(float) #0 +declare float @llvm.rint.f32(float) #0 +declare double @rint(double) #0 +declare double @llvm.rint.f64(double) #0 + +define float @constant_fold_rint_f32_01() #0 { +; CHECK-LABEL: @constant_fold_rint_f32_01( +; CHECK-NEXT: ret float 1.000000e+00 +; + %x = call float @nearbyintf(float 1.25) #0 + ret float %x +} + +define float @constant_fold_rint_f32_02() #0 { +; CHECK-LABEL: @constant_fold_rint_f32_02( +; CHECK-NEXT: ret float -1.000000e+00 +; + %x = call float @llvm.nearbyint.f32(float -1.25) #0 + ret float %x +} + +define float @constant_fold_rint_f32_03() #0 { +; CHECK-LABEL: @constant_fold_rint_f32_03( +; CHECK-NEXT: ret float 2.000000e+00 +; + %x = call float @rintf(float 1.5) #0 + ret float %x +} + +define float @constant_fold_rint_f32_04() #0 { +; CHECK-LABEL: @constant_fold_rint_f32_04( +; CHECK-NEXT: ret float -2.000000e+00 +; + %x = call float @llvm.rint.f32(float -1.5) #0 + ret float %x +} + +define float @constant_fold_rint_f32_05() #0 { +; CHECK-LABEL: @constant_fold_rint_f32_05( +; CHECK-NEXT: ret float 3.000000e+00 +; + %x = call float @nearbyintf(float 2.75) #0 + ret float %x +} + +define float @constant_fold_rint_f32_06() #0 { +; CHECK-LABEL: @constant_fold_rint_f32_06( +; CHECK-NEXT: ret float -3.000000e+00 +; + %x = call float @llvm.nearbyint.f32(float -2.75) #0 + ret float %x +} + +define double @constant_fold_rint_f64_01() #0 { +; CHECK-LABEL: @constant_fold_rint_f64_01( +; CHECK-NEXT: ret double 1.000000e+00 +; + %x = call double @rint(double 1.3) #0 + ret double %x +} + +define double @constant_fold_rint_f64_02() #0 { +; CHECK-LABEL: @constant_fold_rint_f64_02( +; CHECK-NEXT: ret double -1.000000e+00 +; + %x = call double @llvm.rint.f64(double -1.3) #0 + ret double %x +} + +define double @constant_fold_rint_f64_03() #0 { +; CHECK-LABEL: @constant_fold_rint_f64_03( +; CHECK-NEXT: ret double 2.000000e+00 +; + %x = call double @nearbyint(double 1.5) #0 + ret double %x +} + +define double @constant_fold_rint_f64_04() #0 { +; CHECK-LABEL: @constant_fold_rint_f64_04( +; CHECK-NEXT: ret double -2.000000e+00 +; + %x = call double @llvm.nearbyint.f64(double -1.5) #0 + ret double %x +} + +define double @constant_fold_rint_f64_05() #0 { +; CHECK-LABEL: @constant_fold_rint_f64_05( +; CHECK-NEXT: ret double 3.000000e+00 +; + %x = call double @rint(double 2.7) #0 + ret double %x +} + +define double @constant_fold_rint_f64_06() #0 { +; CHECK-LABEL: @constant_fold_rint_f64_06( +; CHECK-NEXT: ret double -3.000000e+00 +; + %x = call double @llvm.rint.f64(double -2.7) #0 + ret double %x +} + +attributes #0 = { nounwind readnone } diff --git a/llvm/test/Analysis/ConstantFolding/round.ll b/llvm/test/Transforms/InstSimplify/ConstProp/round.ll rename from llvm/test/Analysis/ConstantFolding/round.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/round.ll --- a/llvm/test/Analysis/ConstantFolding/round.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/round.ll @@ -1,92 +1,92 @@ -; RUN: opt -S -early-cse < %s | FileCheck %s - -declare float @roundf(float) #0 -declare float @llvm.round.f32(float) #0 -declare double @round(double) #0 -declare double @llvm.round.f64(double) #0 - -; CHECK-LABEL: @constant_fold_round_f32_01 -; CHECK-NEXT: ret float 1.000000e+00 -define float @constant_fold_round_f32_01() #0 { - %x = call float @roundf(float 1.25) #0 - ret float %x -} - -; CHECK-LABEL: @constant_fold_round_f32_02 -; CHECK-NEXT: ret float -1.000000e+00 -define float @constant_fold_round_f32_02() #0 { - %x = call float @llvm.round.f32(float -1.25) #0 - ret float %x -} - -; CHECK-LABEL: @constant_fold_round_f32_03 -; CHECK-NEXT: ret float 2.000000e+00 -define float @constant_fold_round_f32_03() #0 { - %x = call float @roundf(float 1.5) #0 - ret float %x -} - -; CHECK-LABEL: @constant_fold_round_f32_04 -; CHECK-NEXT: ret float -2.000000e+00 -define float @constant_fold_round_f32_04() #0 { - %x = call float @llvm.round.f32(float -1.5) #0 - ret float %x -} - -; CHECK-LABEL: @constant_fold_round_f32_05 -; CHECK-NEXT: ret float 3.000000e+00 -define float @constant_fold_round_f32_05() #0 { - %x = call float @roundf(float 2.75) #0 - ret float %x -} - -; CHECK-LABEL: @constant_fold_round_f32_06 -; CHECK-NEXT: ret float -3.000000e+00 -define float @constant_fold_round_f32_06() #0 { - %x = call float @llvm.round.f32(float -2.75) #0 - ret float %x -} - -; CHECK-LABEL: @constant_fold_round_f64_01 -; CHECK-NEXT: ret double 1.000000e+00 -define double @constant_fold_round_f64_01() #0 { - %x = call double @round(double 1.3) #0 - ret double %x -} - -; CHECK-LABEL: @constant_fold_round_f64_02 -; CHECK-NEXT: ret double -1.000000e+00 -define double @constant_fold_round_f64_02() #0 { - %x = call double @llvm.round.f64(double -1.3) #0 - ret double %x -} - -; CHECK-LABEL: @constant_fold_round_f64_03 -; CHECK-NEXT: ret double 2.000000e+00 -define double @constant_fold_round_f64_03() #0 { - %x = call double @round(double 1.5) #0 - ret double %x -} - -; CHECK-LABEL: @constant_fold_round_f64_04 -; CHECK-NEXT: ret double -2.000000e+00 -define double @constant_fold_round_f64_04() #0 { - %x = call double @llvm.round.f64(double -1.5) #0 - ret double %x -} - -; CHECK-LABEL: @constant_fold_round_f64_05 -; CHECK-NEXT: ret double 3.000000e+00 -define double @constant_fold_round_f64_05() #0 { - %x = call double @round(double 2.7) #0 - ret double %x -} - -; CHECK-LABEL: @constant_fold_round_f64_06 -; CHECK-NEXT: ret double -3.000000e+00 -define double @constant_fold_round_f64_06() #0 { - %x = call double @llvm.round.f64(double -2.7) #0 - ret double %x -} - -attributes #0 = { nounwind readnone } +; RUN: opt -S -early-cse < %s | FileCheck %s + +declare float @roundf(float) #0 +declare float @llvm.round.f32(float) #0 +declare double @round(double) #0 +declare double @llvm.round.f64(double) #0 + +; CHECK-LABEL: @constant_fold_round_f32_01 +; CHECK-NEXT: ret float 1.000000e+00 +define float @constant_fold_round_f32_01() #0 { + %x = call float @roundf(float 1.25) #0 + ret float %x +} + +; CHECK-LABEL: @constant_fold_round_f32_02 +; CHECK-NEXT: ret float -1.000000e+00 +define float @constant_fold_round_f32_02() #0 { + %x = call float @llvm.round.f32(float -1.25) #0 + ret float %x +} + +; CHECK-LABEL: @constant_fold_round_f32_03 +; CHECK-NEXT: ret float 2.000000e+00 +define float @constant_fold_round_f32_03() #0 { + %x = call float @roundf(float 1.5) #0 + ret float %x +} + +; CHECK-LABEL: @constant_fold_round_f32_04 +; CHECK-NEXT: ret float -2.000000e+00 +define float @constant_fold_round_f32_04() #0 { + %x = call float @llvm.round.f32(float -1.5) #0 + ret float %x +} + +; CHECK-LABEL: @constant_fold_round_f32_05 +; CHECK-NEXT: ret float 3.000000e+00 +define float @constant_fold_round_f32_05() #0 { + %x = call float @roundf(float 2.75) #0 + ret float %x +} + +; CHECK-LABEL: @constant_fold_round_f32_06 +; CHECK-NEXT: ret float -3.000000e+00 +define float @constant_fold_round_f32_06() #0 { + %x = call float @llvm.round.f32(float -2.75) #0 + ret float %x +} + +; CHECK-LABEL: @constant_fold_round_f64_01 +; CHECK-NEXT: ret double 1.000000e+00 +define double @constant_fold_round_f64_01() #0 { + %x = call double @round(double 1.3) #0 + ret double %x +} + +; CHECK-LABEL: @constant_fold_round_f64_02 +; CHECK-NEXT: ret double -1.000000e+00 +define double @constant_fold_round_f64_02() #0 { + %x = call double @llvm.round.f64(double -1.3) #0 + ret double %x +} + +; CHECK-LABEL: @constant_fold_round_f64_03 +; CHECK-NEXT: ret double 2.000000e+00 +define double @constant_fold_round_f64_03() #0 { + %x = call double @round(double 1.5) #0 + ret double %x +} + +; CHECK-LABEL: @constant_fold_round_f64_04 +; CHECK-NEXT: ret double -2.000000e+00 +define double @constant_fold_round_f64_04() #0 { + %x = call double @llvm.round.f64(double -1.5) #0 + ret double %x +} + +; CHECK-LABEL: @constant_fold_round_f64_05 +; CHECK-NEXT: ret double 3.000000e+00 +define double @constant_fold_round_f64_05() #0 { + %x = call double @round(double 2.7) #0 + ret double %x +} + +; CHECK-LABEL: @constant_fold_round_f64_06 +; CHECK-NEXT: ret double -3.000000e+00 +define double @constant_fold_round_f64_06() #0 { + %x = call double @llvm.round.f64(double -2.7) #0 + ret double %x +} + +attributes #0 = { nounwind readnone } diff --git a/llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll b/llvm/test/Transforms/InstSimplify/ConstProp/saturating-add-sub.ll rename from llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/saturating-add-sub.ll --- a/llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/saturating-add-sub.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s declare i8 @llvm.uadd.sat.i8(i8, i8) declare i8 @llvm.sadd.sat.i8(i8, i8) diff --git a/llvm/test/Transforms/ConstProp/shift.ll b/llvm/test/Transforms/InstSimplify/ConstProp/shift.ll rename from llvm/test/Transforms/ConstProp/shift.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/shift.ll --- a/llvm/test/Transforms/ConstProp/shift.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/shift.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ; CHECK-LABEL: shift_undef_64 define void @shift_undef_64(i64* %p) { diff --git a/llvm/test/Analysis/ConstantFolding/smul-fix-sat.ll b/llvm/test/Transforms/InstSimplify/ConstProp/smul-fix-sat.ll rename from llvm/test/Analysis/ConstantFolding/smul-fix-sat.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/smul-fix-sat.ll --- a/llvm/test/Analysis/ConstantFolding/smul-fix-sat.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/smul-fix-sat.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ;----------------------------------------------------------------------------- ; Simple test using scalar layout. diff --git a/llvm/test/Analysis/ConstantFolding/smul-fix.ll b/llvm/test/Transforms/InstSimplify/ConstProp/smul-fix.ll rename from llvm/test/Analysis/ConstantFolding/smul-fix.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/smul-fix.ll --- a/llvm/test/Analysis/ConstantFolding/smul-fix.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/smul-fix.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ;----------------------------------------------------------------------------- ; Simple test using scalar layout. diff --git a/llvm/test/Transforms/ConstProp/sse.ll b/llvm/test/Transforms/InstSimplify/ConstProp/sse.ll rename from llvm/test/Transforms/ConstProp/sse.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/sse.ll --- a/llvm/test/Transforms/ConstProp/sse.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/sse.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s ; REQUIRES: x86-registered-target define i1 @test_sse_cvts_exact() nounwind readnone { diff --git a/llvm/test/Analysis/ConstantFolding/timeout.ll b/llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll rename from llvm/test/Analysis/ConstantFolding/timeout.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll --- a/llvm/test/Analysis/ConstantFolding/timeout.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/timeout.ll @@ -1,73 +1,73 @@ -; NOTE: This is a timeout test for some O(something silly) constant folding behaviour. It may not be the best test. Providing it finishes, it passes. -; RUN: opt < %s -O3 -S | FileCheck %s -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" -target triple = "armv8-none-eabi" - -%struct.ST = type { %struct.ST* } - -@global = internal global [121 x i8] zeroinitializer, align 1 - -define void @func() #0 { -;CHECK-LABEL: func -entry: - %s = alloca %struct.ST*, align 4 - %j = alloca i32, align 4 - store %struct.ST* bitcast ([121 x i8]* @global to %struct.ST*), %struct.ST** %s, align 4 - store i32 0, i32* %j, align 4 - br label %for.cond - -for.cond: ; preds = %for.inc, %entry - %0 = load i32, i32* %j, align 4 - %cmp = icmp slt i32 %0, 30 - br i1 %cmp, label %for.body, label %for.end - -for.body: ; preds = %for.cond - %1 = load %struct.ST*, %struct.ST** %s, align 4 - %2 = bitcast %struct.ST* %1 to i8* - %add.ptr = getelementptr inbounds i8, i8* %2, i32 4 - %3 = ptrtoint i8* %add.ptr to i32 - %4 = load %struct.ST*, %struct.ST** %s, align 4 - %5 = bitcast %struct.ST* %4 to i8* - %add.ptr1 = getelementptr inbounds i8, i8* %5, i32 4 - %6 = ptrtoint i8* %add.ptr1 to i32 - %rem = urem i32 %6, 2 - %cmp2 = icmp eq i32 %rem, 0 - br i1 %cmp2, label %cond.true, label %cond.false - -cond.true: ; preds = %for.body - br label %cond.end - -cond.false: ; preds = %for.body - %7 = load %struct.ST*, %struct.ST** %s, align 4 - %8 = bitcast %struct.ST* %7 to i8* - %add.ptr3 = getelementptr inbounds i8, i8* %8, i32 4 - %9 = ptrtoint i8* %add.ptr3 to i32 - %rem4 = urem i32 %9, 2 - br label %cond.end - -cond.end: ; preds = %cond.false, %cond.true - %cond = phi i32 [ 0, %cond.true ], [ %rem4, %cond.false ] - %add = add i32 %3, %cond - %10 = inttoptr i32 %add to %struct.ST* - %11 = load %struct.ST*, %struct.ST** %s, align 4 - %next = getelementptr inbounds %struct.ST, %struct.ST* %11, i32 0, i32 0 - store %struct.ST* %10, %struct.ST** %next, align 4 - %12 = load %struct.ST*, %struct.ST** %s, align 4 - %next5 = getelementptr inbounds %struct.ST, %struct.ST* %12, i32 0, i32 0 - %13 = load %struct.ST*, %struct.ST** %next5, align 4 - store %struct.ST* %13, %struct.ST** %s, align 4 - br label %for.inc - -for.inc: ; preds = %cond.end - %14 = load i32, i32* %j, align 4 - %inc = add nsw i32 %14, 1 - store i32 %inc, i32* %j, align 4 - br label %for.cond - -for.end: ; preds = %for.cond - %15 = load %struct.ST*, %struct.ST** %s, align 4 - %next6 = getelementptr inbounds %struct.ST, %struct.ST* %15, i32 0, i32 0 - store %struct.ST* null, %struct.ST** %next6, align 4 - ret void -} - +; NOTE: This is a timeout test for some O(something silly) constant folding behaviour. It may not be the best test. Providing it finishes, it passes. +; RUN: opt < %s -O3 -S | FileCheck %s +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "armv8-none-eabi" + +%struct.ST = type { %struct.ST* } + +@global = internal global [121 x i8] zeroinitializer, align 1 + +define void @func() #0 { +;CHECK-LABEL: func +entry: + %s = alloca %struct.ST*, align 4 + %j = alloca i32, align 4 + store %struct.ST* bitcast ([121 x i8]* @global to %struct.ST*), %struct.ST** %s, align 4 + store i32 0, i32* %j, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32, i32* %j, align 4 + %cmp = icmp slt i32 %0, 30 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load %struct.ST*, %struct.ST** %s, align 4 + %2 = bitcast %struct.ST* %1 to i8* + %add.ptr = getelementptr inbounds i8, i8* %2, i32 4 + %3 = ptrtoint i8* %add.ptr to i32 + %4 = load %struct.ST*, %struct.ST** %s, align 4 + %5 = bitcast %struct.ST* %4 to i8* + %add.ptr1 = getelementptr inbounds i8, i8* %5, i32 4 + %6 = ptrtoint i8* %add.ptr1 to i32 + %rem = urem i32 %6, 2 + %cmp2 = icmp eq i32 %rem, 0 + br i1 %cmp2, label %cond.true, label %cond.false + +cond.true: ; preds = %for.body + br label %cond.end + +cond.false: ; preds = %for.body + %7 = load %struct.ST*, %struct.ST** %s, align 4 + %8 = bitcast %struct.ST* %7 to i8* + %add.ptr3 = getelementptr inbounds i8, i8* %8, i32 4 + %9 = ptrtoint i8* %add.ptr3 to i32 + %rem4 = urem i32 %9, 2 + br label %cond.end + +cond.end: ; preds = %cond.false, %cond.true + %cond = phi i32 [ 0, %cond.true ], [ %rem4, %cond.false ] + %add = add i32 %3, %cond + %10 = inttoptr i32 %add to %struct.ST* + %11 = load %struct.ST*, %struct.ST** %s, align 4 + %next = getelementptr inbounds %struct.ST, %struct.ST* %11, i32 0, i32 0 + store %struct.ST* %10, %struct.ST** %next, align 4 + %12 = load %struct.ST*, %struct.ST** %s, align 4 + %next5 = getelementptr inbounds %struct.ST, %struct.ST* %12, i32 0, i32 0 + %13 = load %struct.ST*, %struct.ST** %next5, align 4 + store %struct.ST* %13, %struct.ST** %s, align 4 + br label %for.inc + +for.inc: ; preds = %cond.end + %14 = load i32, i32* %j, align 4 + %inc = add nsw i32 %14, 1 + store i32 %inc, i32* %j, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + %15 = load %struct.ST*, %struct.ST** %s, align 4 + %next6 = getelementptr inbounds %struct.ST, %struct.ST* %15, i32 0, i32 0 + store %struct.ST* null, %struct.ST** %next6, align 4 + ret void +} + diff --git a/llvm/test/Analysis/ConstantFolding/trunc.ll b/llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll rename from llvm/test/Analysis/ConstantFolding/trunc.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll --- a/llvm/test/Analysis/ConstantFolding/trunc.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll @@ -1,105 +1,105 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -early-cse < %s | FileCheck %s - -declare float @truncf(float) #0 -declare float @llvm.trunc.f32(float) #0 -declare double @trunc(double) #0 -declare double @llvm.trunc.f64(double) #0 - -define float @constant_fold_trunc_f32_01() #0 { -; CHECK-LABEL: @constant_fold_trunc_f32_01( -; CHECK-NEXT: ret float 1.000000e+00 -; - %x = call float @truncf(float 1.25) #0 - ret float %x -} - -define float @constant_fold_trunc_f32_02() #0 { -; CHECK-LABEL: @constant_fold_trunc_f32_02( -; CHECK-NEXT: ret float -1.000000e+00 -; - %x = call float @llvm.trunc.f32(float -1.25) #0 - ret float %x -} - -define float @constant_fold_trunc_f32_03() #0 { -; CHECK-LABEL: @constant_fold_trunc_f32_03( -; CHECK-NEXT: ret float 1.000000e+00 -; - %x = call float @truncf(float 1.5) #0 - ret float %x -} - -define float @constant_fold_trunc_f32_04() #0 { -; CHECK-LABEL: @constant_fold_trunc_f32_04( -; CHECK-NEXT: ret float -1.000000e+00 -; - %x = call float @llvm.trunc.f32(float -1.5) #0 - ret float %x -} - -define float @constant_fold_trunc_f32_05() #0 { -; CHECK-LABEL: @constant_fold_trunc_f32_05( -; CHECK-NEXT: ret float 2.000000e+00 -; - %x = call float @truncf(float 2.75) #0 - ret float %x -} - -define float @constant_fold_trunc_f32_06() #0 { -; CHECK-LABEL: @constant_fold_trunc_f32_06( -; CHECK-NEXT: ret float -2.000000e+00 -; - %x = call float @llvm.trunc.f32(float -2.75) #0 - ret float %x -} - -define double @constant_fold_trunc_f64_01() #0 { -; CHECK-LABEL: @constant_fold_trunc_f64_01( -; CHECK-NEXT: ret double 1.000000e+00 -; - %x = call double @trunc(double 1.3) #0 - ret double %x -} - -define double @constant_fold_trunc_f64_02() #0 { -; CHECK-LABEL: @constant_fold_trunc_f64_02( -; CHECK-NEXT: ret double -1.000000e+00 -; - %x = call double @llvm.trunc.f64(double -1.3) #0 - ret double %x -} - -define double @constant_fold_trunc_f64_03() #0 { -; CHECK-LABEL: @constant_fold_trunc_f64_03( -; CHECK-NEXT: ret double 1.000000e+00 -; - %x = call double @trunc(double 1.5) #0 - ret double %x -} - -define double @constant_fold_trunc_f64_04() #0 { -; CHECK-LABEL: @constant_fold_trunc_f64_04( -; CHECK-NEXT: ret double -1.000000e+00 -; - %x = call double @llvm.trunc.f64(double -1.5) #0 - ret double %x -} - -define double @constant_fold_trunc_f64_05() #0 { -; CHECK-LABEL: @constant_fold_trunc_f64_05( -; CHECK-NEXT: ret double 2.000000e+00 -; - %x = call double @trunc(double 2.7) #0 - ret double %x -} - -define double @constant_fold_trunc_f64_06() #0 { -; CHECK-LABEL: @constant_fold_trunc_f64_06( -; CHECK-NEXT: ret double -2.000000e+00 -; - %x = call double @llvm.trunc.f64(double -2.7) #0 - ret double %x -} - -attributes #0 = { nounwind readnone } +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -early-cse < %s | FileCheck %s + +declare float @truncf(float) #0 +declare float @llvm.trunc.f32(float) #0 +declare double @trunc(double) #0 +declare double @llvm.trunc.f64(double) #0 + +define float @constant_fold_trunc_f32_01() #0 { +; CHECK-LABEL: @constant_fold_trunc_f32_01( +; CHECK-NEXT: ret float 1.000000e+00 +; + %x = call float @truncf(float 1.25) #0 + ret float %x +} + +define float @constant_fold_trunc_f32_02() #0 { +; CHECK-LABEL: @constant_fold_trunc_f32_02( +; CHECK-NEXT: ret float -1.000000e+00 +; + %x = call float @llvm.trunc.f32(float -1.25) #0 + ret float %x +} + +define float @constant_fold_trunc_f32_03() #0 { +; CHECK-LABEL: @constant_fold_trunc_f32_03( +; CHECK-NEXT: ret float 1.000000e+00 +; + %x = call float @truncf(float 1.5) #0 + ret float %x +} + +define float @constant_fold_trunc_f32_04() #0 { +; CHECK-LABEL: @constant_fold_trunc_f32_04( +; CHECK-NEXT: ret float -1.000000e+00 +; + %x = call float @llvm.trunc.f32(float -1.5) #0 + ret float %x +} + +define float @constant_fold_trunc_f32_05() #0 { +; CHECK-LABEL: @constant_fold_trunc_f32_05( +; CHECK-NEXT: ret float 2.000000e+00 +; + %x = call float @truncf(float 2.75) #0 + ret float %x +} + +define float @constant_fold_trunc_f32_06() #0 { +; CHECK-LABEL: @constant_fold_trunc_f32_06( +; CHECK-NEXT: ret float -2.000000e+00 +; + %x = call float @llvm.trunc.f32(float -2.75) #0 + ret float %x +} + +define double @constant_fold_trunc_f64_01() #0 { +; CHECK-LABEL: @constant_fold_trunc_f64_01( +; CHECK-NEXT: ret double 1.000000e+00 +; + %x = call double @trunc(double 1.3) #0 + ret double %x +} + +define double @constant_fold_trunc_f64_02() #0 { +; CHECK-LABEL: @constant_fold_trunc_f64_02( +; CHECK-NEXT: ret double -1.000000e+00 +; + %x = call double @llvm.trunc.f64(double -1.3) #0 + ret double %x +} + +define double @constant_fold_trunc_f64_03() #0 { +; CHECK-LABEL: @constant_fold_trunc_f64_03( +; CHECK-NEXT: ret double 1.000000e+00 +; + %x = call double @trunc(double 1.5) #0 + ret double %x +} + +define double @constant_fold_trunc_f64_04() #0 { +; CHECK-LABEL: @constant_fold_trunc_f64_04( +; CHECK-NEXT: ret double -1.000000e+00 +; + %x = call double @llvm.trunc.f64(double -1.5) #0 + ret double %x +} + +define double @constant_fold_trunc_f64_05() #0 { +; CHECK-LABEL: @constant_fold_trunc_f64_05( +; CHECK-NEXT: ret double 2.000000e+00 +; + %x = call double @trunc(double 2.7) #0 + ret double %x +} + +define double @constant_fold_trunc_f64_06() #0 { +; CHECK-LABEL: @constant_fold_trunc_f64_06( +; CHECK-NEXT: ret double -2.000000e+00 +; + %x = call double @llvm.trunc.f64(double -2.7) #0 + ret double %x +} + +attributes #0 = { nounwind readnone } diff --git a/llvm/test/Transforms/ConstProp/trunc_vec.ll b/llvm/test/Transforms/InstSimplify/ConstProp/trunc_vec.ll rename from llvm/test/Transforms/ConstProp/trunc_vec.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/trunc_vec.ll --- a/llvm/test/Transforms/ConstProp/trunc_vec.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/trunc_vec.ll @@ -1,4 +1,4 @@ -; RUN: opt -constprop < %s +; RUN: opt -instsimplify < %s ; Make sure we don't crash on this one diff --git a/llvm/test/Analysis/ConstantFolding/vecreduce.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll rename from llvm/test/Analysis/ConstantFolding/vecreduce.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll --- a/llvm/test/Analysis/ConstantFolding/vecreduce.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -instsimplify -S | FileCheck %s declare i32 @llvm.experimental.vector.reduce.add.v1i32(<1 x i32> %a) declare i32 @llvm.experimental.vector.reduce.add.v8i32(<8 x i32> %a) diff --git a/llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts.ll rename from llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts.ll --- a/llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S -o - | FileCheck %s +; RUN: opt < %s -instsimplify -S -o - | FileCheck %s ; When both operands are undef in a lane, that lane should produce an undef result. diff --git a/llvm/test/Analysis/ConstantFolding/vectorgep-crash.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vectorgep-crash.ll rename from llvm/test/Analysis/ConstantFolding/vectorgep-crash.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/vectorgep-crash.ll diff --git a/llvm/test/Analysis/ConstantFolding/vscale-getelementptr.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vscale-getelementptr.ll rename from llvm/test/Analysis/ConstantFolding/vscale-getelementptr.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/vscale-getelementptr.ll --- a/llvm/test/Analysis/ConstantFolding/vscale-getelementptr.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/vscale-getelementptr.ll @@ -1,32 +1,32 @@ -; RUN: opt -early-cse -S < %s | FileCheck %s - -target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" -target triple = "aarch64" - -; CHECK-LABEL: define <4 x i32*> @fixed_length_version_first() { -; CHECK-NEXT: ret <4 x i32*> undef -define <4 x i32*> @fixed_length_version_first() { - %ptr = getelementptr i32, <4 x i32*> undef, <4 x i64> undef - ret <4 x i32*> %ptr -} - -; CHECK-LABEL: define <4 x <4 x i32>*> @fixed_length_version_second() { -; CHECK-NEXT: ret <4 x <4 x i32>*> undef -define <4 x <4 x i32>*> @fixed_length_version_second() { - %ptr = getelementptr <4 x i32>, <4 x i32>* undef, <4 x i64> undef - ret <4 x <4 x i32>*> %ptr -} - -; CHECK-LABEL: define <vscale x 4 x i32*> @vscale_version_first() { -; CHECK-NEXT: ret <vscale x 4 x i32*> undef -define <vscale x 4 x i32*> @vscale_version_first() { - %ptr = getelementptr i32, <vscale x 4 x i32*> undef, <vscale x 4 x i64> undef - ret <vscale x 4 x i32*> %ptr -} - -; CHECK-LABEL: define <vscale x 4 x <vscale x 4 x i32>*> @vscale_version_second() { -; CHECK-NEXT: ret <vscale x 4 x <vscale x 4 x i32>*> undef -define <vscale x 4 x <vscale x 4 x i32>*> @vscale_version_second() { - %ptr = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* undef, <vscale x 4 x i64> undef - ret <vscale x 4 x <vscale x 4 x i32>*> %ptr -} +; RUN: opt -early-cse -S < %s | FileCheck %s + +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" +target triple = "aarch64" + +; CHECK-LABEL: define <4 x i32*> @fixed_length_version_first() { +; CHECK-NEXT: ret <4 x i32*> undef +define <4 x i32*> @fixed_length_version_first() { + %ptr = getelementptr i32, <4 x i32*> undef, <4 x i64> undef + ret <4 x i32*> %ptr +} + +; CHECK-LABEL: define <4 x <4 x i32>*> @fixed_length_version_second() { +; CHECK-NEXT: ret <4 x <4 x i32>*> undef +define <4 x <4 x i32>*> @fixed_length_version_second() { + %ptr = getelementptr <4 x i32>, <4 x i32>* undef, <4 x i64> undef + ret <4 x <4 x i32>*> %ptr +} + +; CHECK-LABEL: define <vscale x 4 x i32*> @vscale_version_first() { +; CHECK-NEXT: ret <vscale x 4 x i32*> undef +define <vscale x 4 x i32*> @vscale_version_first() { + %ptr = getelementptr i32, <vscale x 4 x i32*> undef, <vscale x 4 x i64> undef + ret <vscale x 4 x i32*> %ptr +} + +; CHECK-LABEL: define <vscale x 4 x <vscale x 4 x i32>*> @vscale_version_second() { +; CHECK-NEXT: ret <vscale x 4 x <vscale x 4 x i32>*> undef +define <vscale x 4 x <vscale x 4 x i32>*> @vscale_version_second() { + %ptr = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* undef, <vscale x 4 x i64> undef + ret <vscale x 4 x <vscale x 4 x i32>*> %ptr +} diff --git a/llvm/test/Analysis/ConstantFolding/vscale-shufflevector.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vscale-shufflevector.ll rename from llvm/test/Analysis/ConstantFolding/vscale-shufflevector.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/vscale-shufflevector.ll diff --git a/llvm/test/Analysis/ConstantFolding/vscale.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vscale.ll rename from llvm/test/Analysis/ConstantFolding/vscale.ll rename to llvm/test/Transforms/InstSimplify/ConstProp/vscale.ll --- a/llvm/test/Analysis/ConstantFolding/vscale.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/vscale.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S -verify | FileCheck %s +; RUN: opt < %s -instsimplify -S -verify | FileCheck %s ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Unary Operations @@ -225,14 +225,14 @@ ret <vscale x 4 x i32> %r } -declare <vscale x 16 x i8> @llvm.sadd.sat.nxv16i8(<vscale x 16 x i8>, <vscale x 16 x i8>) +declare <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8>, <vscale x 16 x i8>) define <vscale x 16 x i8> @call() { ; CHECK-LABEL: @call( -; CHECK-NEXT: [[R:%.*]] = call <vscale x 16 x i8> @llvm.sadd.sat.nxv16i8(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) +; CHECK-NEXT: [[R:%.*]] = call <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) ; CHECK-NEXT: ret <vscale x 16 x i8> [[R]] ; - %r = call <vscale x 16 x i8> @llvm.sadd.sat.nxv16i8(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) + %r = call <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) ret <vscale x 16 x i8> %r } diff --git a/llvm/test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll b/llvm/test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll --- a/llvm/test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll +++ b/llvm/test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll @@ -1,6 +1,6 @@ ; Make sure this doesn't turn into an infinite loop -; RUN: opt < %s -simplifycfg -constprop -simplifycfg | llvm-dis | FileCheck %s +; RUN: opt < %s -simplifycfg -instsimplify -simplifycfg | llvm-dis | FileCheck %s %struct.anon = type { i32, i32, i32, i32, [1024 x i8] } @_zero_ = external global %struct.anon* ; <%struct.anon**> [#uses=2] diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp @@ -285,7 +285,6 @@ void buildAndRunPasses() { LLVMPassManagerRef pass = LLVMCreatePassManager(); - LLVMAddConstantPropagationPass(pass); LLVMAddInstructionCombiningPass(pass); LLVMRunPassManager(pass, Module); LLVMDisposePassManager(pass); diff --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn --- a/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn @@ -15,7 +15,6 @@ "BDCE.cpp", "CallSiteSplitting.cpp", "ConstantHoisting.cpp", - "ConstantProp.cpp", "CorrelatedValuePropagation.cpp", "DCE.cpp", "DeadStoreElimination.cpp",