From isanbard at gmail.com Mon May 26 00:18:35 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 26 May 2008 05:18:35 -0000 Subject: [llvm-commits] [llvm] r51562 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200805260518.m4Q5IaES016278@zion.cs.uiuc.edu> Author: void Date: Mon May 26 00:18:34 2008 New Revision: 51562 URL: http://llvm.org/viewvc/llvm-project?rev=51562&view=rev Log: A problem that's exposed when machine LICM is enabled. Consider this code: LBB1_3: # bb .. xorl %ebp, %ebp subl (%ebx), %ebp .. incl %ecx cmpl %edi, %ecx jl LBB1_3 # bb Whe using machine LICM, LLVM converts it into: xorl %esi, %esi LBB1_3: # bb .. movl %esi, %ebp subl (%ebx), %ebp .. incl %ecx cmpl %edi, %ecx jl LBB1_3 # bb Two address conversion inserts the copy instruction. However, it's cheaper to rematerialize it, and remat helps reduce register pressure. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51562&r1=51561&r2=51562&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon May 26 00:18:34 2008 @@ -39,6 +39,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" using namespace llvm; @@ -200,6 +201,8 @@ DOUT << "********** REWRITING TWO-ADDR INSTRS **********\n"; DOUT << "********** Function: " << MF.getFunction()->getName() << '\n'; + SmallPtrSet ReMattedInstrs; + for (MachineFunction::iterator mbbi = MF.begin(), mbbe = MF.end(); mbbi != mbbe; ++mbbi) { for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi->end(); @@ -321,7 +324,14 @@ InstructionRearranged: const TargetRegisterClass* rc = MF.getRegInfo().getRegClass(regA); - TII->copyRegToReg(*mbbi, mi, regA, regB, rc, rc); + MachineInstr *Orig = MRI->getVRegDef(regB); + + if (Orig && TII->isTriviallyReMaterializable(Orig)) { + TII->reMaterialize(*mbbi, mi, regA, Orig); + ReMattedInstrs.insert(Orig); + } else { + TII->copyRegToReg(*mbbi, mi, regA, regB, rc, rc); + } MachineBasicBlock::iterator prevMi = prior(mi); DOUT << "\t\tprepend:\t"; DEBUG(prevMi->print(*cerr.stream(), &TM)); @@ -357,5 +367,34 @@ } } + SmallPtrSet::iterator I = ReMattedInstrs.begin(); + SmallPtrSet::iterator E = ReMattedInstrs.end(); + + for (; I != E; ++I) { + MachineInstr *MI = *I; + bool InstrDead = true; + + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI->getOperand(i); + if (!MO.isRegister()) + continue; + unsigned MOReg = MO.getReg(); + if (!MOReg) + continue; + if (MO.isDef()) { + if (MO.isImplicit()) + continue; + + if (MRI->use_begin(MOReg) != MRI->use_end()) { + InstrDead = false; + break; + } + } + } + + if (InstrDead && MI->getNumOperands() > 0) + MI->eraseFromParent(); + } + return MadeChange; } From isanbard at gmail.com Mon May 26 00:49:49 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 26 May 2008 05:49:49 -0000 Subject: [llvm-commits] [llvm] r51563 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200805260549.m4Q5nnLH017092@zion.cs.uiuc.edu> Author: void Date: Mon May 26 00:49:49 2008 New Revision: 51563 URL: http://llvm.org/viewvc/llvm-project?rev=51563&view=rev Log: The enabling of remat in 2-address conversion breaks this test: Running /Users/void/llvm/llvm.src/test/CodeGen/X86/dg.exp ... FAIL: /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll Failed with exit(1) at line 1 while running: llvm-as < /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll | llc -march=x86 -mattr=+sse2 -stats |& grep {1 .*folded into instructions} child process exited abnormally Make this conditional for now. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51563&r1=51562&r2=51563&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon May 26 00:49:49 2008 @@ -37,6 +37,7 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/SmallPtrSet.h" @@ -49,6 +50,10 @@ STATISTIC(NumConvertedTo3Addr, "Number of instructions promoted to 3-address"); STATISTIC(Num3AddrSunk, "Number of 3-address instructions sunk"); +static cl::opt +EnableReMat("2-addr-remat", cl::init(false), cl::Hidden, + cl::desc("Two-addr conversion should remat when possible.")); + namespace { class VISIBILITY_HIDDEN TwoAddressInstructionPass : public MachineFunctionPass { @@ -326,7 +331,7 @@ const TargetRegisterClass* rc = MF.getRegInfo().getRegClass(regA); MachineInstr *Orig = MRI->getVRegDef(regB); - if (Orig && TII->isTriviallyReMaterializable(Orig)) { + if (EnableReMat && Orig && TII->isTriviallyReMaterializable(Orig)) { TII->reMaterialize(*mbbi, mi, regA, Orig); ReMattedInstrs.insert(Orig); } else { @@ -367,33 +372,35 @@ } } - SmallPtrSet::iterator I = ReMattedInstrs.begin(); - SmallPtrSet::iterator E = ReMattedInstrs.end(); - - for (; I != E; ++I) { - MachineInstr *MI = *I; - bool InstrDead = true; - - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister()) - continue; - unsigned MOReg = MO.getReg(); - if (!MOReg) - continue; - if (MO.isDef()) { - if (MO.isImplicit()) + if (EnableReMat) { + SmallPtrSet::iterator I = ReMattedInstrs.begin(); + SmallPtrSet::iterator E = ReMattedInstrs.end(); + + for (; I != E; ++I) { + MachineInstr *MI = *I; + bool InstrDead = true; + + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI->getOperand(i); + if (!MO.isRegister()) continue; - - if (MRI->use_begin(MOReg) != MRI->use_end()) { - InstrDead = false; - break; + unsigned MOReg = MO.getReg(); + if (!MOReg) + continue; + if (MO.isDef()) { + if (MO.isImplicit()) + continue; + + if (MRI->use_begin(MOReg) != MRI->use_end()) { + InstrDead = false; + break; + } } } - } - if (InstrDead && MI->getNumOperands() > 0) - MI->eraseFromParent(); + if (InstrDead && MI->getNumOperands() > 0) + MI->eraseFromParent(); + } } return MadeChange; From isanbard at gmail.com Mon May 26 00:51:07 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 26 May 2008 05:51:07 -0000 Subject: [llvm-commits] [test-suite] r51564 - in /test-suite/trunk: Makefile.programs SingleSource/Benchmarks/BenchmarkGame/n-body.c Message-ID: <200805260551.m4Q5p8eS017142@zion.cs.uiuc.edu> Author: void Date: Mon May 26 00:51:07 2008 New Revision: 51564 URL: http://llvm.org/viewvc/llvm-project?rev=51564&view=rev Log: Enable remat in 2-address conversion. Modified: test-suite/trunk/Makefile.programs test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/n-body.c Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=51564&r1=51563&r2=51564&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Mon May 26 00:51:07 2008 @@ -205,7 +205,8 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := -enable-sinking +LLCBETAOPTION := -2-addr-remat +#-enable-sinking #-machine-licm #-coalescer-commute-instrs #--enable-tail-merge @@ -220,7 +221,8 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -schedule-livein-copies +LLCBETAOPTION := -2-addr-remat +#-schedule-livein-copies #-align-loops=false #-enable-sinking #-coalescer-commute-instrs Modified: test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/n-body.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/n-body.c?rev=51564&r1=51563&r2=51564&view=diff ============================================================================== --- test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/n-body.c (original) +++ test-suite/trunk/SingleSource/Benchmarks/BenchmarkGame/n-body.c Mon May 26 00:51:07 2008 @@ -138,4 +138,4 @@ advance(NBODIES, bodies, 0.01); printf ("%.9f\n", energy(NBODIES, bodies)); return 0; -} \ No newline at end of file +} From resistor at mac.com Mon May 26 05:07:44 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 26 May 2008 10:07:44 -0000 Subject: [llvm-commits] [llvm] r51565 - /llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Message-ID: <200805261007.m4QA7ji2000600@zion.cs.uiuc.edu> Author: resistor Date: Mon May 26 05:07:43 2008 New Revision: 51565 URL: http://llvm.org/viewvc/llvm-project?rev=51565&view=rev Log: Use a DenseMap instead of an std::map, speeding up the testcase in PR2368 by about a third. Modified: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Modified: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LCSSA.cpp?rev=51565&r1=51564&r2=51565&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LCSSA.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Mon May 26 05:07:43 2008 @@ -87,7 +87,7 @@ SetVector &AffectedValues); Value *GetValueForBlock(DomTreeNode *BB, Instruction *OrigInst, - std::map &Phis); + DenseMap &Phis); /// inLoop - returns true if the given block is within the current loop bool inLoop(BasicBlock* B) { @@ -143,7 +143,7 @@ ++NumLCSSA; // We are applying the transformation // Keep track of the blocks that have the value available already. - std::map Phis; + DenseMap Phis; DomTreeNode *InstrNode = DT->getNode(Instr->getParent()); @@ -247,7 +247,7 @@ /// GetValueForBlock - Get the value to use within the specified basic block. /// available values are in Phis. Value *LCSSA::GetValueForBlock(DomTreeNode *BB, Instruction *OrigInst, - std::map &Phis) { + DenseMap &Phis) { // If there is no dominator info for this BB, it is unreachable. if (BB == 0) return UndefValue::get(OrigInst->getType()); From baldrick at free.fr Mon May 26 14:59:00 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 26 May 2008 19:59:00 -0000 Subject: [llvm-commits] [llvm] r51567 - in /llvm/trunk: include/llvm/Function.h include/llvm/GlobalValue.h include/llvm/GlobalVariable.h lib/Linker/LinkModules.cpp lib/Transforms/IPO/ArgumentPromotion.cpp lib/Transforms/IPO/DeadArgumentElimination.cpp lib/Transforms/IPO/ExtractGV.cpp lib/Transforms/IPO/StructRetPromotion.cpp lib/Transforms/Utils/CloneFunction.cpp lib/Transforms/Utils/CloneModule.cpp lib/VMCore/Function.cpp lib/VMCore/Globals.cpp Message-ID: <200805261959.m4QJx0qg017392@zion.cs.uiuc.edu> Author: baldrick Date: Mon May 26 14:58:59 2008 New Revision: 51567 URL: http://llvm.org/viewvc/llvm-project?rev=51567&view=rev Log: Factor code to copy global value attributes like the section or the visibility from one global value to another: copyAttributesFrom. This is particularly useful for duplicating functions: previously this was done by explicitly copying each attribute in turn at each place where a new function was created out of an old one, with the result that obscure attributes were regularly forgotten (like the collector or the section). Hopefully now everything is uniform and nothing is forgotten. Modified: llvm/trunk/include/llvm/Function.h llvm/trunk/include/llvm/GlobalValue.h llvm/trunk/include/llvm/GlobalVariable.h llvm/trunk/lib/Linker/LinkModules.cpp llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp llvm/trunk/lib/Transforms/Utils/CloneModule.cpp llvm/trunk/lib/VMCore/Function.cpp llvm/trunk/lib/VMCore/Globals.cpp Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Mon May 26 14:58:59 2008 @@ -204,6 +204,10 @@ return paramHasAttr(1, ParamAttr::StructRet); } + /// copyAttributesFrom - copy all additional attributes (those not needed to + /// create a Function) from the Function Src to this one. + void copyAttributesFrom(const GlobalValue *Src); + /// deleteBody - This method deletes the body of the function, and converts /// the linkage to external. /// Modified: llvm/trunk/include/llvm/GlobalValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalValue.h (original) +++ llvm/trunk/include/llvm/GlobalValue.h Mon May 26 14:58:59 2008 @@ -110,6 +110,10 @@ void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } + /// copyAttributesFrom - copy all additional attributes (those not needed to + /// create a GlobalValue) from the GlobalValue Src to this one. + virtual void copyAttributesFrom(const GlobalValue *Src); + /// hasNotBeenReadFromBitcode - If a module provider is being used to lazily /// stream in functions from disk, this method can be used to check to see if /// the function has been read in yet or not. Unless you are working on the Modified: llvm/trunk/include/llvm/GlobalVariable.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalVariable.h?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalVariable.h (original) +++ llvm/trunk/include/llvm/GlobalVariable.h Mon May 26 14:58:59 2008 @@ -118,6 +118,10 @@ bool isThreadLocal() const { return isThreadLocalSymbol; } void setThreadLocal(bool Val) { isThreadLocalSymbol = Val; } + /// copyAttributesFrom - copy all additional attributes (those not needed to + /// create a GlobalVariable) from the GlobalVariable Src to this one. + void copyAttributesFrom(const GlobalValue *Src); + /// removeFromParent - This method unlinks 'this' from the containing module, /// but does not delete it. /// Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Mon May 26 14:58:59 2008 @@ -351,20 +351,10 @@ /// CopyGVAttributes - copy additional attributes (those not needed to construct /// a GlobalValue) from the SrcGV to the DestGV. static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) { - // Propagate alignment, visibility and section info. - DestGV->setAlignment(std::max(DestGV->getAlignment(), SrcGV->getAlignment())); - DestGV->setSection(SrcGV->getSection()); - DestGV->setVisibility(SrcGV->getVisibility()); - if (const Function *SrcF = dyn_cast(SrcGV)) { - Function *DestF = cast(DestGV); - DestF->setCallingConv(SrcF->getCallingConv()); - DestF->setParamAttrs(SrcF->getParamAttrs()); - if (SrcF->hasCollector()) - DestF->setCollector(SrcF->getCollector()); - } else if (const GlobalVariable *SrcVar = dyn_cast(SrcGV)) { - GlobalVariable *DestVar = cast(DestGV); - DestVar->setThreadLocal(SrcVar->isThreadLocal()); - } + // Use the maximum alignment, rather than just copying the alignment of SrcGV. + unsigned Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment()); + DestGV->copyAttributesFrom(SrcGV); + DestGV->setAlignment(Alignment); } /// GetLinkageResult - This analyzes the two global values and determines what Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Mon May 26 14:58:59 2008 @@ -478,15 +478,13 @@ // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName()); - NF->setCallingConv(F->getCallingConv()); + NF->copyAttributesFrom(F); // Recompute the parameter attributes list based on the new arguments for // the function. NF->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end())); ParamAttrsVec.clear(); - - if (F->hasCollector()) - NF->setCollector(F->getCollector()); + F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon May 26 14:58:59 2008 @@ -163,10 +163,7 @@ // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, Fn.getLinkage()); - NF->setCallingConv(Fn.getCallingConv()); - NF->setParamAttrs(Fn.getParamAttrs()); - if (Fn.hasCollector()) - NF->setCollector(Fn.getCollector()); + NF->copyAttributesFrom(&Fn); Fn.getParent()->getFunctionList().insert(&Fn, NF); NF->takeName(&Fn); @@ -556,10 +553,8 @@ // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, F->getLinkage()); - NF->setCallingConv(F->getCallingConv()); + NF->copyAttributesFrom(F); NF->setParamAttrs(NewPAL); - if (F->hasCollector()) - NF->setCollector(F->getCollector()); F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Mon May 26 14:58:59 2008 @@ -123,10 +123,7 @@ if (std::find(Named.begin(), Named.end(), &*I) == Named.end()) { Function *New = Function::Create(I->getFunctionType(), GlobalValue::ExternalLinkage); - New->setCallingConv(I->getCallingConv()); - New->setParamAttrs(I->getParamAttrs()); - if (I->hasCollector()) - New->setCollector(I->getCollector()); + New->copyAttributesFrom(I); // If it's not the named function, delete the body of the function I->dropAllReferences(); Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Mon May 26 14:58:59 2008 @@ -232,7 +232,7 @@ FunctionType *NFTy = FunctionType::get(STy, Params, FTy->isVarArg()); Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName()); - NF->setCallingConv(F->getCallingConv()); + NF->copyAttributesFrom(F); NF->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end())); F->getParent()->getFunctionList().insert(F, NF); NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Mon May 26 14:58:59 2008 @@ -80,11 +80,8 @@ assert(ValueMap.count(I) && "No mapping from source argument specified!"); #endif - // Clone the parameter attributes - NewFunc->setParamAttrs(OldFunc->getParamAttrs()); - - // Clone the calling convention - NewFunc->setCallingConv(OldFunc->getCallingConv()); + // Clone any attributes. + NewFunc->copyAttributesFrom(OldFunc); // Loop over all of the basic blocks in the function, cloning them as // appropriate. Note that we save BE this way in order to handle cloning of @@ -339,8 +336,8 @@ E = OldFunc->arg_end(); II != E; ++II) assert(ValueMap.count(II) && "No mapping from source argument specified!"); #endif - - PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns, + + PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns, NameSuffix, CodeInfo, TD); // Clone the entry block, and anything recursively reachable from it. Modified: llvm/trunk/lib/Transforms/Utils/CloneModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneModule.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneModule.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneModule.cpp Mon May 26 14:58:59 2008 @@ -65,10 +65,7 @@ Function *NF = Function::Create(cast(I->getType()->getElementType()), GlobalValue::ExternalLinkage, I->getName(), New); - NF->setCallingConv(I->getCallingConv()); - NF->setParamAttrs(I->getParamAttrs()); - if (I->hasCollector()) - NF->setCollector(I->getCollector()); + NF->copyAttributesFrom(I); ValueMap[I]= NF; } Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Mon May 26 14:58:59 2008 @@ -284,6 +284,18 @@ } } +/// copyAttributesFrom - copy all additional attributes (those not needed to +/// create a Function) from the Function Src to this one. +void Function::copyAttributesFrom(const GlobalValue *Src) { + assert(isa(Src) && "Expected a Function!"); + GlobalValue::copyAttributesFrom(Src); + const Function *SrcF = cast(Src); + setCallingConv(SrcF->getCallingConv()); + setParamAttrs(SrcF->getParamAttrs()); + if (SrcF->hasCollector()) + setCollector(SrcF->getCollector()); +} + /// getIntrinsicID - This method returns the ID number of the specified /// function, or Intrinsic::not_intrinsic if the function is not an /// intrinsic, or if the pointer is null. This value is always defined to be Modified: llvm/trunk/lib/VMCore/Globals.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=51567&r1=51566&r2=51567&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Globals.cpp (original) +++ llvm/trunk/lib/VMCore/Globals.cpp Mon May 26 14:58:59 2008 @@ -79,7 +79,16 @@ assert(0 && "You can't GV->destroyConstant()!"); abort(); } - + +/// copyAttributesFrom - copy all additional attributes (those not needed to +/// create a GlobalValue) from the GlobalValue Src to this one. +void GlobalValue::copyAttributesFrom(const GlobalValue *Src) { + setAlignment(Src->getAlignment()); + setSection(Src->getSection()); + setVisibility(Src->getVisibility()); +} + + //===----------------------------------------------------------------------===// // GlobalVariable Implementation //===----------------------------------------------------------------------===// @@ -160,6 +169,16 @@ this->setOperand(0, cast(To)); } +/// copyAttributesFrom - copy all additional attributes (those not needed to +/// create a GlobalVariable) from the GlobalVariable Src to this one. +void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) { + assert(isa(Src) && "Expected a GlobalVariable!"); + GlobalValue::copyAttributesFrom(Src); + const GlobalVariable *SrcVar = cast(Src); + setThreadLocal(SrcVar->isThreadLocal()); +} + + //===----------------------------------------------------------------------===// // GlobalAlias Implementation //===----------------------------------------------------------------------===// From nicholas at mxc.ca Mon May 26 15:18:56 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 26 May 2008 20:18:56 -0000 Subject: [llvm-commits] [llvm] r51568 - in /llvm/trunk/test/CodeGen/X86: memcpy-2.ll memset.ll pmul.ll vec_shuffle-18.ll Message-ID: <200805262018.m4QKIvd3018123@zion.cs.uiuc.edu> Author: nicholas Date: Mon May 26 15:18:56 2008 New Revision: 51568 URL: http://llvm.org/viewvc/llvm-project?rev=51568&view=rev Log: The Linux ABI emits an extra "movl %esp, %ebp" in function prologue and sometimes a "mov %ebp, %esp" in the epilogue. Force these tests that rely on counting 'mov' to use i686-apple-darwin8.8.0 where they were written. Modified: llvm/trunk/test/CodeGen/X86/memcpy-2.ll llvm/trunk/test/CodeGen/X86/memset.ll llvm/trunk/test/CodeGen/X86/pmul.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-18.ll Modified: llvm/trunk/test/CodeGen/X86/memcpy-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/memcpy-2.ll?rev=51568&r1=51567&r2=51568&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/memcpy-2.ll (original) +++ llvm/trunk/test/CodeGen/X86/memcpy-2.ll Mon May 26 15:18:56 2008 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse | grep mov | count 7 -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse | grep mov | count 5 +; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse -mtriple=i686-apple-darwin8.8.0 | grep mov | count 7 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse -mtriple=i686-apple-darwin8.8.0 | grep mov | count 5 %struct.ParmT = type { [25 x i8], i8, i8* } @.str12 = internal constant [25 x i8] c"image\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" ; <[25 x i8]*> [#uses=1] Modified: llvm/trunk/test/CodeGen/X86/memset.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/memset.ll?rev=51568&r1=51567&r2=51568&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/memset.ll (original) +++ llvm/trunk/test/CodeGen/X86/memset.ll Mon May 26 15:18:56 2008 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse | grep mov | count 9 -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse | grep mov | count 3 +; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse -mtriple=i686-apple-darwin8.8.0 | grep mov | count 9 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse -mtriple=i686-apple-darwin8.8.0 | grep mov | count 3 %struct.x = type { i16, i16 } Modified: llvm/trunk/test/CodeGen/X86/pmul.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pmul.ll?rev=51568&r1=51567&r2=51568&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pmul.ll (original) +++ llvm/trunk/test/CodeGen/X86/pmul.ll Mon May 26 15:18:56 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 > %t +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -mtriple=i686-apple-darwin8.8.0 > %t ; RUN: grep pmul %t | count 6 ; RUN: grep mov %t | count 8 Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-18.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-18.ll?rev=51568&r1=51567&r2=51568&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-18.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-18.ll Mon May 26 15:18:56 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep mov | count 7 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -mtriple=i686-apple-darwin8.8.0 | grep mov | count 7 %struct.vector4_t = type { <4 x float> } From nicholas at mxc.ca Mon May 26 15:23:33 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 26 May 2008 20:23:33 -0000 Subject: [llvm-commits] [llvm] r51569 - /llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll Message-ID: <200805262023.m4QKNXwr018277@zion.cs.uiuc.edu> Author: nicholas Date: Mon May 26 15:23:33 2008 New Revision: 51569 URL: http://llvm.org/viewvc/llvm-project?rev=51569&view=rev Log: Whoops -- forgot PR reference on this test. Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll?rev=51569&r1=51568&r2=51569&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll Mon May 26 15:23:33 2008 @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {61 iterations} +; PR2364 define i32 @func_6() nounwind { entry: From ggreif at gmail.com Mon May 26 16:33:52 2008 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 26 May 2008 21:33:52 -0000 Subject: [llvm-commits] [llvm] r51570 - in /llvm/trunk: include/llvm/Instructions.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Reader/BitcodeReader.h lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp Message-ID: <200805262133.m4QLXrTU020197@zion.cs.uiuc.edu> Author: ggreif Date: Mon May 26 16:33:52 2008 New Revision: 51570 URL: http://llvm.org/viewvc/llvm-project?rev=51570&view=rev Log: eliminate calls to deprecated Use::init() interface Modified: llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Globals.cpp llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=51570&r1=51569&r2=51570&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Mon May 26 16:33:52 2008 @@ -291,8 +291,8 @@ StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store, &Op<0>(), 2) { - Op<0>().init(SI.Op<0>(), this); - Op<1>().init(SI.Op<1>(), this); + Op<0>() = SI.Op<0>(); + Op<1>() = SI.Op<1>(); setVolatile(SI.isVolatile()); setAlignment(SI.getAlignment()); @@ -1337,8 +1337,8 @@ class ExtractElementInst : public Instruction { ExtractElementInst(const ExtractElementInst &EE) : Instruction(EE.getType(), ExtractElement, &Op<0>(), 2) { - Op<0>().init(EE.Op<0>(), this); - Op<1>().init(EE.Op<1>(), this); + Op<0>() = EE.Op<0>(); + Op<1>() = EE.Op<1>(); } public: @@ -2010,8 +2010,8 @@ resizeOperands(0); // Get more space! // Initialize some new operands. NumOperands = OpNo+2; - OperandList[OpNo].init(V, this); - OperandList[OpNo+1].init(BB, this); + OperandList[OpNo] = V; + OperandList[OpNo+1] = BB; } /// removeIncomingValue - Remove an incoming value. This is useful if a Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=51570&r1=51569&r2=51570&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon May 26 16:33:52 2008 @@ -180,7 +180,7 @@ // Create and return a placeholder, which will later be RAUW'd. Constant *C = new ConstantPlaceHolder(Ty); - OperandList[Idx].init(C, this); + OperandList[Idx] = C; return C; } @@ -201,7 +201,7 @@ // Create and return a placeholder, which will later be RAUW'd. Value *V = new Argument(Ty); - OperandList[Idx].init(V, this); + OperandList[Idx] = V; return V; } Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=51570&r1=51569&r2=51570&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Mon May 26 16:33:52 2008 @@ -89,7 +89,7 @@ resize(Idx * 2 + 1); } assert(getOperand(Idx) == 0 && "Cannot init an already init'd Use!"); - OperandList[Idx].init(V, this); + OperandList[Idx] = V; } }; Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=51570&r1=51569&r2=51570&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon May 26 16:33:52 2008 @@ -367,7 +367,7 @@ (T->isAbstract() && C->getType()->getTypeID() == T->getElementType()->getTypeID())) && "Initializer for array element doesn't match array element type!"); - OL->init(C, this); + *OL = C; } } @@ -389,7 +389,7 @@ T->getElementType(I-V.begin())->getTypeID() == C->getType()->getTypeID())) && "Initializer for struct element doesn't match struct element type!"); - OL->init(C, this); + *OL = C; } } @@ -407,7 +407,7 @@ (T->isAbstract() && C->getType()->getTypeID() == T->getElementType()->getTypeID())) && "Initializer for vector element doesn't match vector element type!"); - OL->init(C, this); + *OL = C; } } @@ -445,8 +445,8 @@ } BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2) : ConstantExpr(C1->getType(), Opcode, &Op<0>(), 2) { - Op<0>().init(C1, this); - Op<1>().init(C2, this); + Op<0>() = C1; + Op<1>() = C2; } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -463,9 +463,9 @@ } SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3) : ConstantExpr(C2->getType(), Instruction::Select, &Op<0>(), 3) { - Op<0>().init(C1, this); - Op<1>().init(C2, this); - Op<2>().init(C3, this); + Op<0>() = C1; + Op<1>() = C2; + Op<2>() = C3; } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -484,8 +484,8 @@ ExtractElementConstantExpr(Constant *C1, Constant *C2) : ConstantExpr(cast(C1->getType())->getElementType(), Instruction::ExtractElement, &Op<0>(), 2) { - Op<0>().init(C1, this); - Op<1>().init(C2, this); + Op<0>() = C1; + Op<1>() = C2; } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -504,9 +504,9 @@ InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3) : ConstantExpr(C1->getType(), Instruction::InsertElement, &Op<0>(), 3) { - Op<0>().init(C1, this); - Op<1>().init(C2, this); - Op<2>().init(C3, this); + Op<0>() = C1; + Op<1>() = C2; + Op<2>() = C3; } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -525,9 +525,9 @@ ShuffleVectorConstantExpr(Constant *C1, Constant *C2, Constant *C3) : ConstantExpr(C1->getType(), Instruction::ShuffleVector, &Op<0>(), 3) { - Op<0>().init(C1, this); - Op<1>().init(C2, this); - Op<2>().init(C3, this); + Op<0>() = C1; + Op<1>() = C2; + Op<2>() = C3; } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -599,8 +599,8 @@ CompareConstantExpr(const Type *ty, Instruction::OtherOps opc, unsigned short pred, Constant* LHS, Constant* RHS) : ConstantExpr(ty, opc, &Op<0>(), 2), predicate(pred) { - Op<0>().init(LHS, this); - Op<1>().init(RHS, this); + Op<0>() = LHS; + Op<1>() = RHS; } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); @@ -650,9 +650,9 @@ OperandTraits::op_end(this) - (IdxList.size()+1), IdxList.size()+1) { - OperandList[0].init(Agg, this); + OperandList[0] = Agg; for (unsigned i = 0, E = IdxList.size(); i != E; ++i) - OperandList[i+1].init(IdxList[i], this); + OperandList[i+1] = IdxList[i]; } DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractValueConstantExpr, Value) @@ -669,10 +669,10 @@ OperandTraits::op_end(this) - (IdxList.size()+2), IdxList.size()+2) { - OperandList[0].init(Agg, this); - OperandList[1].init(Val, this); + OperandList[0] = Agg; + OperandList[1] = Val; for (unsigned i = 0, E = IdxList.size(); i != E; ++i) - OperandList[i+2].init(IdxList[i], this); + OperandList[i+2] = IdxList[i]; } DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertValueConstantExpr, Value) @@ -690,9 +690,9 @@ OperandTraits::op_end(this) - (IdxList.size()+1), IdxList.size()+1) { - OperandList[0].init(C, this); + OperandList[0] = C; for (unsigned i = 0, E = IdxList.size(); i != E; ++i) - OperandList[i+1].init(IdxList[i], this); + OperandList[i+1] = IdxList[i]; } DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GetElementPtrConstantExpr, Value) Modified: llvm/trunk/lib/VMCore/Globals.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=51570&r1=51569&r2=51570&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Globals.cpp (original) +++ llvm/trunk/lib/VMCore/Globals.cpp Mon May 26 16:33:52 2008 @@ -104,7 +104,7 @@ if (InitVal) { assert(InitVal->getType() == Ty && "Initializer should be the same type as the GlobalVariable!"); - Op<0>().init(InitVal, this); + Op<0>() = InitVal; } LeakDetector::addGarbageObject(this); @@ -124,7 +124,7 @@ if (InitVal) { assert(InitVal->getType() == Ty && "Initializer should be the same type as the GlobalVariable!"); - Op<0>().init(InitVal, this); + Op<0>() = InitVal; } LeakDetector::addGarbageObject(this); @@ -191,7 +191,7 @@ if (aliasee) assert(aliasee->getType() == Ty && "Alias and aliasee types should match!"); - Op<0>().init(aliasee, this); + Op<0>() = aliasee; if (ParentModule) ParentModule->getAliasList().push_back(this); Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=51570&r1=51569&r2=51570&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon May 26 16:33:52 2008 @@ -118,8 +118,8 @@ ReservedSpace(PN.getNumOperands()) { Use *OL = OperandList; for (unsigned i = 0, e = PN.getNumOperands(); i != e; i+=2) { - OL[i].init(PN.getOperand(i), this); - OL[i+1].init(PN.getOperand(i+1), this); + OL[i] = PN.getOperand(i); + OL[i+1] = PN.getOperand(i+1); } } @@ -184,7 +184,7 @@ Use *OldOps = OperandList; Use *NewOps = allocHungoffUses(NumOps); for (unsigned i = 0; i != e; ++i) { - NewOps[i].init(OldOps[i], this); + NewOps[i] = OldOps[i]; } OperandList = NewOps; if (OldOps) Use::zap(OldOps, OldOps + e, true); @@ -249,7 +249,7 @@ void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) { assert(NumOperands == NumParams+1 && "NumOperands not set up?"); Use *OL = OperandList; - OL[0].init(Func, this); + OL[0] = Func; const FunctionType *FTy = cast(cast(Func->getType())->getElementType()); @@ -262,16 +262,16 @@ assert((i >= FTy->getNumParams() || FTy->getParamType(i) == Params[i]->getType()) && "Calling a function with a bad signature!"); - OL[i+1].init(Params[i], this); + OL[i+1] = Params[i]; } } void CallInst::init(Value *Func, Value *Actual1, Value *Actual2) { assert(NumOperands == 3 && "NumOperands not set up?"); Use *OL = OperandList; - OL[0].init(Func, this); - OL[1].init(Actual1, this); - OL[2].init(Actual2, this); + OL[0] = Func; + OL[1] = Actual1; + OL[2] = Actual2; const FunctionType *FTy = cast(cast(Func->getType())->getElementType()); @@ -291,8 +291,8 @@ void CallInst::init(Value *Func, Value *Actual) { assert(NumOperands == 2 && "NumOperands not set up?"); Use *OL = OperandList; - OL[0].init(Func, this); - OL[1].init(Actual, this); + OL[0] = Func; + OL[1] = Actual; const FunctionType *FTy = cast(cast(Func->getType())->getElementType()); @@ -309,7 +309,7 @@ void CallInst::init(Value *Func) { assert(NumOperands == 1 && "NumOperands not set up?"); Use *OL = OperandList; - OL[0].init(Func, this); + OL[0] = Func; const FunctionType *FTy = cast(cast(Func->getType())->getElementType()); @@ -370,7 +370,7 @@ Use *OL = OperandList; Use *InOL = CI.OperandList; for (unsigned i = 0, e = CI.getNumOperands(); i != e; ++i) - OL[i].init(InOL[i], this); + OL[i] = InOL[i]; } void CallInst::addParamAttr(unsigned i, ParameterAttributes attr) { @@ -405,9 +405,9 @@ Value* const *Args, unsigned NumArgs) { assert(NumOperands == 3+NumArgs && "NumOperands not set up?"); Use *OL = OperandList; - OL[0].init(Fn, this); - OL[1].init(IfNormal, this); - OL[2].init(IfException, this); + OL[0] = Fn; + OL[1] = IfNormal; + OL[2] = IfException; const FunctionType *FTy = cast(cast(Fn->getType())->getElementType()); FTy = FTy; // silence warning. @@ -421,7 +421,7 @@ FTy->getParamType(i) == Args[i]->getType()) && "Invoking a function with a bad signature!"); - OL[i+3].init(Args[i], this); + OL[i+3] = Args[i]; } } @@ -434,7 +434,7 @@ SubclassData = II.SubclassData; Use *OL = OperandList, *InOL = II.OperandList; for (unsigned i = 0, e = II.getNumOperands(); i != e; ++i) - OL[i].init(InOL[i], this); + OL[i] = InOL[i]; } BasicBlock *InvokeInst::getSuccessorV(unsigned idx) const { @@ -482,11 +482,11 @@ RI.getNumOperands()) { unsigned N = RI.getNumOperands(); if (N == 1) - Op<0>().init(RI.Op<0>(), this); + Op<0>() = RI.Op<0>(); else if (N) { Use *OL = OperandList; for (unsigned i = 0; i < N; ++i) - OL[i].init(RI.getOperand(i), this); + OL[i] = RI.getOperand(i); } } @@ -535,7 +535,7 @@ Value *V = *retVals; if (V->getType() == Type::VoidTy) return; - Op<0>().init(V, this); + Op<0>() = V; return; } @@ -544,7 +544,7 @@ Value *V = *retVals++; assert(!isa(V) && "Cannot return basic block. Probably using the incorrect ctor"); - OL[i].init(V, this); + OL[i] = V; } } @@ -633,16 +633,16 @@ OperandTraits::op_end(this) - 1, 1, InsertBefore) { assert(IfTrue != 0 && "Branch destination may not be null!"); - Op<0>().init(reinterpret_cast(IfTrue), this); + Op<0>() = reinterpret_cast(IfTrue); } BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore) : TerminatorInst(Type::VoidTy, Instruction::Br, OperandTraits::op_end(this) - 3, 3, InsertBefore) { - Op<0>().init(reinterpret_cast(IfTrue), this); - Op<1>().init(reinterpret_cast(IfFalse), this); - Op<2>().init(Cond, this); + Op<0>() = reinterpret_cast(IfTrue); + Op<1>() = reinterpret_cast(IfFalse); + Op<2>() = Cond; #ifndef NDEBUG AssertOK(); #endif @@ -653,7 +653,7 @@ OperandTraits::op_end(this) - 1, 1, InsertAtEnd) { assert(IfTrue != 0 && "Branch destination may not be null!"); - Op<0>().init(reinterpret_cast(IfTrue), this); + Op<0>() = reinterpret_cast(IfTrue); } BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, @@ -661,9 +661,9 @@ : TerminatorInst(Type::VoidTy, Instruction::Br, OperandTraits::op_end(this) - 3, 3, InsertAtEnd) { - Op<0>().init(reinterpret_cast(IfTrue), this); - Op<1>().init(reinterpret_cast(IfFalse), this); - Op<2>().init(Cond, this); + Op<0>() = reinterpret_cast(IfTrue); + Op<1>() = reinterpret_cast(IfFalse); + Op<2>() = Cond; #ifndef NDEBUG AssertOK(); #endif @@ -674,11 +674,11 @@ TerminatorInst(Type::VoidTy, Instruction::Br, OperandTraits::op_end(this) - BI.getNumOperands(), BI.getNumOperands()) { - OperandList[0].init(BI.getOperand(0), this); + OperandList[0] = BI.getOperand(0); if (BI.getNumOperands() != 1) { assert(BI.getNumOperands() == 3 && "BR can have 1 or 3 operands!"); - OperandList[1].init(BI.getOperand(1), this); - OperandList[2].init(BI.getOperand(2), this); + OperandList[1] = BI.getOperand(1); + OperandList[2] = BI.getOperand(2); } } @@ -909,8 +909,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertBefore) { - Op<0>().init(val, this); - Op<1>().init(addr, this); + Op<0>() = val; + Op<1>() = addr; setVolatile(false); setAlignment(0); AssertOK(); @@ -921,8 +921,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertAtEnd) { - Op<0>().init(val, this); - Op<1>().init(addr, this); + Op<0>() = val; + Op<1>() = addr; setVolatile(false); setAlignment(0); AssertOK(); @@ -934,8 +934,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertBefore) { - Op<0>().init(val, this); - Op<1>().init(addr, this); + Op<0>() = val; + Op<1>() = addr; setVolatile(isVolatile); setAlignment(0); AssertOK(); @@ -947,8 +947,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertBefore) { - Op<0>().init(val, this); - Op<1>().init(addr, this); + Op<0>() = val; + Op<1>() = addr; setVolatile(isVolatile); setAlignment(Align); AssertOK(); @@ -960,8 +960,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertAtEnd) { - Op<0>().init(val, this); - Op<1>().init(addr, this); + Op<0>() = val; + Op<1>() = addr; setVolatile(isVolatile); setAlignment(Align); AssertOK(); @@ -973,8 +973,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertAtEnd) { - Op<0>().init(val, this); - Op<1>().init(addr, this); + Op<0>() = val; + Op<1>() = addr; setVolatile(isVolatile); setAlignment(0); AssertOK(); @@ -996,17 +996,17 @@ void GetElementPtrInst::init(Value *Ptr, Value* const *Idx, unsigned NumIdx) { assert(NumOperands == 1+NumIdx && "NumOperands not initialized?"); Use *OL = OperandList; - OL[0].init(Ptr, this); + OL[0] = Ptr; for (unsigned i = 0; i != NumIdx; ++i) - OL[i+1].init(Idx[i], this); + OL[i+1] = Idx[i]; } void GetElementPtrInst::init(Value *Ptr, Value *Idx) { assert(NumOperands == 2 && "NumOperands not initialized?"); Use *OL = OperandList; - OL[0].init(Ptr, this); - OL[1].init(Idx, this); + OL[0] = Ptr; + OL[1] = Idx; } GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI) @@ -1017,7 +1017,7 @@ Use *OL = OperandList; Use *GEPIOL = GEPI.OperandList; for (unsigned i = 0, E = NumOperands; i != E; ++i) - OL[i].init(GEPIOL[i], this); + OL[i] = GEPIOL[i]; } GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx, @@ -1112,8 +1112,8 @@ 2, InsertBef) { assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); - Op<0>().init(Val, this); - Op<1>().init(Index, this); + Op<0>() = Val; + Op<1>() = Index; setName(Name); } @@ -1127,8 +1127,8 @@ Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV); assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); - Op<0>().init(Val, this); - Op<1>().init(Index, this); + Op<0>() = Val; + Op<1>() = Index; setName(Name); } @@ -1143,8 +1143,8 @@ assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); - Op<0>().init(Val, this); - Op<1>().init(Index, this); + Op<0>() = Val; + Op<1>() = Index; setName(Name); } @@ -1159,8 +1159,8 @@ assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); - Op<0>().init(Val, this); - Op<1>().init(Index, this); + Op<0>() = Val; + Op<1>() = Index; setName(Name); } @@ -1179,9 +1179,9 @@ InsertElementInst::InsertElementInst(const InsertElementInst &IE) : Instruction(IE.getType(), InsertElement, OperandTraits::op_begin(this), 3) { - Op<0>().init(IE.Op<0>(), this); - Op<1>().init(IE.Op<1>(), this); - Op<2>().init(IE.Op<2>(), this); + Op<0>() = IE.Op<0>(); + Op<1>() = IE.Op<1>(); + Op<2>() = IE.Op<2>(); } InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index, const std::string &Name, @@ -1191,9 +1191,9 @@ 3, InsertBef) { assert(isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction operands!"); - Op<0>().init(Vec, this); - Op<1>().init(Elt, this); - Op<2>().init(Index, this); + Op<0>() = Vec; + Op<1>() = Elt; + Op<2>() = Index; setName(Name); } @@ -1206,9 +1206,9 @@ Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV); assert(isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction operands!"); - Op<0>().init(Vec, this); - Op<1>().init(Elt, this); - Op<2>().init(Index, this); + Op<0>() = Vec; + Op<1>() = Elt; + Op<2>() = Index; setName(Name); } @@ -1222,9 +1222,9 @@ assert(isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction operands!"); - Op<0>().init(Vec, this); - Op<1>().init(Elt, this); - Op<2>().init(Index, this); + Op<0>() = Vec; + Op<1>() = Elt; + Op<2>() = Index; setName(Name); } @@ -1238,9 +1238,9 @@ assert(isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction operands!"); - Op<0>().init(Vec, this); - Op<1>().init(Elt, this); - Op<2>().init(Index, this); + Op<0>() = Vec; + Op<1>() = Elt; + Op<2>() = Index; setName(Name); } @@ -1266,9 +1266,9 @@ : Instruction(SV.getType(), ShuffleVector, OperandTraits::op_begin(this), OperandTraits::operands(this)) { - Op<0>().init(SV.Op<0>(), this); - Op<1>().init(SV.Op<1>(), this); - Op<2>().init(SV.Op<2>(), this); + Op<0>() = SV.Op<0>(); + Op<1>() = SV.Op<1>(); + Op<2>() = SV.Op<2>(); } ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, @@ -1280,9 +1280,9 @@ InsertBefore) { assert(isValidOperands(V1, V2, Mask) && "Invalid shuffle vector instruction operands!"); - Op<0>().init(V1, this); - Op<1>().init(V2, this); - Op<2>().init(Mask, this); + Op<0>() = V1; + Op<1>() = V2; + Op<2>() = Mask; setName(Name); } @@ -1296,9 +1296,9 @@ assert(isValidOperands(V1, V2, Mask) && "Invalid shuffle vector instruction operands!"); - Op<0>().init(V1, this); - Op<1>().init(V2, this); - Op<2>().init(Mask, this); + Op<0>() = V1; + Op<1>() = V2; + Op<2>() = Mask; setName(Name); } @@ -1339,19 +1339,19 @@ void InsertValueInst::init(Value *Agg, Value *Val, Value* const *Idx, unsigned NumIdx) { assert(NumOperands == 1+NumIdx && "NumOperands not initialized?"); Use *OL = OperandList; - OL[0].init(Agg, this); - OL[1].init(Val, this); + OL[0] = Agg; + OL[1] = Val; for (unsigned i = 0; i != NumIdx; ++i) - OL[i+2].init(Idx[i], this); + OL[i+2] = Idx[i]; } void InsertValueInst::init(Value *Agg, Value *Val, Value *Idx) { assert(NumOperands == 3 && "NumOperands not initialized?"); Use *OL = OperandList; - OL[0].init(Agg, this); - OL[1].init(Val, this); - OL[2].init(Idx, this); + OL[0] = Agg; + OL[1] = Val; + OL[2] = Idx; } InsertValueInst::InsertValueInst(const InsertValueInst &IVI) @@ -1362,7 +1362,7 @@ Use *OL = OperandList; Use *IVIOL = IVI.OperandList; for (unsigned i = 0, E = NumOperands; i != E; ++i) - OL[i].init(IVIOL[i], this); + OL[i] = IVIOL[i]; } //===----------------------------------------------------------------------===// @@ -1372,17 +1372,17 @@ void ExtractValueInst::init(Value *Agg, Value* const *Idx, unsigned NumIdx) { assert(NumOperands == 1+NumIdx && "NumOperands not initialized?"); Use *OL = OperandList; - OL[0].init(Agg, this); + OL[0] = Agg; for (unsigned i = 0; i != NumIdx; ++i) - OL[i+1].init(Idx[i], this); + OL[i+1] = Idx[i]; } void ExtractValueInst::init(Value *Agg, Value *Idx) { assert(NumOperands == 2 && "NumOperands not initialized?"); Use *OL = OperandList; - OL[0].init(Agg, this); - OL[1].init(Idx, this); + OL[0] = Agg; + OL[1] = Idx; } ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI) @@ -1393,7 +1393,7 @@ Use *OL = OperandList; Use *EVIOL = EVI.OperandList; for (unsigned i = 0, E = NumOperands; i != E; ++i) - OL[i].init(EVIOL[i], this); + OL[i] = EVIOL[i]; } // getIndexedType - Returns the type of the element that would be extracted @@ -1434,8 +1434,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertBefore) { - Op<0>().init(S1, this); - Op<1>().init(S2, this); + Op<0>() = S1; + Op<1>() = S2; init(iType); setName(Name); } @@ -1447,8 +1447,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertAtEnd) { - Op<0>().init(S1, this); - Op<1>().init(S2, this); + Op<0>() = S1; + Op<1>() = S2; init(iType); setName(Name); } @@ -2419,8 +2419,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertBefore) { - Op<0>().init(LHS, this); - Op<1>().init(RHS, this); + Op<0>() = LHS; + Op<1>() = RHS; SubclassData = predicate; setName(Name); } @@ -2432,8 +2432,8 @@ OperandTraits::op_begin(this), OperandTraits::operands(this), InsertAtEnd) { - Op<0>().init(LHS, this); - Op<1>().init(RHS, this); + Op<0>() = LHS; + Op<1>() = RHS; SubclassData = predicate; setName(Name); } @@ -2687,8 +2687,8 @@ NumOperands = 2; OperandList = allocHungoffUses(ReservedSpace); - OperandList[0].init(Value, this); - OperandList[1].init(Default, this); + OperandList[0] = Value; + OperandList[1] = Default; } /// SwitchInst ctor - Create a new switch instruction, specifying a value to @@ -2716,8 +2716,8 @@ allocHungoffUses(SI.getNumOperands()), SI.getNumOperands()) { Use *OL = OperandList, *InOL = SI.OperandList; for (unsigned i = 0, E = SI.getNumOperands(); i != E; i+=2) { - OL[i].init(InOL[i], this); - OL[i+1].init(InOL[i+1], this); + OL[i] = InOL[i]; + OL[i+1] = InOL[i+1]; } } @@ -2735,8 +2735,8 @@ // Initialize some new operands. assert(OpNo+1 < ReservedSpace && "Growing didn't work!"); NumOperands = OpNo+2; - OperandList[OpNo].init(OnVal, this); - OperandList[OpNo+1].init(Dest, this); + OperandList[OpNo] = OnVal; + OperandList[OpNo+1] = Dest; } /// removeCase - This method removes the specified successor from the switch @@ -2790,7 +2790,7 @@ Use *NewOps = allocHungoffUses(NumOps); Use *OldOps = OperandList; for (unsigned i = 0; i != e; ++i) { - NewOps[i].init(OldOps[i], this); + NewOps[i] = OldOps[i]; } OperandList = NewOps; if (OldOps) Use::zap(OldOps, OldOps + e, true); From isanbard at gmail.com Mon May 26 17:22:42 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 26 May 2008 22:22:42 -0000 Subject: [llvm-commits] [test-suite] r51571 - /test-suite/trunk/Makefile.programs Message-ID: <200805262222.m4QMMhdI021484@zion.cs.uiuc.edu> Author: void Date: Mon May 26 17:22:42 2008 New Revision: 51571 URL: http://llvm.org/viewvc/llvm-project?rev=51571&view=rev Log: Finished testing 2-addr remat. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=51571&r1=51570&r2=51571&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Mon May 26 17:22:42 2008 @@ -205,8 +205,7 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := -2-addr-remat -#-enable-sinking +LLCBETAOPTION := -enable-sinking #-machine-licm #-coalescer-commute-instrs #--enable-tail-merge @@ -221,8 +220,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -2-addr-remat -#-schedule-livein-copies +LLCBETAOPTION := -schedule-livein-copies #-align-loops=false #-enable-sinking #-coalescer-commute-instrs From nicholas at mxc.ca Mon May 26 17:49:36 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 26 May 2008 22:49:36 -0000 Subject: [llvm-commits] [llvm] r51572 - /llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200805262249.m4QMnaYp022254@zion.cs.uiuc.edu> Author: nicholas Date: Mon May 26 17:49:36 2008 New Revision: 51572 URL: http://llvm.org/viewvc/llvm-project?rev=51572&view=rev Log: Grammaro. Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=51572&r1=51571&r2=51572&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon May 26 17:49:36 2008 @@ -1509,7 +1509,7 @@ } // We'd like to allow makeEqual on two values to perform a simple - // substitution without every creating nodes in the IG whenever possible. + // substitution without creating nodes in the IG whenever possible. // // The first iteration through this loop operates on V2 before going // through the Remove list and operating on those too. If all of the From nicholas at mxc.ca Mon May 26 19:59:06 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 27 May 2008 00:59:06 -0000 Subject: [llvm-commits] [llvm] r51573 - /llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200805270059.m4R0x6nD025692@zion.cs.uiuc.edu> Author: nicholas Date: Mon May 26 19:59:05 2008 New Revision: 51573 URL: http://llvm.org/viewvc/llvm-project?rev=51573&view=rev Log: InequalityGraph::node() can create new nodes, invalidating iterators across the set of nodes. Fix makeEqual to handle this by creating the new node first then iterating across them second. Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=51573&r1=51572&r2=51573&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon May 26 19:59:05 2008 @@ -1594,6 +1594,7 @@ if (mergeIGNode) { // Create N1. if (!n1) n1 = VN.getOrInsertVN(V1, Top); + IG.node(n1); // Ensure that IG.Nodes won't get resized // Migrate relationships from removed nodes to N1. for (SetVector::iterator I = Remove.begin(), E = Remove.end(); From resistor at mac.com Mon May 26 23:27:27 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 27 May 2008 04:27:27 -0000 Subject: [llvm-commits] [llvm] r51581 - /llvm/trunk/tools/opt/opt.cpp Message-ID: <200805270427.m4R4RRMg031288@zion.cs.uiuc.edu> Author: resistor Date: Mon May 26 23:27:27 2008 New Revision: 51581 URL: http://llvm.org/viewvc/llvm-project?rev=51581&view=rev Log: Remove ADCE from the optimization pipeline. Modified: llvm/trunk/tools/opt/opt.cpp Modified: llvm/trunk/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=51581&r1=51580&r2=51581&view=diff ============================================================================== --- llvm/trunk/tools/opt/opt.cpp (original) +++ llvm/trunk/tools/opt/opt.cpp Mon May 26 23:27:27 2008 @@ -296,7 +296,7 @@ addPass(PM, createCondPropagationPass()); // Propagate conditionals addPass(PM, createDeadStoreEliminationPass()); // Delete dead stores - addPass(PM, createAggressiveDCEPass()); // SSA based 'Aggressive DCE' + addPass(PM, createDeadCodeEliminationPass()); // Delete dead instructions addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs addPass(PM, createStripDeadPrototypesPass()); // Get rid of dead prototypes addPass(PM, createDeadTypeEliminationPass()); // Eliminate dead types From resistor at mac.com Mon May 26 23:32:14 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 27 May 2008 04:32:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51582 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200805270432.m4R4WE0a031445@zion.cs.uiuc.edu> Author: resistor Date: Mon May 26 23:32:14 2008 New Revision: 51582 URL: http://llvm.org/viewvc/llvm-project?rev=51582&view=rev Log: Remove ADCE from the optimization pipeline. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=51582&r1=51581&r2=51582&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon May 26 23:32:14 2008 @@ -388,7 +388,7 @@ PM->add(createInstructionCombiningPass()); PM->add(createCondPropagationPass()); // Propagate conditionals PM->add(createDeadStoreEliminationPass()); // Delete dead stores - PM->add(createAggressiveDCEPass()); // SSA based 'Aggressive DCE' + PM->add(createDeadCodeEliminationPass()); // Delete dead instructions PM->add(createCFGSimplificationPass()); // Merge & remove BBs if (flag_unit_at_a_time) { From clattner at apple.com Mon May 26 23:42:33 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 26 May 2008 21:42:33 -0700 Subject: [llvm-commits] [llvm] r51581 - /llvm/trunk/tools/opt/opt.cpp In-Reply-To: <200805270427.m4R4RRMg031288@zion.cs.uiuc.edu> References: <200805270427.m4R4RRMg031288@zion.cs.uiuc.edu> Message-ID: <6036A346-1416-4F3D-AF39-E81C5DEBD0A9@apple.com> Cool! Does this speed up llvmgcc measurably? -Chris On May 26, 2008, at 9:27 PM, Owen Anderson wrote: > Author: resistor > Date: Mon May 26 23:27:27 2008 > New Revision: 51581 > > URL: http://llvm.org/viewvc/llvm-project?rev=51581&view=rev > Log: > Remove ADCE from the optimization pipeline. > > Modified: > llvm/trunk/tools/opt/opt.cpp > > Modified: llvm/trunk/tools/opt/opt.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=51581&r1=51580&r2=51581&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/tools/opt/opt.cpp (original) > +++ llvm/trunk/tools/opt/opt.cpp Mon May 26 23:27:27 2008 > @@ -296,7 +296,7 @@ > addPass(PM, createCondPropagationPass()); // Propagate > conditionals > > addPass(PM, createDeadStoreEliminationPass()); // Delete dead stores > - addPass(PM, createAggressiveDCEPass()); // SSA based > 'Aggressive DCE' > + addPass(PM, createDeadCodeEliminationPass()); // > Delete dead instructions > addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs > addPass(PM, createStripDeadPrototypesPass()); // Get rid of dead > prototypes > addPass(PM, createDeadTypeEliminationPass()); // Eliminate dead > types > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From ggreif at gmail.com Tue May 27 05:48:45 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 27 May 2008 10:48:45 -0000 Subject: [llvm-commits] [llvm] r51588 - /llvm/trunk/lib/VMCore/Instructions.cpp Message-ID: <200805271048.m4RAmkM8019250@zion.cs.uiuc.edu> Author: ggreif Date: Tue May 27 05:48:39 2008 New Revision: 51588 URL: http://llvm.org/viewvc/llvm-project?rev=51588&view=rev Log: We have the correct headers included to know that BB isa Value. No reinterpret_cast necessary. Modified: llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=51588&r1=51587&r2=51588&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Tue May 27 05:48:39 2008 @@ -633,15 +633,15 @@ OperandTraits::op_end(this) - 1, 1, InsertBefore) { assert(IfTrue != 0 && "Branch destination may not be null!"); - Op<0>() = reinterpret_cast(IfTrue); + Op<0>() = IfTrue; } BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore) : TerminatorInst(Type::VoidTy, Instruction::Br, OperandTraits::op_end(this) - 3, 3, InsertBefore) { - Op<0>() = reinterpret_cast(IfTrue); - Op<1>() = reinterpret_cast(IfFalse); + Op<0>() = IfTrue; + Op<1>() = IfFalse; Op<2>() = Cond; #ifndef NDEBUG AssertOK(); @@ -653,7 +653,7 @@ OperandTraits::op_end(this) - 1, 1, InsertAtEnd) { assert(IfTrue != 0 && "Branch destination may not be null!"); - Op<0>() = reinterpret_cast(IfTrue); + Op<0>() = IfTrue; } BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, @@ -661,8 +661,8 @@ : TerminatorInst(Type::VoidTy, Instruction::Br, OperandTraits::op_end(this) - 3, 3, InsertAtEnd) { - Op<0>() = reinterpret_cast(IfTrue); - Op<1>() = reinterpret_cast(IfFalse); + Op<0>() = IfTrue; + Op<1>() = IfFalse; Op<2>() = Cond; #ifndef NDEBUG AssertOK(); From ggreif at gmail.com Tue May 27 06:03:38 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 27 May 2008 11:03:38 -0000 Subject: [llvm-commits] [llvm] r51589 - /llvm/trunk/lib/VMCore/Instructions.cpp Message-ID: <200805271103.m4RB3ffH019628@zion.cs.uiuc.edu> Author: ggreif Date: Tue May 27 06:03:29 2008 New Revision: 51589 URL: http://llvm.org/viewvc/llvm-project?rev=51589&view=rev Log: remove unneeded reinterpret_casts Modified: llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=51589&r1=51588&r2=51589&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Tue May 27 06:03:29 2008 @@ -1010,7 +1010,7 @@ } GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI) - : Instruction(reinterpret_cast(GEPI.getType()), GetElementPtr, + : Instruction(GEPI.getType(), GetElementPtr, OperandTraits::op_end(this) - GEPI.getNumOperands(), GEPI.getNumOperands()) { @@ -1355,7 +1355,7 @@ } InsertValueInst::InsertValueInst(const InsertValueInst &IVI) - : Instruction(reinterpret_cast(IVI.getType()), InsertValue, + : Instruction(IVI.getType(), InsertValue, OperandTraits::op_end(this) - IVI.getNumOperands(), IVI.getNumOperands()) { From ggreif at gmail.com Tue May 27 06:06:19 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 27 May 2008 11:06:19 -0000 Subject: [llvm-commits] [llvm] r51590 - in /llvm/trunk/lib/VMCore: BasicBlock.cpp Instructions.cpp Message-ID: <200805271106.m4RB6MXu019700@zion.cs.uiuc.edu> Author: ggreif Date: Tue May 27 06:06:03 2008 New Revision: 51590 URL: http://llvm.org/viewvc/llvm-project?rev=51590&view=rev Log: prune unneeded #includes Modified: llvm/trunk/lib/VMCore/BasicBlock.cpp llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/lib/VMCore/BasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/BasicBlock.cpp?rev=51590&r1=51589&r2=51590&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/BasicBlock.cpp (original) +++ llvm/trunk/lib/VMCore/BasicBlock.cpp Tue May 27 06:06:03 2008 @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/BasicBlock.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Type.h" Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=51590&r1=51589&r2=51590&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Tue May 27 06:06:03 2008 @@ -12,7 +12,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/BasicBlock.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" From baldrick at free.fr Tue May 27 06:50:51 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 27 May 2008 11:50:51 -0000 Subject: [llvm-commits] [llvm] r51591 - in /llvm/trunk/lib: Analysis/IPA/Andersens.cpp CodeGen/RegisterScavenging.cpp CodeGen/SelectionDAG/SelectionDAG.cpp Target/CBackend/CBackend.cpp Transforms/IPO/ArgumentPromotion.cpp Transforms/Scalar/JumpThreading.cpp Message-ID: <200805271150.m4RBoqo6020993@zion.cs.uiuc.edu> Author: baldrick Date: Tue May 27 06:50:51 2008 New Revision: 51591 URL: http://llvm.org/viewvc/llvm-project?rev=51591&view=rev Log: Fix some constructs that gcc-4.4 warns about. Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=51591&r1=51590&r2=51591&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Tue May 27 06:50:51 2008 @@ -2724,13 +2724,14 @@ DOUT << "\n"; if (SDTActive) - if (SDT[Second] >= 0) + if (SDT[Second] >= 0) { if (SDT[First] < 0) SDT[First] = SDT[Second]; else { UniteNodes( FindNode(SDT[First]), FindNode(SDT[Second]) ); First = FindNode(First); } + } return First; } Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=51591&r1=51590&r2=51591&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Tue May 27 06:50:51 2008 @@ -37,11 +37,12 @@ const MachineOperand &MO = MI->getOperand(i); if (!MO.isRegister()) continue; - if (TRI->isSuperRegister(SubReg, MO.getReg())) + if (TRI->isSuperRegister(SubReg, MO.getReg())) { if (MO.isUse()) SeenSuperUse = true; else if (MO.isImplicit()) SeenSuperDef = true; + } } return SeenSuperDef && SeenSuperUse; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=51591&r1=51590&r2=51591&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue May 27 06:50:51 2008 @@ -2986,7 +2986,7 @@ } bool Indexed = AM != ISD::UNINDEXED; - assert(Indexed || Offset.getOpcode() == ISD::UNDEF && + assert((Indexed || Offset.getOpcode() == ISD::UNDEF) && "Unindexed load with an offset!"); SDVTList VTs = Indexed ? Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=51591&r1=51590&r2=51591&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Tue May 27 06:50:51 2008 @@ -3205,11 +3205,12 @@ Out << "(("; printType(Out, PointerType::getUnqual(EltTy)); Out << ")(&" << GetValueName(Op) - << "))[" << (SrcVal & NumElts-1) << "]"; + << "))[" << (SrcVal & (NumElts-1)) << "]"; } else if (isa(Op) || isa(Op)) { Out << "0"; } else { - printConstant(cast(Op)->getOperand(SrcVal & NumElts-1)); + printConstant(cast(Op)->getOperand(SrcVal & + (NumElts-1))); } } } Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=51591&r1=51590&r2=51591&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Tue May 27 06:50:51 2008 @@ -148,7 +148,7 @@ Argument *PtrArg = PointerArgs[i].first; if (isByVal) { const Type *AgTy = cast(PtrArg->getType())->getElementType(); - if (const StructType *STy = dyn_cast(AgTy)) + if (const StructType *STy = dyn_cast(AgTy)) { if (maxElements > 0 && STy->getNumElements() > maxElements) { DOUT << "argpromotion disable promoting argument '" << PtrArg->getName() << "' because it would require adding more " @@ -170,6 +170,7 @@ continue; } } + } } // Otherwise, see if we can promote the pointer to its value. Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=51591&r1=51590&r2=51591&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue May 27 06:50:51 2008 @@ -282,8 +282,8 @@ // If this is a binary operator tree of the same AND/OR opcode, check the // LHS/RHS. if (BinaryOperator *BO = dyn_cast(V)) - if (isAnd && BO->getOpcode() == Instruction::And || - !isAnd && BO->getOpcode() == Instruction::Or) { + if ((isAnd && BO->getOpcode() == Instruction::And) || + (!isAnd && BO->getOpcode() == Instruction::Or)) { if (ProcessBranchOnLogical(BO->getOperand(0), BB, isAnd)) return true; if (ProcessBranchOnLogical(BO->getOperand(1), BB, isAnd)) From matthijs at stdin.nl Tue May 27 07:43:05 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 27 May 2008 12:43:05 -0000 Subject: [llvm-commits] [test-suite] r51593 - /test-suite/trunk/Makefile.programs Message-ID: <200805271243.m4RCh53Y022520@zion.cs.uiuc.edu> Author: matthijs Date: Tue May 27 07:43:04 2008 New Revision: 51593 URL: http://llvm.org/viewvc/llvm-project?rev=51593&view=rev Log: Don't pass -time-passes to opt by default, this breaks ENABLE_STATS (because then -time-passes is passed twice). Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=51593&r1=51592&r2=51593&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Tue May 27 07:43:04 2008 @@ -255,7 +255,7 @@ # standard compilation optimizations. $(PROGRAMS_TO_TEST:%=Output/%.linked.bc): \ Output/%.linked.bc: Output/%.linked.rbc $(LOPT) - -$(LOPT) -std-compile-opts -time-passes -info-output-file=$(CURDIR)/$@.info $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@ -f + -$(LOPT) -std-compile-opts -info-output-file=$(CURDIR)/$@.info $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@ -f $(PROGRAMS_TO_TEST:%=Output/%.llvm.stripped.bc): \ Output/%.llvm.stripped.bc: Output/%.llvm.bc $(LOPT) @@ -263,7 +263,7 @@ $(PROGRAMS_TO_TEST:%=Output/%.linked.optbeta.bc): \ Output/%.linked.optbeta.bc: Output/%.linked.rbc $(LOPT) - -$(LOPT) $(OPTBETAOPTIONS) -time-passes -info-output-file=$(CURDIR)/$@.info $(STATS) $< -o $@ -f + -$(LOPT) $(OPTBETAOPTIONS) -info-output-file=$(CURDIR)/$@.info $(STATS) $< -o $@ -f ifndef DISABLE_FOR_LLVM_PROGRAMS From matthijs at stdin.nl Tue May 27 07:41:24 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 27 May 2008 12:41:24 -0000 Subject: [llvm-commits] [llvm] r51592 - /llvm/trunk/include/llvm/ADT/Statistic.h Message-ID: <200805271241.m4RCfOe5022410@zion.cs.uiuc.edu> Author: matthijs Date: Tue May 27 07:41:24 2008 New Revision: 51592 URL: http://llvm.org/viewvc/llvm-project?rev=51592&view=rev Log: Use an explicit llvm:: prefix in the STATISTIC macro, so STATISTIC can still be used when "using namespace llvm" is not in effect. Modified: llvm/trunk/include/llvm/ADT/Statistic.h Modified: llvm/trunk/include/llvm/ADT/Statistic.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Statistic.h?rev=51592&r1=51591&r2=51592&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Statistic.h (original) +++ llvm/trunk/include/llvm/ADT/Statistic.h Tue May 27 07:41:24 2008 @@ -68,7 +68,7 @@ // STATISTIC - A macro to make definition of statistics really simple. This // automatically passes the DEBUG_TYPE of the file into the statistic. #define STATISTIC(VARNAME, DESC) \ - static Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 } + static llvm::Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 } } // End llvm namespace From clattner at apple.com Tue May 27 10:55:31 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 27 May 2008 08:55:31 -0700 Subject: [llvm-commits] [llvm] r51590 - in /llvm/trunk/lib/VMCore: BasicBlock.cpp Instructions.cpp In-Reply-To: <200805271106.m4RB6MXu019700@zion.cs.uiuc.edu> References: <200805271106.m4RB6MXu019700@zion.cs.uiuc.edu> Message-ID: <7AF538A8-EAF1-4DF9-9FCE-8FADA6BD4A71@apple.com> On May 27, 2008, at 4:06 AM, Gabor Greif wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=51590&view=rev > Log: > prune unneeded #includes > +++ llvm/trunk/lib/VMCore/Instructions.cpp Tue May 27 06:06:03 2008 > @@ -12,7 +12,6 @@ > // > // > = > = > = > ----------------------------------------------------------------------= > ==// > > -#include "llvm/BasicBlock.h" Ok. > +++ llvm/trunk/lib/VMCore/BasicBlock.cpp Tue May 27 06:06:03 2008 > @@ -11,7 +11,6 @@ > // > // > = > = > = > ----------------------------------------------------------------------= > ==// > > -#include "llvm/BasicBlock.h" > #include "llvm/Constants.h" > #include "llvm/Instructions.h" > #include "llvm/Type.h" Not ok. The .cpp file for a module should include its corresponding header first, even if redundant. -Chris From clattner at apple.com Tue May 27 10:56:52 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 27 May 2008 08:56:52 -0700 Subject: [llvm-commits] [test-suite] r51593 - /test-suite/trunk/Makefile.programs In-Reply-To: <200805271243.m4RCh53Y022520@zion.cs.uiuc.edu> References: <200805271243.m4RCh53Y022520@zion.cs.uiuc.edu> Message-ID: <4DDCBC9C-3E15-4594-A8CF-0DEAAD21E0BB@apple.com> On May 27, 2008, at 5:43 AM, Matthijs Kooijman wrote: > Author: matthijs > Date: Tue May 27 07:43:04 2008 > New Revision: 51593 > > URL: http://llvm.org/viewvc/llvm-project?rev=51593&view=rev > Log: > Don't pass -time-passes to opt by default, this breaks ENABLE_STATS > (because > then -time-passes is passed twice). Hi Matthijs, I think this will break the nightly tester and several other reports, which expects to get timing info without ENABLE_STATS. I'm not familiar with ENABLE_STATS, when did it get added? -Chris > > > Modified: > test-suite/trunk/Makefile.programs > > Modified: test-suite/trunk/Makefile.programs > URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=51593&r1=51592&r2=51593&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- test-suite/trunk/Makefile.programs (original) > +++ test-suite/trunk/Makefile.programs Tue May 27 07:43:04 2008 > @@ -255,7 +255,7 @@ > # standard compilation optimizations. > $(PROGRAMS_TO_TEST:%=Output/%.linked.bc): \ > Output/%.linked.bc: Output/%.linked.rbc $(LOPT) > - -$(LOPT) -std-compile-opts -time-passes -info-output-file=$ > (CURDIR)/$@.info $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@ -f > + -$(LOPT) -std-compile-opts -info-output-file=$(CURDIR)/$@.info $ > (STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@ -f > > $(PROGRAMS_TO_TEST:%=Output/%.llvm.stripped.bc): \ > Output/%.llvm.stripped.bc: Output/%.llvm.bc $(LOPT) > @@ -263,7 +263,7 @@ > > $(PROGRAMS_TO_TEST:%=Output/%.linked.optbeta.bc): \ > Output/%.linked.optbeta.bc: Output/%.linked.rbc $(LOPT) > - -$(LOPT) $(OPTBETAOPTIONS) -time-passes -info-output-file=$ > (CURDIR)/$@.info $(STATS) $< -o $@ -f > + -$(LOPT) $(OPTBETAOPTIONS) -info-output-file=$(CURDIR)/$@.info $ > (STATS) $< -o $@ -f > > > ifndef DISABLE_FOR_LLVM_PROGRAMS > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From ggreif at gmail.com Tue May 27 12:26:03 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 27 May 2008 17:26:03 -0000 Subject: [llvm-commits] [llvm] r51598 - /llvm/trunk/lib/VMCore/BasicBlock.cpp Message-ID: <200805271726.m4RHQ4xD030759@zion.cs.uiuc.edu> Author: ggreif Date: Tue May 27 12:26:02 2008 New Revision: 51598 URL: http://llvm.org/viewvc/llvm-project?rev=51598&view=rev Log: back out last commit: The .cpp file for a module should include its corresponding header first, even if redundant. Modified: llvm/trunk/lib/VMCore/BasicBlock.cpp Modified: llvm/trunk/lib/VMCore/BasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/BasicBlock.cpp?rev=51598&r1=51597&r2=51598&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/BasicBlock.cpp (original) +++ llvm/trunk/lib/VMCore/BasicBlock.cpp Tue May 27 12:26:02 2008 @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/BasicBlock.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Type.h" From gohman at apple.com Tue May 27 12:44:23 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 27 May 2008 17:44:23 -0000 Subject: [llvm-commits] [llvm] r51599 - /llvm/trunk/test/CodeGen/X86/pmul.ll Message-ID: <200805271744.m4RHiNPW031342@zion.cs.uiuc.edu> Author: djg Date: Tue May 27 12:44:23 2008 New Revision: 51599 URL: http://llvm.org/viewvc/llvm-project?rev=51599&view=rev Log: Make this test independent of the target-triple; the stack alignment is specifically what this test depends on. Modified: llvm/trunk/test/CodeGen/X86/pmul.ll Modified: llvm/trunk/test/CodeGen/X86/pmul.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pmul.ll?rev=51599&r1=51598&r2=51599&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pmul.ll (original) +++ llvm/trunk/test/CodeGen/X86/pmul.ll Tue May 27 12:44:23 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -mtriple=i686-apple-darwin8.8.0 > %t +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -stack-alignment=16 > %t ; RUN: grep pmul %t | count 6 ; RUN: grep mov %t | count 8 From gohman at apple.com Tue May 27 12:55:57 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 27 May 2008 17:55:57 -0000 Subject: [llvm-commits] [llvm] r51600 - /llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll Message-ID: <200805271755.m4RHtvdM031780@zion.cs.uiuc.edu> Author: djg Date: Tue May 27 12:55:57 2008 New Revision: 51600 URL: http://llvm.org/viewvc/llvm-project?rev=51600&view=rev Log: Specify a target so that this tests tests what it's intended to test. Modified: llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll Modified: llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll?rev=51600&r1=51599&r2=51600&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll Tue May 27 12:55:57 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc | not grep pushf +; RUN: llvm-as < %s | llc -march=x86 | not grep pushf %struct.gl_texture_image = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8* } %struct.gl_texture_object = type { i32, i32, i32, float, [4 x i32], i32, i32, i32, i32, i32, float, [11 x %struct.gl_texture_image*], [1024 x i8], i32, i32, i32, i8, i8*, i8, void (%struct.gl_texture_object*, i32, float*, float*, float*, float*, i8*, i8*, i8*, i8*)*, %struct.gl_texture_object* } From evan.cheng at apple.com Tue May 27 13:08:27 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 27 May 2008 11:08:27 -0700 Subject: [llvm-commits] [llvm] r51562 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp In-Reply-To: <200805260518.m4Q5IaES016278@zion.cs.uiuc.edu> References: <200805260518.m4Q5IaES016278@zion.cs.uiuc.edu> Message-ID: On May 25, 2008, at 10:18 PM, Bill Wendling wrote: > Author: void > Date: Mon May 26 00:18:34 2008 > New Revision: 51562 > > URL: http://llvm.org/viewvc/llvm-project?rev=51562&view=rev > Log: > A problem that's exposed when machine LICM is enabled. Consider this > code: > > LBB1_3: # bb > .. > xorl %ebp, %ebp > subl (%ebx), %ebp > .. > incl %ecx > cmpl %edi, %ecx > jl LBB1_3 # bb > > Whe using machine LICM, LLVM converts it into: > > xorl %esi, %esi > LBB1_3: # bb > .. > movl %esi, %ebp > subl (%ebx), %ebp > .. > incl %ecx > cmpl %edi, %ecx > jl LBB1_3 # bb > > Two address conversion inserts the copy instruction. However, it's > cheaper to > rematerialize it, and remat helps reduce register pressure. > > Modified: > llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > > Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51562&r1=51561&r2=51562&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) > +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon May 26 > 00:18:34 2008 > @@ -39,6 +39,7 @@ > #include "llvm/Target/TargetMachine.h" > #include "llvm/Support/Compiler.h" > #include "llvm/Support/Debug.h" > +#include "llvm/ADT/SmallPtrSet.h" > #include "llvm/ADT/Statistic.h" > #include "llvm/ADT/STLExtras.h" > using namespace llvm; > @@ -200,6 +201,8 @@ > DOUT << "********** REWRITING TWO-ADDR INSTRS **********\n"; > DOUT << "********** Function: " << MF.getFunction()->getName() << > '\n'; > > + SmallPtrSet ReMattedInstrs; > + > for (MachineFunction::iterator mbbi = MF.begin(), mbbe = MF.end(); > mbbi != mbbe; ++mbbi) { > for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi- > >end(); > @@ -321,7 +324,14 @@ > > InstructionRearranged: > const TargetRegisterClass* rc = > MF.getRegInfo().getRegClass(regA); > - TII->copyRegToReg(*mbbi, mi, regA, regB, rc, rc); > + MachineInstr *Orig = MRI->getVRegDef(regB); > + > + if (Orig && TII->isTriviallyReMaterializable(Orig)) { > + TII->reMaterialize(*mbbi, mi, regA, Orig); > + ReMattedInstrs.insert(Orig); Do you see any performance impact from this patch? It's not clear this is always a good idea. It's almost always a good idea to remat instead of spill, but not necessarily the case here. I wonder if this needs to check if the instruction is "cheap"? > > + } else { > + TII->copyRegToReg(*mbbi, mi, regA, regB, rc, rc); > + } > > MachineBasicBlock::iterator prevMi = prior(mi); > DOUT << "\t\tprepend:\t"; DEBUG(prevMi- > >print(*cerr.stream(), &TM)); > @@ -357,5 +367,34 @@ > } > } > > + SmallPtrSet::iterator I = ReMattedInstrs.begin(); > + SmallPtrSet::iterator E = ReMattedInstrs.end(); > + > + for (; I != E; ++I) { > + MachineInstr *MI = *I; > + bool InstrDead = true; > + > + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { > + const MachineOperand &MO = MI->getOperand(i); > + if (!MO.isRegister()) > + continue; > + unsigned MOReg = MO.getReg(); > + if (!MOReg) > + continue; > + if (MO.isDef()) { > + if (MO.isImplicit()) > + continue; How about? is (!MOReg || !MO.isDef() || MO.isImplicit()) continue; > > + > + if (MRI->use_begin(MOReg) != MRI->use_end()) { > + InstrDead = false; > + break; > + } > + } > + } > + > + if (InstrDead && MI->getNumOperands() > 0) Why check for MI->getNumOperands() > 0? Evan > > + MI->eraseFromParent(); > + } > + > return MadeChange; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Tue May 27 13:09:14 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 27 May 2008 11:09:14 -0700 Subject: [llvm-commits] [llvm] r51533 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86InstrSSE.td lib/VMCore/AutoUpgrade.cpp test/Bitcode/sse2_punpck_qdq.ll test/Bitcode/sse2_punpck_qdq.ll.bc In-Reply-To: <29780B2F-9C1D-4988-AB7F-B18D2C92FFCC@gmail.com> References: <200805240256.m4O2uUxg017739@zion.cs.uiuc.edu> <29780B2F-9C1D-4988-AB7F-B18D2C92FFCC@gmail.com> Message-ID: <6D39B56C-DCBD-4712-8DEF-67B93892929E@apple.com> This is testing whether intrinsic auto upgrading works. Evan On May 24, 2008, at 9:21 AM, Bill Wendling wrote: > On May 23, 2008, at 7:56 PM, Evan Cheng wrote: > >> Author: evancheng >> Date: Fri May 23 21:56:30 2008 >> New Revision: 51533 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=51533&view=rev >> Log: >> Eliminate x86.sse2.punpckh.qdq and x86.sse2.punpckl.qdq. >> >> Added: >> llvm/trunk/test/Bitcode/sse2_punpck_qdq.ll >> llvm/trunk/test/Bitcode/sse2_punpck_qdq.ll.bc (with props) > > Why add the .bc file? > > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From asl at math.spbu.ru Tue May 27 13:13:34 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 27 May 2008 18:13:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51601 - /llvm-gcc-4.2/trunk/gcc/unwind-c.c Message-ID: <200805271813.m4RIDYnC032288@zion.cs.uiuc.edu> Author: asl Date: Tue May 27 13:13:34 2008 New Revision: 51601 URL: http://llvm.org/viewvc/llvm-project?rev=51601&view=rev Log: Fix 4.0 => 4.2 merge error Modified: llvm-gcc-4.2/trunk/gcc/unwind-c.c Modified: llvm-gcc-4.2/trunk/gcc/unwind-c.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/unwind-c.c?rev=51601&r1=51600&r2=51601&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/unwind-c.c (original) +++ llvm-gcc-4.2/trunk/gcc/unwind-c.c Tue May 27 13:13:34 2008 @@ -95,22 +95,6 @@ #define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND #endif -/* LLVM LOCAL begin */ -#ifdef __ARM_EABI_UNWINDER__ -/* ARM EABI personality routines must also unwind the stack. */ -#define CONTINUE_UNWINDING \ - do \ - { \ - if (__gnu_unwind_frame (ue_header, context) != _URC_OK) \ - return _URC_FAILURE; \ - return _URC_CONTINUE_UNWIND; \ - } \ - while (0) -#else -#define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND -#endif -/* LLVM LOCAL end */ - #ifdef __USING_SJLJ_EXCEPTIONS__ #define PERSONALITY_FUNCTION __gcc_personality_sj0 #define __builtin_eh_return_data_regno(x) x From isanbard at gmail.com Tue May 27 13:29:13 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 27 May 2008 11:29:13 -0700 Subject: [llvm-commits] [llvm] r51562 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp In-Reply-To: References: <200805260518.m4Q5IaES016278@zion.cs.uiuc.edu> Message-ID: <16e5fdf90805271129h2980ff15w7630c4ef0b3a473b@mail.gmail.com> On Tue, May 27, 2008 at 11:08 AM, Evan Cheng wrote: > On May 25, 2008, at 10:18 PM, Bill Wendling wrote: > >> --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) >> +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon May 26 >> @@ -321,7 +324,14 @@ >> >> InstructionRearranged: >> const TargetRegisterClass* rc = >> MF.getRegInfo().getRegClass(regA); >> - TII->copyRegToReg(*mbbi, mi, regA, regB, rc, rc); >> + MachineInstr *Orig = MRI->getVRegDef(regB); >> + >> + if (Orig && TII->isTriviallyReMaterializable(Orig)) { >> + TII->reMaterialize(*mbbi, mi, regA, Orig); >> + ReMattedInstrs.insert(Orig); > > Do you see any performance impact from this patch? It's not clear this > is always a good idea. It's almost always a good idea to remat instead > of spill, but not necessarily the case here. I wonder if this needs to > check if the instruction is "cheap"? > I ran the llvm-tests to check for correctness (though your PIC run had some failures for the Beta that I set up). I didn't run it to check for performance. I'll do that and see what's up. >> @@ -357,5 +367,34 @@ >> } >> } >> >> + SmallPtrSet::iterator I = ReMattedInstrs.begin(); >> + SmallPtrSet::iterator E = ReMattedInstrs.end(); >> + >> + for (; I != E; ++I) { >> + MachineInstr *MI = *I; >> + bool InstrDead = true; >> + >> + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { >> + const MachineOperand &MO = MI->getOperand(i); >> + if (!MO.isRegister()) >> + continue; >> + unsigned MOReg = MO.getReg(); >> + if (!MOReg) >> + continue; >> + if (MO.isDef()) { >> + if (MO.isImplicit()) >> + continue; > > How about? > > is (!MOReg || !MO.isDef() || MO.isImplicit()) > continue; > Sure. I'll combine it with your previous email and have it also check (MO.isImplicit() && MO.isDead()). >> + if (MRI->use_begin(MOReg) != MRI->use_end()) { >> + InstrDead = false; >> + break; >> + } >> + } >> + } >> + >> + if (InstrDead && MI->getNumOperands() > 0) > > Why check for MI->getNumOperands() > 0? > Paranoia :-) -bw From isanbard at gmail.com Tue May 27 13:29:42 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 27 May 2008 11:29:42 -0700 Subject: [llvm-commits] [llvm] r51533 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86InstrSSE.td lib/VMCore/AutoUpgrade.cpp test/Bitcode/sse2_punpck_qdq.ll test/Bitcode/sse2_punpck_qdq.ll.bc In-Reply-To: <6D39B56C-DCBD-4712-8DEF-67B93892929E@apple.com> References: <200805240256.m4O2uUxg017739@zion.cs.uiuc.edu> <29780B2F-9C1D-4988-AB7F-B18D2C92FFCC@gmail.com> <6D39B56C-DCBD-4712-8DEF-67B93892929E@apple.com> Message-ID: <16e5fdf90805271129x3b665fd9p14a23d7b33e4634e@mail.gmail.com> Ah! Okay. Never mind then. :-) -bw On Tue, May 27, 2008 at 11:09 AM, Evan Cheng wrote: > This is testing whether intrinsic auto upgrading works. > > Evan > > On May 24, 2008, at 9:21 AM, Bill Wendling wrote: > >> On May 23, 2008, at 7:56 PM, Evan Cheng wrote: >> >>> Author: evancheng >>> Date: Fri May 23 21:56:30 2008 >>> New Revision: 51533 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=51533&view=rev >>> Log: >>> Eliminate x86.sse2.punpckh.qdq and x86.sse2.punpckl.qdq. >>> >>> Added: >>> llvm/trunk/test/Bitcode/sse2_punpck_qdq.ll >>> llvm/trunk/test/Bitcode/sse2_punpck_qdq.ll.bc (with props) >> >> Why add the .bc file? >> >> -bw >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dalej at apple.com Tue May 27 13:29:48 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 27 May 2008 18:29:48 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51602 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/abi/key2.C Message-ID: <200805271829.m4RITmPw000333@zion.cs.uiuc.edu> Author: johannes Date: Tue May 27 13:29:48 2008 New Revision: 51602 URL: http://llvm.org/viewvc/llvm-project?rev=51602&view=rev Log: Adjust testcase to reflect different ordering emitted by llvmgcc (as best we can). Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/abi/key2.C Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/abi/key2.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/abi/key2.C?rev=51602&r1=51601&r2=51602&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/abi/key2.C (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/abi/key2.C Tue May 27 13:29:48 2008 @@ -4,7 +4,12 @@ // { dg-do compile { target *-*-darwin* } } // { dg-final { scan-assembler ".globl __ZTV1f\\n .weak_definition __ZTV1f\\n .section __DATA,__const_coal,coalesced" } } // { dg-final { scan-assembler ".globl __ZTS1f\\n .weak_definition __ZTS1f\\n .section __TEXT,__const_coal,coalesced" } } -// { dg-final { scan-assembler ".globl __ZTI1f\\n .weak_definition __ZTI1f\\n .section __DATA,__const_coal,coalesced" } } +// LLVM LOCAL begin +// With llvm ZTI1f is in the right place, but the ordering is different +// so the .section directive is not needed. Do the best we can. +// (It belongs in the same place as ZTV1f.) +// LLVM LOCAL end +// { dg-final { scan-assembler ".globl __ZTI1f\\n .weak_definition __ZTI1f\\n" } } class f { From sabre at nondot.org Tue May 27 13:54:51 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 27 May 2008 18:54:51 -0000 Subject: [llvm-commits] [test-suite] r51603 - /test-suite/trunk/Makefile.programs Message-ID: <200805271854.m4RIspIK001106@zion.cs.uiuc.edu> Author: lattner Date: Tue May 27 13:54:50 2008 New Revision: 51603 URL: http://llvm.org/viewvc/llvm-project?rev=51603&view=rev Log: Temporarily revert this patch until we can evaluate the impact on the testers. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=51603&r1=51602&r2=51603&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Tue May 27 13:54:50 2008 @@ -255,7 +255,7 @@ # standard compilation optimizations. $(PROGRAMS_TO_TEST:%=Output/%.linked.bc): \ Output/%.linked.bc: Output/%.linked.rbc $(LOPT) - -$(LOPT) -std-compile-opts -info-output-file=$(CURDIR)/$@.info $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@ -f + -$(LOPT) -std-compile-opts -time-passes -info-output-file=$(CURDIR)/$@.info $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@ -f $(PROGRAMS_TO_TEST:%=Output/%.llvm.stripped.bc): \ Output/%.llvm.stripped.bc: Output/%.llvm.bc $(LOPT) @@ -263,7 +263,7 @@ $(PROGRAMS_TO_TEST:%=Output/%.linked.optbeta.bc): \ Output/%.linked.optbeta.bc: Output/%.linked.rbc $(LOPT) - -$(LOPT) $(OPTBETAOPTIONS) -info-output-file=$(CURDIR)/$@.info $(STATS) $< -o $@ -f + -$(LOPT) $(OPTBETAOPTIONS) -time-passes -info-output-file=$(CURDIR)/$@.info $(STATS) $< -o $@ -f ifndef DISABLE_FOR_LLVM_PROGRAMS From dalej at apple.com Tue May 27 15:11:10 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 27 May 2008 20:11:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51604 - in /llvm-gcc-4.2/trunk/gcc: combine.c config/i386/i386.h global.c haifa-sched.c local-alloc.c passes.c reload1.c toplev.c Message-ID: <200805272011.m4RKBAa2003153@zion.cs.uiuc.edu> Author: johannes Date: Tue May 27 15:11:08 2008 New Revision: 51604 URL: http://llvm.org/viewvc/llvm-project?rev=51604&view=rev Log: Comment out some code that isn't used by llvm-gcc: RTX combine, scheduler, global & local RAs, pieces that were already unreacahable but not commented, RTX version of x87 stack handling. Modified: llvm-gcc-4.2/trunk/gcc/combine.c llvm-gcc-4.2/trunk/gcc/config/i386/i386.h llvm-gcc-4.2/trunk/gcc/global.c llvm-gcc-4.2/trunk/gcc/haifa-sched.c llvm-gcc-4.2/trunk/gcc/local-alloc.c llvm-gcc-4.2/trunk/gcc/passes.c llvm-gcc-4.2/trunk/gcc/reload1.c llvm-gcc-4.2/trunk/gcc/toplev.c Modified: llvm-gcc-4.2/trunk/gcc/combine.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/combine.c?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/combine.c (original) +++ llvm-gcc-4.2/trunk/gcc/combine.c Tue May 27 15:11:08 2008 @@ -103,6 +103,9 @@ #include "timevar.h" #include "tree-pass.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifndef ENABLE_LLVM +/* LLVM LOCAL end */ /* Number of attempts to combine instructions in this function. */ static int combine_attempts; @@ -11622,6 +11625,9 @@ } } } +/* LLVM LOCAL begin following function is used elsewhere */ +#endif +/* LLVM LOCAL end */ /* Remove register number REGNO from the dead registers list of INSN. @@ -11641,6 +11647,9 @@ return note; } +/* LLVM LOCAL begin comment out most of file */ +#ifndef ENABLE_LLVM +/* LLVM LOCAL end */ /* For each register (hardware or pseudo) used within expression X, if its death is in an instruction with cuid between FROM_CUID (inclusive) and TO_INSN (exclusive), put a REG_DEAD note for that register in the @@ -12598,6 +12607,9 @@ "\n;; Combiner totals: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n", total_attempts, total_merges, total_extras, total_successes); } +/* LLVM LOCAL begin */ +#endif +/* LLVM LOCAL end */ static bool @@ -12610,6 +12622,8 @@ static unsigned int rest_of_handle_combine (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM int rebuild_jump_labels_after_combine = combine_instructions (get_insns (), max_reg_num ()); @@ -12625,6 +12639,8 @@ delete_dead_jumptables (); cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE); } +#endif +/* LLVM LOCAL end */ return 0; } Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Tue May 27 15:11:08 2008 @@ -791,7 +791,12 @@ /* This processor has special stack-like registers. See reg-stack.c for details. */ +/* LLVM LOCAL begin We don't need the RTL-based STACK_REGS (x87) mechanism. */ +#ifndef ENABLE_LLVM #define STACK_REGS +#endif +/* LLVM LOCAL end */ + #define IS_STACK_MODE(MODE) \ (((MODE) == SFmode && (!TARGET_SSE || !TARGET_SSE_MATH)) \ || ((MODE) == DFmode && (!TARGET_SSE2 || !TARGET_SSE_MATH)) \ Modified: llvm-gcc-4.2/trunk/gcc/global.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/global.c?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/global.c (original) +++ llvm-gcc-4.2/trunk/gcc/global.c Tue May 27 15:11:08 2008 @@ -40,6 +40,10 @@ #include "timevar.h" #include "vecprim.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifndef ENABLE_LLVM +/* LLVM LOCAL end */ + /* APPLE LOCAL begin rewrite weight computation */ /* The rewritten weight computation works fine on Darwin, but causes bootstrap compares to fail on Linux. */ @@ -435,12 +439,6 @@ size_t i; rtx x; - /* LLVM LOCAL begin - cc1 code size. */ -#ifdef ENABLE_LLVM - return 0; -#endif - /* LLVM LOCAL end */ - make_accurate_live_analysis (); max_allocno = 0; @@ -3145,6 +3143,10 @@ } free_bb_info (); } +/* LLVM LOCAL begin */ +#endif +/* LLVM LOCAL end */ + /* Run old register allocator. Return TRUE if we must exit rest_of_compilation upon return. */ static unsigned int @@ -3155,6 +3157,10 @@ /* If optimizing, allocate remaining pseudo-regs. Do the reload pass fixing up any insns that are invalid. */ +/* LLVM LOCAL begin */ +#ifdef ENABLE_LLVM + failure = 0; +#else if (optimize) failure = global_alloc (); else @@ -3171,6 +3177,8 @@ } gcc_assert (reload_completed || failure); +#endif +/* LLVM LOCAL end */ reload_completed = !failure; return 0; } Modified: llvm-gcc-4.2/trunk/gcc/haifa-sched.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/haifa-sched.c?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/haifa-sched.c (original) +++ llvm-gcc-4.2/trunk/gcc/haifa-sched.c Tue May 27 15:11:08 2008 @@ -145,6 +145,11 @@ #include "output.h" #include "params.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifndef ENABLE_LLVM +#undef INSN_SCHEDULING +#endif +/* LLVM LOCAL end */ #ifdef INSN_SCHEDULING /* issue_rate is the number of insns that can be scheduled in the same Modified: llvm-gcc-4.2/trunk/gcc/local-alloc.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/local-alloc.c?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/local-alloc.c (original) +++ llvm-gcc-4.2/trunk/gcc/local-alloc.c Tue May 27 15:11:08 2008 @@ -82,6 +82,9 @@ #include "timevar.h" #include "tree-pass.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifndef ENABLE_LLVM +/* LLVM LOCAL end */ /* Next quantity number available for allocation. */ static int next_qty; @@ -215,7 +218,9 @@ to a subreg of a DImode register. */ static char *reg_offset; - +/* LLVM LOCAL begin the following def is referenced elsewhere */ +#endif +/* LLVM LOCAL end */ /* Vector of substitutions of register numbers, used to map pseudo regs into hardware regs. This is set up as a result of register allocation. @@ -225,6 +230,9 @@ short *reg_renumber; +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM +/* LLVM LOCAL end */ /* Set of hard registers live at the current point in the scan of the instructions in a basic block. */ @@ -2557,12 +2565,18 @@ } #endif /* APPLE LOCAL end radar 4216496, 4229407, 4120689, 4095567 */ +/* LLVM LOCAL begin */ +#endif +/* LLVM LOCAL end */ /* Run old register allocator. Return TRUE if we must exit rest_of_compilation upon return. */ static unsigned int rest_of_handle_local_alloc (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM +/* LLVM LOCAL end */ int rebuild_notes; /* Determine if the current function is a leaf before running reload @@ -2627,6 +2641,9 @@ dump_local_alloc (dump_file); timevar_pop (TV_DUMP); } +/* LLVM LOCAL begin */ +#endif +/* LLVM LOCAL end */ return 0; } Modified: llvm-gcc-4.2/trunk/gcc/passes.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/passes.c?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/passes.c (original) +++ llvm-gcc-4.2/trunk/gcc/passes.c Tue May 27 15:11:08 2008 @@ -246,8 +246,7 @@ /* LLVM LOCAL begin Dead code strip cc1. */ #ifdef ENABLE_LLVM return; -#endif - /* LLVM LOCAL end Dead code strip cc1. */ +#else timevar_push (TV_DUMP); if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) @@ -280,6 +279,8 @@ } timevar_pop (TV_DUMP); +#endif + /* LLVM LOCAL end Dead code strip cc1. */ } static bool Modified: llvm-gcc-4.2/trunk/gcc/reload1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/reload1.c?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/reload1.c (original) +++ llvm-gcc-4.2/trunk/gcc/reload1.c Tue May 27 15:11:08 2008 @@ -2049,6 +2049,8 @@ inherent space, and no less total space, then the previous slot. */ if (from_reg == -1) { +/* LLVM LOCAL begin we've removed this definition */ +#ifndef ENABLE_LLVM /* APPLE LOCAL begin 4321079 */ extern rtx find_tied_stack_pseudo (int); /* Ask global reg allocator for a stack slot already assigned @@ -2056,6 +2058,8 @@ if (from_global) x = find_tied_stack_pseudo (i); else +#endif +/* LLVM LOCAL end */ x = NULL_RTX; if (!x) @@ -3826,7 +3830,11 @@ COPY_HARD_REG_SET (forbidden, bad_spill_regs_global); IOR_HARD_REG_SET (forbidden, pseudo_forbidden_regs[i]); IOR_HARD_REG_SET (forbidden, pseudo_previous_regs[i]); +/* LLVM LOCAL begin we've removed this definition */ +#ifndef ENABLE_LLVM retry_global_alloc (i, forbidden); +#endif +/* LLVM LOCAL end */ if (reg_renumber[i] >= 0) CLEAR_REGNO_REG_SET (&spilled_pseudos, i); } Modified: llvm-gcc-4.2/trunk/gcc/toplev.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/toplev.c?rev=51604&r1=51603&r2=51604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/toplev.c (original) +++ llvm-gcc-4.2/trunk/gcc/toplev.c Tue May 27 15:11:08 2008 @@ -2107,8 +2107,7 @@ llvm_lang_dependent_init(name); init_eh(); return 1; /* don't initialize the RTL backend */ -#endif - /* LLVM LOCAL end */ +#else /* These create various _DECL nodes, so need to be called after the front end is initialized. */ @@ -2144,6 +2143,8 @@ timevar_pop (TV_SYMOUT); return 1; +#endif + /* LLVM LOCAL end */ } /* Clean up: close opened files, etc. */ From dpatel at apple.com Tue May 27 15:18:45 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 27 May 2008 20:18:45 -0000 Subject: [llvm-commits] [llvm] r51605 - /llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Message-ID: <200805272018.m4RKIjOM003357@zion.cs.uiuc.edu> Author: dpatel Date: Tue May 27 15:18:45 2008 New Revision: 51605 URL: http://llvm.org/viewvc/llvm-project?rev=51605&view=rev Log: Use IPSCCPPass instead of IPConstantPropagationPass. Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=51605&r1=51604&r2=51605&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Tue May 27 15:18:45 2008 @@ -340,6 +340,11 @@ // Add an appropriate TargetData instance for this module... passes.add(new TargetData(*_target->getTargetData())); + // Propagate constants at call sites into the functions they call. This + // opens opportunities for globalopt (and inlining) by substituting function + // pointers passed as arguments to direct uses of functions. + passes.add(createIPSCCPPass()); + // Now that we internalized some globals, see if we can hack on them! passes.add(createGlobalOptimizerPass()); @@ -352,9 +357,6 @@ // supporting. passes.add(createStripSymbolsPass()); - // Propagate constants at call sites into the functions they call. - passes.add(createIPConstantPropagationPass()); - // Remove unused arguments from functions... passes.add(createDeadArgEliminationPass()); From gohman at apple.com Tue May 27 15:29:07 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 27 May 2008 20:29:07 -0000 Subject: [llvm-commits] [llvm] r51606 - /llvm/trunk/lib/Support/ConstantRange.cpp Message-ID: <200805272029.m4RKT8Xf003743@zion.cs.uiuc.edu> Author: djg Date: Tue May 27 15:29:07 2008 New Revision: 51606 URL: http://llvm.org/viewvc/llvm-project?rev=51606&view=rev Log: Tidy up whitespace in ConstantRange::print output. Modified: llvm/trunk/lib/Support/ConstantRange.cpp Modified: llvm/trunk/lib/Support/ConstantRange.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ConstantRange.cpp?rev=51606&r1=51605&r2=51606&view=diff ============================================================================== --- llvm/trunk/lib/Support/ConstantRange.cpp (original) +++ llvm/trunk/lib/Support/ConstantRange.cpp Tue May 27 15:29:07 2008 @@ -464,7 +464,7 @@ /// void ConstantRange::print(std::ostream &OS) const { OS << "[" << Lower.toStringSigned(10) << "," - << Upper.toStringSigned(10) << " )"; + << Upper.toStringSigned(10) << ")"; } /// dump - Allow printing from a debugger easily... From evan.cheng at apple.com Tue May 27 15:39:52 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 27 May 2008 20:39:52 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51607 - /llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Message-ID: <200805272039.m4RKdq9U004132@zion.cs.uiuc.edu> Author: evancheng Date: Tue May 27 15:39:51 2008 New Revision: 51607 URL: http://llvm.org/viewvc/llvm-project?rev=51607&view=rev Log: Unbreak the build. Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=51607&r1=51606&r2=51607&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Tue May 27 15:39:51 2008 @@ -86,6 +86,7 @@ llvm::createMemCpyOptPass(); llvm::createDeadTypeEliminationPass(); llvm::createLoopDeletionPass(); + llvm::createDeadCodeEliminationPass(); } From evan.cheng at apple.com Tue May 27 15:40:13 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 27 May 2008 20:40:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> Author: evancheng Date: Tue May 27 15:40:13 2008 New Revision: 51608 URL: http://llvm.org/viewvc/llvm-project?rev=51608&view=rev Log: Really honor -fno-inline-functions. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=51608&r1=51607&r2=51608&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue May 27 15:40:13 2008 @@ -353,7 +353,7 @@ PM->add(createCFGSimplificationPass()); // Clean up after IPCP & DAE if (flag_unit_at_a_time && flag_exceptions) PM->add(createPruneEHPass()); // Remove dead EH info - if (flag_inline_trees) // respect -fno-inline-functions + if (flag_inline_trees > 1) // respect -fno-inline-functions PM->add(createFunctionInliningPass()); // Inline small functions if (optimize > 2) PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args From isanbard at gmail.com Tue May 27 15:40:52 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 27 May 2008 20:40:52 -0000 Subject: [llvm-commits] [llvm] r51609 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200805272040.m4RKeqW4004185@zion.cs.uiuc.edu> Author: void Date: Tue May 27 15:40:52 2008 New Revision: 51609 URL: http://llvm.org/viewvc/llvm-project?rev=51609&view=rev Log: Incorporated feedback: Check that the implicitly defined operands aren't used before deleting the instruction. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51609&r1=51608&r2=51609&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue May 27 15:40:52 2008 @@ -373,6 +373,8 @@ } if (EnableReMat) { + // Check to see if the instructions that we rematerialized are now dead. If + // they are, expunge them here. SmallPtrSet::iterator I = ReMattedInstrs.begin(); SmallPtrSet::iterator E = ReMattedInstrs.end(); @@ -385,20 +387,17 @@ if (!MO.isRegister()) continue; unsigned MOReg = MO.getReg(); - if (!MOReg) + + if (!MOReg || !MO.isDef() || (MO.isImplicit() && MO.isDead())) continue; - if (MO.isDef()) { - if (MO.isImplicit()) - continue; - - if (MRI->use_begin(MOReg) != MRI->use_end()) { - InstrDead = false; - break; - } + + if (MRI->use_begin(MOReg) != MRI->use_end()) { + InstrDead = false; + break; } } - if (InstrDead && MI->getNumOperands() > 0) + if (InstrDead) MI->eraseFromParent(); } } From gohman at apple.com Tue May 27 15:41:18 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 27 May 2008 20:41:18 -0000 Subject: [llvm-commits] [llvm] r51610 - /llvm/trunk/include/llvm/Analysis/SparsePropagation.h Message-ID: <200805272041.m4RKfIYJ004211@zion.cs.uiuc.edu> Author: djg Date: Tue May 27 15:41:18 2008 New Revision: 51610 URL: http://llvm.org/viewvc/llvm-project?rev=51610&view=rev Log: Fix a word-o and add an explicit keyword. Modified: llvm/trunk/include/llvm/Analysis/SparsePropagation.h Modified: llvm/trunk/include/llvm/Analysis/SparsePropagation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/SparsePropagation.h?rev=51610&r1=51609&r2=51610&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/SparsePropagation.h (original) +++ llvm/trunk/include/llvm/Analysis/SparsePropagation.h Tue May 27 15:41:18 2008 @@ -32,7 +32,7 @@ class SparseSolver; /// AbstractLatticeFunction - This class is implemented by the dataflow instance -/// to specify what the lattice values are and what how they handle merges etc. +/// to specify what the lattice values are and how they handle merges etc. /// This gives the client the power to compute lattice values from instructions, /// constants, etc. The requirement is that lattice values must all fit into /// a void*. If a void* is not sufficient, the implementation should use this @@ -119,7 +119,8 @@ SparseSolver(const SparseSolver&); // DO NOT IMPLEMENT void operator=(const SparseSolver&); // DO NOT IMPLEMENT public: - SparseSolver(AbstractLatticeFunction *Lattice) : LatticeFunc(Lattice) {} + explicit SparseSolver(AbstractLatticeFunction *Lattice) + : LatticeFunc(Lattice) {} ~SparseSolver() { delete LatticeFunc; } From dpatel at apple.com Tue May 27 15:42:45 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 27 May 2008 20:42:45 -0000 Subject: [llvm-commits] [llvm] r51611 - /llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Message-ID: <200805272042.m4RKgj9W004252@zion.cs.uiuc.edu> Author: dpatel Date: Tue May 27 15:42:44 2008 New Revision: 51611 URL: http://llvm.org/viewvc/llvm-project?rev=51611&view=rev Log: Add instcombine after global optimizations. Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=51611&r1=51610&r2=51611&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Tue May 27 15:42:44 2008 @@ -360,6 +360,12 @@ // Remove unused arguments from functions... passes.add(createDeadArgEliminationPass()); + // Reduce the code after globalopt and ipsccp. Both can open up significant + // simplification opportunities, and both can propagate functions through + // function pointers. When this happens, we often have to resolve varargs + // calls, etc, so let instcombine do this. + passes.add(createInstructionCombiningPass()); + passes.add(createFunctionInliningPass()); // Inline small functions passes.add(createPruneEHPass()); // Remove dead EH info From gohman at apple.com Tue May 27 15:47:30 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 27 May 2008 20:47:30 -0000 Subject: [llvm-commits] [llvm] r51612 - /llvm/trunk/lib/Analysis/SparsePropagation.cpp Message-ID: <200805272047.m4RKlUl3004391@zion.cs.uiuc.edu> Author: djg Date: Tue May 27 15:47:30 2008 New Revision: 51612 URL: http://llvm.org/viewvc/llvm-project?rev=51612&view=rev Log: Print debug output when any edge becomes executable, including the first visited edge. Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SparsePropagation.cpp?rev=51612&r1=51611&r2=51612&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/SparsePropagation.cpp (original) +++ llvm/trunk/lib/Analysis/SparsePropagation.cpp Tue May 27 15:47:30 2008 @@ -96,10 +96,10 @@ if (!KnownFeasibleEdges.insert(Edge(Source, Dest)).second) return; // This edge is already known to be executable! + DOUT << "Marking Edge Executable: " << Source->getNameStart() + << " -> " << Dest->getNameStart() << "\n"; + if (BBExecutable.count(Dest)) { - DOUT << "Marking Edge Executable: " << Source->getNameStart() - << " -> " << Dest->getNameStart() << "\n"; - // The destination is already executable, but we just made an edge // feasible that wasn't before. Revisit the PHI nodes in the block // because they have potentially new operands. From gohman at apple.com Tue May 27 15:55:30 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 27 May 2008 20:55:30 -0000 Subject: [llvm-commits] [llvm] r51613 - /llvm/trunk/lib/Analysis/SparsePropagation.cpp Message-ID: <200805272055.m4RKtU07004635@zion.cs.uiuc.edu> Author: djg Date: Tue May 27 15:55:29 2008 New Revision: 51613 URL: http://llvm.org/viewvc/llvm-project?rev=51613&view=rev Log: Use Function::getEntryBlock instead of Function::begin, for clarity. Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SparsePropagation.cpp?rev=51613&r1=51612&r2=51613&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/SparsePropagation.cpp (original) +++ llvm/trunk/lib/Analysis/SparsePropagation.cpp Tue May 27 15:55:29 2008 @@ -272,7 +272,7 @@ } void SparseSolver::Solve(Function &F) { - MarkBlockExecutable(F.begin()); + MarkBlockExecutable(&F.getEntryBlock()); // Process the work lists until they are empty! while (!BBWorkList.empty() || !InstWorkList.empty()) { From isanbard at gmail.com Tue May 27 16:08:15 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 27 May 2008 21:08:15 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51614 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200805272108.m4RL8Gu4005202@zion.cs.uiuc.edu> Author: void Date: Tue May 27 16:08:15 2008 New Revision: 51614 URL: http://llvm.org/viewvc/llvm-project?rev=51614&view=rev Log: Remove spurious warning by initializing variable. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=51614&r1=51613&r2=51614&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Tue May 27 16:08:15 2008 @@ -3048,7 +3048,7 @@ /* APPLE LOCAL begin radar 5676962 */ tree t; int cv = 0; - struct lang_type ** pTypeLang; + struct lang_type ** pTypeLang = 0; /* APPLE LOCAL end radar 5676962 */ /* APPLE LOCAL begin radar 5025001 */ From ggreif at gmail.com Tue May 27 16:29:39 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 27 May 2008 21:29:39 -0000 Subject: [llvm-commits] [llvm] r51615 - /llvm/trunk/include/llvm/Use.h Message-ID: <200805272129.m4RLTdAi005878@zion.cs.uiuc.edu> Author: ggreif Date: Tue May 27 16:29:38 2008 New Revision: 51615 URL: http://llvm.org/viewvc/llvm-project?rev=51615&view=rev Log: Make Use::init() private, it breaks invariants, clients should assign or use set(). Modified: llvm/trunk/include/llvm/Use.h Modified: llvm/trunk/include/llvm/Use.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=51615&r1=51614&r2=51615&view=diff ============================================================================== --- llvm/trunk/include/llvm/Use.h (original) +++ llvm/trunk/include/llvm/Use.h Tue May 27 16:29:38 2008 @@ -66,10 +66,11 @@ // Use is here to make keeping the "use" list of a Value up-to-date really easy. // class Use { -public: +private: /// init - specify Value and User /// @deprecated in 2.4, will be removed soon inline void init(Value *V, User *U); +public: /// swap - provide a fast substitute to std::swap /// that also works with less standard-compliant compilers void swap(Use &RHS); @@ -93,8 +94,6 @@ , fullStopTag = tagThree }; public: - - operator Value*() const { return Val; } Value *get() const { return Val; } User *getUser() const; From dalej at apple.com Tue May 27 16:48:05 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 27 May 2008 21:48:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51616 - in /llvm-gcc-4.2/trunk/gcc: bb-reorder.c bt-load.c final.c flow.c haifa-sched.c Message-ID: <200805272148.m4RLm55t006395@zion.cs.uiuc.edu> Author: johannes Date: Tue May 27 16:48:05 2008 New Revision: 51616 URL: http://llvm.org/viewvc/llvm-project?rev=51616&view=rev Log: Comment out more stuff that doesn't apply to llvm. Modified: llvm-gcc-4.2/trunk/gcc/bb-reorder.c llvm-gcc-4.2/trunk/gcc/bt-load.c llvm-gcc-4.2/trunk/gcc/final.c llvm-gcc-4.2/trunk/gcc/flow.c llvm-gcc-4.2/trunk/gcc/haifa-sched.c Modified: llvm-gcc-4.2/trunk/gcc/bb-reorder.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/bb-reorder.c?rev=51616&r1=51615&r2=51616&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/bb-reorder.c (original) +++ llvm-gcc-4.2/trunk/gcc/bb-reorder.c Tue May 27 16:48:05 2008 @@ -85,6 +85,8 @@ #include "toplev.h" #include "tree-pass.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifndef ENABLE_LLVM #ifndef HAVE_conditional_execution #define HAVE_conditional_execution 0 #endif @@ -1965,6 +1967,8 @@ } } } +#endif +/* LLVM LOCAL end */ /* Duplicate the blocks containing computed gotos. This basically unfactors computed gotos that were factored early on in the compilation process to @@ -1978,10 +1982,11 @@ return (optimize > 0 && flag_expensive_optimizations && !optimize_size); } - static unsigned int duplicate_computed_gotos (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM basic_block bb, new_bb; bitmap candidates; int max_size; @@ -2083,6 +2088,8 @@ cfg_layout_finalize (); BITMAP_FREE (candidates); +#endif +/* LLVM LOCAL end */ return 0; } @@ -2104,6 +2111,8 @@ }; +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* This function is the main 'entrance' for the optimization that partitions hot and cold basic blocks into separate sections of the .o file (to improve performance and cache locality). Ideally it @@ -2193,6 +2202,8 @@ cfg_layout_finalize(); } +#endif +/* LLVM LOCAL end */ static bool gate_handle_reorder_blocks (void) @@ -2205,6 +2216,8 @@ static unsigned int rest_of_handle_reorder_blocks (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM bool changed; unsigned int liveness_flags; @@ -2235,6 +2248,8 @@ /* Add NOTE_INSN_SWITCH_TEXT_SECTIONS notes. */ insert_section_boundary_note (); +#endif +/* LLVM LOCAL end */ return 0; } @@ -2272,12 +2287,16 @@ static unsigned int rest_of_handle_partition_blocks (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM no_new_pseudos = 0; partition_hot_cold_basic_blocks (); allocate_reg_life_data (); update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES, PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES); no_new_pseudos = 1; +#endif +/* LLVM LOCAL end */ return 0; } Modified: llvm-gcc-4.2/trunk/gcc/bt-load.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/bt-load.c?rev=51616&r1=51615&r2=51616&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/bt-load.c (original) +++ llvm-gcc-4.2/trunk/gcc/bt-load.c Tue May 27 16:48:05 2008 @@ -38,6 +38,8 @@ #include "toplev.h" #include "tree-pass.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifndef ENABLE_LLVM /* Target register optimizations - these are performed after reload. */ typedef struct btr_def_group_s @@ -1492,6 +1494,8 @@ PROP_DEATH_NOTES | PROP_REG_INFO); } } +#endif +/* LLVM LOCAL end */ static bool gate_handle_branch_target_load_optimize (void) @@ -1503,12 +1507,9 @@ static unsigned int rest_of_handle_branch_target_load_optimize (void) { - static int warned = 0; /* LLVM LOCAL begin - reduce cc1 size. */ -#ifdef ENABLE_LLVM - return 0; -#endif -/* LLVM LOCAL end. */ +#ifndef ENABLE_LLVM + static int warned = 0; /* Leave this a warning for now so that it is possible to experiment with running this pass twice. In 3.6, we should either make this an error, or use separate dump files. */ @@ -1523,6 +1524,8 @@ } branch_target_load_optimize (epilogue_completed); +#endif +/* LLVM LOCAL end. */ return 0; } Modified: llvm-gcc-4.2/trunk/gcc/final.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/final.c?rev=51616&r1=51615&r2=51616&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/final.c (original) +++ llvm-gcc-4.2/trunk/gcc/final.c Tue May 27 16:48:05 2008 @@ -132,6 +132,8 @@ static rtx debug_insn; rtx current_output_insn; +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* Line number of last NOTE. */ static int last_linenum; @@ -146,7 +148,8 @@ /* Whether to force emission of a line note before the next insn. */ static bool force_source_line = false; - +#endif +/* LLVM LOCAL end */ extern const int length_unit_log; /* This is defined in insn-attrtab.c. */ /* Nonzero while outputting an `asm' with operands. @@ -157,10 +160,13 @@ /* Number of operands of this insn, for an `asm' with operands. */ static unsigned int insn_noperands; +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* Compare optimization flag. */ static rtx last_ignored_compare = 0; - +#endif +/* LLVM LOCAL end */ /* Assign a unique number to each insn that is output. This can be used to generate unique local labels. */ @@ -202,10 +208,13 @@ int frame_pointer_needed; +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen. */ static int block_depth; - +#endif +/* LLVM LOCAL end */ /* Nonzero if have enabled APP processing of our assembler output. */ static int app_on; @@ -229,12 +238,20 @@ #ifdef HAVE_ATTR_length static int asm_insn_count (rtx); #endif +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM static void profile_function (FILE *); static void profile_after_prologue (FILE *); static bool notice_source_line (rtx); +#endif +/* LLVM LOCAL end */ static rtx walk_alter_subreg (rtx *); static void output_asm_name (void); +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM static void output_alternate_entry_point (FILE *, rtx); +#endif +/* LLVM LOCAL end */ static tree get_mem_expr_from_op (rtx, int *); static void output_asm_operand_names (rtx *, int *, int); static void output_operand (rtx, int); @@ -244,9 +261,13 @@ #ifdef HAVE_cc0 static int alter_cond (rtx); #endif +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM #ifndef ADDR_VEC_ALIGN static int final_addr_vec_align (rtx); #endif +#endif +/* LLVM LOCAL end */ #ifdef HAVE_ATTR_length static int align_fuzz (rtx, rtx, int, unsigned); #endif @@ -541,6 +562,8 @@ #endif #ifndef ADDR_VEC_ALIGN +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM static int final_addr_vec_align (rtx addr_vec) { @@ -551,6 +574,8 @@ return exact_log2 (align); } +#endif +/* LLVM LOCAL end */ #define ADDR_VEC_ALIGN(ADDR_VEC) final_addr_vec_align (ADDR_VEC) #endif @@ -788,6 +813,8 @@ }; +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* Make a pass over all insns and compute their actual lengths by shortening any branches of variable length if possible. */ @@ -2535,6 +2562,8 @@ } return false; } +#endif +/* LLVM LOCAL end */ /* For each operand in INSN, simplify (subreg (reg)) so that it refers directly to the desired hard register. */ @@ -3932,6 +3961,8 @@ static unsigned int rest_of_handle_final (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM rtx x; const char *fnname; @@ -3987,6 +4018,8 @@ (*debug_hooks->function_decl) (current_function_decl); /* APPLE LOCAL end aaa */ timevar_pop (TV_SYMOUT); +#endif +/* LLVM LOCAL end */ return 0; } @@ -4011,8 +4044,12 @@ static unsigned int rest_of_handle_shorten_branches (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* Shorten branches. */ shorten_branches (get_insns ()); +#endif +/* LLVM LOCAL end */ return 0; } @@ -4037,6 +4074,8 @@ static unsigned int rest_of_clean_state (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM rtx insn, next; /* It is very important to decompose the RTL instruction chain here: @@ -4109,6 +4148,8 @@ /* We're done with this function. Free up memory if we can. */ free_after_parsing (cfun); free_after_compilation (cfun); +#endif +/* LLVM LOCAL end */ return 0; } Modified: llvm-gcc-4.2/trunk/gcc/flow.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/flow.c?rev=51616&r1=51615&r2=51616&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/flow.c (original) +++ llvm-gcc-4.2/trunk/gcc/flow.c Tue May 27 16:48:05 2008 @@ -4750,6 +4750,8 @@ static unsigned int rest_of_handle_flow2 (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* If optimizing, then go ahead and split insns now. */ #ifndef STACK_REGS if (optimize > 0) @@ -4767,6 +4769,8 @@ it and the rest of the code and also allows delayed branch scheduling to operate in the epilogue. */ thread_prologue_and_epilogue_insns (get_insns ()); +#endif +/* LLVM LOCAL end */ epilogue_completed = 1; flow2_completed = 1; return 0; Modified: llvm-gcc-4.2/trunk/gcc/haifa-sched.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/haifa-sched.c?rev=51616&r1=51615&r2=51616&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/haifa-sched.c (original) +++ llvm-gcc-4.2/trunk/gcc/haifa-sched.c Tue May 27 16:48:05 2008 @@ -146,7 +146,7 @@ #include "params.h" /* LLVM LOCAL begin comment out most of this file */ -#ifndef ENABLE_LLVM +#ifdef ENABLE_LLVM #undef INSN_SCHEDULING #endif /* LLVM LOCAL end */ From kledzik at apple.com Tue May 27 17:07:08 2008 From: kledzik at apple.com (Nick Kledzik) Date: Tue, 27 May 2008 22:07:08 -0000 Subject: [llvm-commits] [llvm] r51617 - /llvm/trunk/tools/lto2/LTOModule.cpp Message-ID: <200805272207.m4RM78Rl006964@zion.cs.uiuc.edu> Author: kledzik Date: Tue May 27 17:07:08 2008 New Revision: 51617 URL: http://llvm.org/viewvc/llvm-project?rev=51617&view=rev Log: fix infinite recursion if a global's initializer references the global Modified: llvm/trunk/tools/lto2/LTOModule.cpp Modified: llvm/trunk/tools/lto2/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOModule.cpp?rev=51617&r1=51616&r2=51617&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOModule.cpp (original) +++ llvm/trunk/tools/lto2/LTOModule.cpp Tue May 27 17:07:08 2008 @@ -161,7 +161,7 @@ addDefinedSymbol(v, mangler, false); // add external symbols referenced by this data. - for (unsigned count = 0, total = v->getNumOperands();\ + for (unsigned count = 0, total = v->getNumOperands(); count != total; ++count) { findExternalRefs(v->getOperand(count), mangler); } @@ -234,8 +234,13 @@ if (GlobalValue* gv = dyn_cast(value)) { if ( !gv->hasExternalLinkage() ) addPotentialUndefinedSymbol(gv, mangler); + // If this is a variable definition, do not recursively process + // initializer. It might contain a reference to this variable + // and cause an infinite loop. The initializer will be + // processed in addDefinedDataSymbol(). + return; } - + // GlobalValue, even with InternalLinkage type, may have operands with // ExternalLinkage type. Do not ignore these operands. if (Constant* c = dyn_cast(value)) { From clattner at apple.com Tue May 27 19:00:19 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 27 May 2008 17:00:19 -0700 Subject: [llvm-commits] [llvm] r51617 - /llvm/trunk/tools/lto2/LTOModule.cpp In-Reply-To: <200805272207.m4RM78Rl006964@zion.cs.uiuc.edu> References: <200805272207.m4RM78Rl006964@zion.cs.uiuc.edu> Message-ID: <9E6CCD77-2662-4068-B4F0-B68635BE69A9@apple.com> On May 27, 2008, at 3:07 PM, Nick Kledzik wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=51617&view=rev > Log: > fix infinite recursion if a global's initializer references the global Hey Nick, Please expand the tabs into spaces, thanks! -Chris > > > Modified: > llvm/trunk/tools/lto2/LTOModule.cpp > > Modified: llvm/trunk/tools/lto2/LTOModule.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOModule.cpp?rev=51617&r1=51616&r2=51617&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/tools/lto2/LTOModule.cpp (original) > +++ llvm/trunk/tools/lto2/LTOModule.cpp Tue May 27 17:07:08 2008 > @@ -161,7 +161,7 @@ > addDefinedSymbol(v, mangler, false); > > // add external symbols referenced by this data. > - for (unsigned count = 0, total = v->getNumOperands();\ > + for (unsigned count = 0, total = v->getNumOperands(); > count != total; + > +count) { > findExternalRefs(v->getOperand(count), mangler); > } > @@ -234,8 +234,13 @@ > if (GlobalValue* gv = dyn_cast(value)) { > if ( !gv->hasExternalLinkage() ) > addPotentialUndefinedSymbol(gv, mangler); > + // If this is a variable definition, do not recursively process > + // initializer. It might contain a reference to this variable > + // and cause an infinite loop. The initializer will be > + // processed in addDefinedDataSymbol(). > + return; > } > - > + > // GlobalValue, even with InternalLinkage type, may have > operands with > // ExternalLinkage type. Do not ignore these operands. > if (Constant* c = dyn_cast(value)) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From kledzik at apple.com Tue May 27 19:06:14 2008 From: kledzik at apple.com (Nick Kledzik) Date: Wed, 28 May 2008 00:06:14 -0000 Subject: [llvm-commits] [llvm] r51623 - /llvm/trunk/tools/lto2/LTOModule.cpp Message-ID: <200805280006.m4S06EuK010244@zion.cs.uiuc.edu> Author: kledzik Date: Tue May 27 19:06:14 2008 New Revision: 51623 URL: http://llvm.org/viewvc/llvm-project?rev=51623&view=rev Log: use space insted of tabs Modified: llvm/trunk/tools/lto2/LTOModule.cpp Modified: llvm/trunk/tools/lto2/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOModule.cpp?rev=51623&r1=51622&r2=51623&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOModule.cpp (original) +++ llvm/trunk/tools/lto2/LTOModule.cpp Tue May 27 19:06:14 2008 @@ -97,13 +97,13 @@ /// Also if next byte is on a different page, don't assume it is readable. MemoryBuffer* LTOModule::makeBuffer(const void* mem, size_t length) { - const char* startPtr = (char*)mem; - const char* endPtr = startPtr+length; - if ( (((uintptr_t)endPtr & (sys::Process::GetPageSize()-1)) == 0) - || (*endPtr != 0) ) - return MemoryBuffer::getMemBufferCopy(startPtr, endPtr); - else - return MemoryBuffer::getMemBuffer(startPtr, endPtr); + const char* startPtr = (char*)mem; + const char* endPtr = startPtr+length; + if ( (((uintptr_t)endPtr & (sys::Process::GetPageSize()-1)) == 0) + || (*endPtr != 0) ) + return MemoryBuffer::getMemBufferCopy(startPtr, endPtr); + else + return MemoryBuffer::getMemBuffer(startPtr, endPtr); } @@ -234,13 +234,13 @@ if (GlobalValue* gv = dyn_cast(value)) { if ( !gv->hasExternalLinkage() ) addPotentialUndefinedSymbol(gv, mangler); - // If this is a variable definition, do not recursively process - // initializer. It might contain a reference to this variable - // and cause an infinite loop. The initializer will be - // processed in addDefinedDataSymbol(). - return; + // If this is a variable definition, do not recursively process + // initializer. It might contain a reference to this variable + // and cause an infinite loop. The initializer will be + // processed in addDefinedDataSymbol(). + return; } - + // GlobalValue, even with InternalLinkage type, may have operands with // ExternalLinkage type. Do not ignore these operands. if (Constant* c = dyn_cast(value)) { From natebegeman at mac.com Tue May 27 19:24:25 2008 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 28 May 2008 00:24:25 -0000 Subject: [llvm-commits] [llvm] r51624 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200805280024.m4S0OQf1010744@zion.cs.uiuc.edu> Author: sampo Date: Tue May 27 19:24:25 2008 New Revision: 51624 URL: http://llvm.org/viewvc/llvm-project?rev=51624&view=rev Log: Don't attempt to create VZEXT_LOAD out of an extload. This an issue where the code generator would do something like this: f64 = load f32 , f32mem v2f64 = insertelt undef, %0, 0 v2f64 = insertelt %1, 0.0, 1 into v2f64 = vzext_load f32mem which on x86 is movsd, when you really wanted a cvtss2sd/movsd pair. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=51624&r1=51623&r2=51624&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue May 27 19:24:25 2008 @@ -6324,6 +6324,11 @@ // Transform it into VZEXT_LOAD addr. LoadSDNode *LD = cast(Base); + + // Load must not be an extload. + if (LD->getExtensionType() != ISD::NON_EXTLOAD) + return SDOperand(); + return DAG.getNode(X86ISD::VZEXT_LOAD, VT, LD->getChain(), LD->getBasePtr()); } From evan.cheng at apple.com Tue May 27 19:39:29 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 00:39:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51625 - /llvm-gcc-4.2/trunk/gcc/opts.c Message-ID: <200805280039.m4S0dTek011150@zion.cs.uiuc.edu> Author: evancheng Date: Tue May 27 19:39:29 2008 New Revision: 51625 URL: http://llvm.org/viewvc/llvm-project?rev=51625&view=rev Log: Disable a gcc hack which unset optimize_size when optimization level is -Os not -Oz for llvm. Modified: llvm-gcc-4.2/trunk/gcc/opts.c Modified: llvm-gcc-4.2/trunk/gcc/opts.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/opts.c?rev=51625&r1=51624&r2=51625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/opts.c (original) +++ llvm-gcc-4.2/trunk/gcc/opts.c Tue May 27 19:39:29 2008 @@ -779,8 +779,12 @@ flag_strict_aliasing = saved_flag_strict_aliasing; /* APPLE LOCAL end AV 3846092 */ /* APPLE LOCAL begin 4224227, 4231773 */ + /* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM if (!optimize_size_z) optimize_size = 0; +#endif + /* LLVM LOCAL end */ /* APPLE LOCAL end 4224227, 4231773 */ } From wangmp at apple.com Tue May 27 19:42:27 2008 From: wangmp at apple.com (Mon P Wang) Date: Wed, 28 May 2008 00:42:27 -0000 Subject: [llvm-commits] [llvm] r51626 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td Message-ID: <200805280042.m4S0gSpQ011245@zion.cs.uiuc.edu> Author: wangmp Date: Tue May 27 19:42:27 2008 New Revision: 51626 URL: http://llvm.org/viewvc/llvm-project?rev=51626&view=rev Log: Fixed X86 encoding error CVTPS2PD and CVTPD2PS when the source operand is a memory location Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=51626&r1=51625&r2=51626&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue May 27 19:42:27 2008 @@ -1531,7 +1531,7 @@ "cvtps2pd\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse2_cvtps2pd VR128:$src))]>, TB, Requires<[HasSSE2]>; -def Int_CVTPS2PDrm : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins f64mem:$src), +def Int_CVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), "cvtps2pd\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse2_cvtps2pd (load addr:$src)))]>, @@ -1540,7 +1540,7 @@ def Int_CVTPD2PSrr : PDI<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), "cvtpd2ps\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse2_cvtpd2ps VR128:$src))]>; -def Int_CVTPD2PSrm : PDI<0x5A, MRMSrcReg, (outs VR128:$dst), (ins f128mem:$src), +def Int_CVTPD2PSrm : PDI<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), "cvtpd2ps\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse2_cvtpd2ps (memop addr:$src)))]>; From evan.cheng at apple.com Tue May 27 19:54:38 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 00:54:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51627 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200805280054.m4S0sdvZ011563@zion.cs.uiuc.edu> Author: evancheng Date: Tue May 27 19:54:38 2008 New Revision: 51627 URL: http://llvm.org/viewvc/llvm-project?rev=51627&view=rev Log: For now, reduce inline-threshold to 50 and disable taildup when optimizing for size. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=51627&r1=51626&r2=51627&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue May 27 19:54:38 2008 @@ -130,7 +130,7 @@ Args.push_back("--debug-pass=Arguments"); if (optimize_size || flag_inline_trees == 1) // Reduce inline limit. Default limit is 200. - Args.push_back("--inline-threshold=100"); + Args.push_back("--inline-threshold=50"); if (flag_unwind_tables) Args.push_back("--unwind-tables"); @@ -357,7 +357,8 @@ PM->add(createFunctionInliningPass()); // Inline small functions if (optimize > 2) PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args - PM->add(createTailDuplicationPass()); // Simplify cfg by copying code + if (!optimize_size) + PM->add(createTailDuplicationPass()); // Simplify cfg by copying code if (!lang_hooks.flag_no_builtin()) PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations PM->add(createInstructionCombiningPass()); // Cleanup for scalarrepl. From dalej at apple.com Tue May 27 19:55:55 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 00:55:55 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51628 - /llvm-gcc-4.2/trunk/gcc/genattrtab.c Message-ID: <200805280055.m4S0ttD9011607@zion.cs.uiuc.edu> Author: johannes Date: Tue May 27 19:55:55 2008 New Revision: 51628 URL: http://llvm.org/viewvc/llvm-project?rev=51628&view=rev Log: Get rid of some generated functions (about half of insn-attrtab.c) that are no longer used by llvm. Modified: llvm-gcc-4.2/trunk/gcc/genattrtab.c Modified: llvm-gcc-4.2/trunk/gcc/genattrtab.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/genattrtab.c?rev=51628&r1=51627&r2=51628&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/genattrtab.c (original) +++ llvm-gcc-4.2/trunk/gcc/genattrtab.c Tue May 27 19:55:55 2008 @@ -272,11 +272,15 @@ static void write_attr_value (struct attr_desc *, rtx); static void write_upcase (const char *); static void write_indent (int); +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM static rtx identity_fn (rtx); static rtx zero_fn (rtx); static rtx one_fn (rtx); static rtx max_fn (rtx); static rtx min_fn (rtx); +#endif +/* LLVM LOCAL end */ #define oballoc(size) obstack_alloc (hash_obstack, size) @@ -1519,6 +1523,8 @@ static void make_length_attrs (void) { +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM static const char *new_names[] = { "*insn_default_length", @@ -1531,9 +1537,12 @@ static rtx (*const address_fn[]) (rtx) = {max_fn, min_fn, one_fn, identity_fn}; size_t i; - struct attr_desc *length_attr, *new_attr; + struct attr_desc *new_attr; struct attr_value *av, *new_av; struct insn_ent *ie, *new_ie; +#endif + struct attr_desc *length_attr; +/* LLVM LOCAL end */ /* See if length attribute is defined. If so, it must be numeric. Make it special so we don't output anything for it. */ @@ -1547,6 +1556,8 @@ length_attr->is_const = 0; length_attr->is_special = 1; +/* LLVM LOCAL begin we don't need these for llvm */ +#ifndef ENABLE_LLVM /* Make each new attribute, in turn. */ for (i = 0; i < ARRAY_SIZE (new_names); i++) { @@ -1567,8 +1578,12 @@ insert_insn_ent (new_av, new_ie); } } +#endif +/* LLVM LOCAL end */ } +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM /* Utility functions called from above routine. */ static rtx @@ -1602,6 +1617,8 @@ int unknown; return make_numeric_value (min_attr_value (exp, &unknown)); } +#endif +/* LLVM LOCAL end */ static void write_length_unit_log (void) @@ -4482,8 +4499,12 @@ } make_internal_attr ("*internal_dfa_insn_code", code_exp, ATTR_NONE); +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM make_internal_attr ("*insn_default_latency", lats_exp, ATTR_NONE); make_internal_attr ("*bypass_p", byps_exp, ATTR_NONE); +#endif +/* LLVM LOCAL end */ } int From evan.cheng at apple.com Tue May 27 19:59:30 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 00:59:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51629 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200805280059.m4S0xVfQ011708@zion.cs.uiuc.edu> Author: evancheng Date: Tue May 27 19:59:30 2008 New Revision: 51629 URL: http://llvm.org/viewvc/llvm-project?rev=51629&view=rev Log: Remove code that's commented out. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=51629&r1=51628&r2=51629&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue May 27 19:59:30 2008 @@ -328,7 +328,6 @@ else PerFunctionPasses->add(createScalarReplAggregatesPass()); PerFunctionPasses->add(createInstructionCombiningPass()); - // PerFunctionPasses->add(createCFGSimplificationPass()); } // FIXME: AT -O0/O1, we should stream out functions at a time. From gohman at apple.com Tue May 27 20:50:20 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 28 May 2008 01:50:20 -0000 Subject: [llvm-commits] [llvm] r51630 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td Message-ID: <200805280150.m4S1oKpi013052@zion.cs.uiuc.edu> Author: djg Date: Tue May 27 20:50:19 2008 New Revision: 51630 URL: http://llvm.org/viewvc/llvm-project?rev=51630&view=rev Log: Fix the encoding for two more "rm" instructions that were using MRMSrcReg. Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=51630&r1=51629&r2=51630&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue May 27 20:50:19 2008 @@ -2778,7 +2778,7 @@ (int_x86_ssse3_palign_r VR64:$src1, VR64:$src2, imm:$src3))]>; - def PALIGNR64rm : SS3AI<0x0F, MRMSrcReg, (outs VR64:$dst), + def PALIGNR64rm : SS3AI<0x0F, MRMSrcMem, (outs VR64:$dst), (ins VR64:$src1, i64mem:$src2, i16imm:$src3), "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", [(set VR64:$dst, @@ -2794,7 +2794,7 @@ (int_x86_ssse3_palign_r_128 VR128:$src1, VR128:$src2, imm:$src3))]>, OpSize; - def PALIGNR128rm : SS3AI<0x0F, MRMSrcReg, (outs VR128:$dst), + def PALIGNR128rm : SS3AI<0x0F, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2, i32imm:$src3), "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", [(set VR128:$dst, From sabre at nondot.org Tue May 27 22:59:33 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 03:59:33 -0000 Subject: [llvm-commits] [llvm] r51631 - /llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Message-ID: <200805280359.m4S3xXsa016370@zion.cs.uiuc.edu> Author: lattner Date: Tue May 27 22:59:32 2008 New Revision: 51631 URL: http://llvm.org/viewvc/llvm-project?rev=51631&view=rev Log: reindent. Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=51631&r1=51630&r2=51631&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Tue May 27 22:59:32 2008 @@ -26,101 +26,101 @@ IA64TargetLowering::IA64TargetLowering(TargetMachine &TM) : TargetLowering(TM) { - // register class for general registers - addRegisterClass(MVT::i64, IA64::GRRegisterClass); + // register class for general registers + addRegisterClass(MVT::i64, IA64::GRRegisterClass); - // register class for FP registers - addRegisterClass(MVT::f64, IA64::FPRegisterClass); + // register class for FP registers + addRegisterClass(MVT::f64, IA64::FPRegisterClass); - // register class for predicate registers - addRegisterClass(MVT::i1, IA64::PRRegisterClass); + // register class for predicate registers + addRegisterClass(MVT::i1, IA64::PRRegisterClass); - setLoadXAction(ISD::EXTLOAD , MVT::i1 , Promote); + setLoadXAction(ISD::EXTLOAD , MVT::i1 , Promote); - setLoadXAction(ISD::ZEXTLOAD , MVT::i1 , Promote); + setLoadXAction(ISD::ZEXTLOAD , MVT::i1 , Promote); - setLoadXAction(ISD::SEXTLOAD , MVT::i1 , Promote); - setLoadXAction(ISD::SEXTLOAD , MVT::i8 , Expand); - setLoadXAction(ISD::SEXTLOAD , MVT::i16 , Expand); - setLoadXAction(ISD::SEXTLOAD , MVT::i32 , Expand); + setLoadXAction(ISD::SEXTLOAD , MVT::i1 , Promote); + setLoadXAction(ISD::SEXTLOAD , MVT::i8 , Expand); + setLoadXAction(ISD::SEXTLOAD , MVT::i16 , Expand); + setLoadXAction(ISD::SEXTLOAD , MVT::i32 , Expand); - setOperationAction(ISD::BRIND , MVT::Other, Expand); - setOperationAction(ISD::BR_JT , MVT::Other, Expand); - setOperationAction(ISD::BR_CC , MVT::Other, Expand); - setOperationAction(ISD::FP_ROUND_INREG , MVT::f32 , Expand); + setOperationAction(ISD::BRIND , MVT::Other, Expand); + setOperationAction(ISD::BR_JT , MVT::Other, Expand); + setOperationAction(ISD::BR_CC , MVT::Other, Expand); + setOperationAction(ISD::FP_ROUND_INREG , MVT::f32 , Expand); - // ia64 uses SELECT not SELECT_CC - setOperationAction(ISD::SELECT_CC , MVT::Other, Expand); - - // We need to handle ISD::RET for void functions ourselves, - // so we get a chance to restore ar.pfs before adding a - // br.ret insn - setOperationAction(ISD::RET, MVT::Other, Custom); - - setShiftAmountType(MVT::i64); - - setOperationAction(ISD::FREM , MVT::f32 , Expand); - setOperationAction(ISD::FREM , MVT::f64 , Expand); - - setOperationAction(ISD::UREM , MVT::f32 , Expand); - setOperationAction(ISD::UREM , MVT::f64 , Expand); - - setOperationAction(ISD::MEMBARRIER , MVT::Other, Expand); - - setOperationAction(ISD::SINT_TO_FP , MVT::i1 , Promote); - setOperationAction(ISD::UINT_TO_FP , MVT::i1 , Promote); - - // We don't support sin/cos/sqrt/pow - setOperationAction(ISD::FSIN , MVT::f64, Expand); - setOperationAction(ISD::FCOS , MVT::f64, Expand); - setOperationAction(ISD::FSQRT, MVT::f64, Expand); - setOperationAction(ISD::FPOW , MVT::f64, Expand); - setOperationAction(ISD::FSIN , MVT::f32, Expand); - setOperationAction(ISD::FCOS , MVT::f32, Expand); - setOperationAction(ISD::FSQRT, MVT::f32, Expand); - setOperationAction(ISD::FPOW , MVT::f32, Expand); - - // FIXME: IA64 supports fcopysign natively! - setOperationAction(ISD::FCOPYSIGN, MVT::f64, Expand); - setOperationAction(ISD::FCOPYSIGN, MVT::f32, Expand); - - // We don't have line number support yet. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); - setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - setOperationAction(ISD::LABEL, MVT::Other, Expand); - - //IA64 has these, but they are not implemented - setOperationAction(ISD::CTTZ , MVT::i64 , Expand); - setOperationAction(ISD::CTLZ , MVT::i64 , Expand); - setOperationAction(ISD::ROTL , MVT::i64 , Expand); - setOperationAction(ISD::ROTR , MVT::i64 , Expand); - setOperationAction(ISD::BSWAP, MVT::i64 , Expand); // mux @rev - - // VASTART needs to be custom lowered to use the VarArgsFrameIndex - setOperationAction(ISD::VAARG , MVT::Other, Custom); - setOperationAction(ISD::VASTART , MVT::Other, Custom); - - // Use the default implementation. - setOperationAction(ISD::VACOPY , MVT::Other, Expand); - setOperationAction(ISD::VAEND , MVT::Other, Expand); - setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); - setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); - setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand); + // ia64 uses SELECT not SELECT_CC + setOperationAction(ISD::SELECT_CC , MVT::Other, Expand); + + // We need to handle ISD::RET for void functions ourselves, + // so we get a chance to restore ar.pfs before adding a + // br.ret insn + setOperationAction(ISD::RET, MVT::Other, Custom); + + setShiftAmountType(MVT::i64); + + setOperationAction(ISD::FREM , MVT::f32 , Expand); + setOperationAction(ISD::FREM , MVT::f64 , Expand); + + setOperationAction(ISD::UREM , MVT::f32 , Expand); + setOperationAction(ISD::UREM , MVT::f64 , Expand); + + setOperationAction(ISD::MEMBARRIER , MVT::Other, Expand); + + setOperationAction(ISD::SINT_TO_FP , MVT::i1 , Promote); + setOperationAction(ISD::UINT_TO_FP , MVT::i1 , Promote); + + // We don't support sin/cos/sqrt/pow + setOperationAction(ISD::FSIN , MVT::f64, Expand); + setOperationAction(ISD::FCOS , MVT::f64, Expand); + setOperationAction(ISD::FSQRT, MVT::f64, Expand); + setOperationAction(ISD::FPOW , MVT::f64, Expand); + setOperationAction(ISD::FSIN , MVT::f32, Expand); + setOperationAction(ISD::FCOS , MVT::f32, Expand); + setOperationAction(ISD::FSQRT, MVT::f32, Expand); + setOperationAction(ISD::FPOW , MVT::f32, Expand); + + // FIXME: IA64 supports fcopysign natively! + setOperationAction(ISD::FCOPYSIGN, MVT::f64, Expand); + setOperationAction(ISD::FCOPYSIGN, MVT::f32, Expand); + + // We don't have line number support yet. + setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); + setOperationAction(ISD::LABEL, MVT::Other, Expand); + + //IA64 has these, but they are not implemented + setOperationAction(ISD::CTTZ , MVT::i64 , Expand); + setOperationAction(ISD::CTLZ , MVT::i64 , Expand); + setOperationAction(ISD::ROTL , MVT::i64 , Expand); + setOperationAction(ISD::ROTR , MVT::i64 , Expand); + setOperationAction(ISD::BSWAP, MVT::i64 , Expand); // mux @rev + + // VASTART needs to be custom lowered to use the VarArgsFrameIndex + setOperationAction(ISD::VAARG , MVT::Other, Custom); + setOperationAction(ISD::VASTART , MVT::Other, Custom); + + // Use the default implementation. + setOperationAction(ISD::VACOPY , MVT::Other, Expand); + setOperationAction(ISD::VAEND , MVT::Other, Expand); + setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); + setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); + setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand); - // Thread Local Storage - setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom); + // Thread Local Storage + setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom); - setStackPointerRegisterToSaveRestore(IA64::r12); + setStackPointerRegisterToSaveRestore(IA64::r12); - setJumpBufSize(704); // on ia64-linux, jmp_bufs are 704 bytes.. - setJumpBufAlignment(16); // ...and must be 16-byte aligned - - computeRegisterProperties(); + setJumpBufSize(704); // on ia64-linux, jmp_bufs are 704 bytes.. + setJumpBufAlignment(16); // ...and must be 16-byte aligned + + computeRegisterProperties(); - addLegalFPImmediate(APFloat(+0.0)); - addLegalFPImmediate(APFloat(-0.0)); - addLegalFPImmediate(APFloat(+1.0)); - addLegalFPImmediate(APFloat(-1.0)); + addLegalFPImmediate(APFloat(+0.0)); + addLegalFPImmediate(APFloat(-0.0)); + addLegalFPImmediate(APFloat(+1.0)); + addLegalFPImmediate(APFloat(-1.0)); } const char *IA64TargetLowering::getTargetNodeName(unsigned Opcode) const { From sabre at nondot.org Tue May 27 23:00:07 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 04:00:07 -0000 Subject: [llvm-commits] [llvm] r51632 - /llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Message-ID: <200805280400.m4S407h7016400@zion.cs.uiuc.edu> Author: lattner Date: Tue May 27 23:00:06 2008 New Revision: 51632 URL: http://llvm.org/viewvc/llvm-project?rev=51632&view=rev Log: Fix 2006-04-28-Sign-extend-bool.ll for ia64. Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=51632&r1=51631&r2=51632&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Tue May 27 23:00:06 2008 @@ -80,6 +80,8 @@ setOperationAction(ISD::FSQRT, MVT::f32, Expand); setOperationAction(ISD::FPOW , MVT::f32, Expand); + setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1 , Expand); + // FIXME: IA64 supports fcopysign natively! setOperationAction(ISD::FCOPYSIGN, MVT::f64, Expand); setOperationAction(ISD::FCOPYSIGN, MVT::f32, Expand); From sabre at nondot.org Tue May 27 23:06:53 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 04:06:53 -0000 Subject: [llvm-commits] [llvm] r51633 - /llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Message-ID: <200805280406.m4S46rQJ016573@zion.cs.uiuc.edu> Author: lattner Date: Tue May 27 23:06:52 2008 New Revision: 51633 URL: http://llvm.org/viewvc/llvm-project?rev=51633&view=rev Log: loads should get chains. THis helps but does not solve CodeGen/Generic/2003-05-27-phifcmpd.ll on ia64. Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=51633&r1=51632&r2=51633&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Tue May 27 23:06:52 2008 @@ -348,7 +348,8 @@ // load the branch target's entry point [mem] and // GP value [mem+8] SDOperand targetEntryPoint= - SDOperand(CurDAG->getTargetNode(IA64::LD8, MVT::i64, FnDescriptor), 0); + SDOperand(CurDAG->getTargetNode(IA64::LD8, MVT::i64, MVT::Other, + FnDescriptor), 0); Chain = targetEntryPoint.getValue(1); SDOperand targetGPAddr= SDOperand(CurDAG->getTargetNode(IA64::ADDS, MVT::i64, @@ -356,7 +357,8 @@ CurDAG->getConstant(8, MVT::i64)), 0); Chain = targetGPAddr.getValue(1); SDOperand targetGP = - SDOperand(CurDAG->getTargetNode(IA64::LD8, MVT::i64, targetGPAddr), 0); + SDOperand(CurDAG->getTargetNode(IA64::LD8, MVT::i64,MVT::Other, + targetGPAddr), 0); Chain = targetGP.getValue(1); Chain = CurDAG->getCopyToReg(Chain, IA64::r1, targetGP, InFlag); From sabre at nondot.org Tue May 27 23:14:30 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 04:14:30 -0000 Subject: [llvm-commits] [llvm] r51634 - /llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Message-ID: <200805280414.m4S4EUIS016769@zion.cs.uiuc.edu> Author: lattner Date: Tue May 27 23:14:30 2008 New Revision: 51634 URL: http://llvm.org/viewvc/llvm-project?rev=51634&view=rev Log: Fix CodeGen/Generic/2005-10-21-longlonggtu.ll on ia64. Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=51634&r1=51633&r2=51634&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Tue May 27 23:14:30 2008 @@ -530,7 +530,8 @@ case MVT::f32: RetVal = DAG.getCopyFromReg(Chain, IA64::F8, MVT::f64, InFlag); Chain = RetVal.getValue(1); - RetVal = DAG.getNode(ISD::TRUNCATE, MVT::f32, RetVal); + RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal, + DAG.getIntPtrConstant(0)); break; case MVT::f64: RetVal = DAG.getCopyFromReg(Chain, IA64::F8, MVT::f64, InFlag); From sabre at nondot.org Tue May 27 23:25:58 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 04:25:58 -0000 Subject: [llvm-commits] [llvm] r51635 - /llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Message-ID: <200805280425.m4S4PwcH017046@zion.cs.uiuc.edu> Author: lattner Date: Tue May 27 23:25:57 2008 New Revision: 51635 URL: http://llvm.org/viewvc/llvm-project?rev=51635&view=rev Log: Add chain inputs for loads. Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=51635&r1=51634&r2=51635&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Tue May 27 23:25:57 2008 @@ -349,7 +349,7 @@ // GP value [mem+8] SDOperand targetEntryPoint= SDOperand(CurDAG->getTargetNode(IA64::LD8, MVT::i64, MVT::Other, - FnDescriptor), 0); + FnDescriptor, CurDAG->getEntryNode()), 0); Chain = targetEntryPoint.getValue(1); SDOperand targetGPAddr= SDOperand(CurDAG->getTargetNode(IA64::ADDS, MVT::i64, @@ -358,7 +358,7 @@ Chain = targetGPAddr.getValue(1); SDOperand targetGP = SDOperand(CurDAG->getTargetNode(IA64::LD8, MVT::i64,MVT::Other, - targetGPAddr), 0); + targetGPAddr, CurDAG->getEntryNode()), 0); Chain = targetGP.getValue(1); Chain = CurDAG->getCopyToReg(Chain, IA64::r1, targetGP, InFlag); @@ -446,7 +446,7 @@ SDOperand(CurDAG->getTargetNode(IA64::ADDL_GA, MVT::i64, CurDAG->getRegister(IA64::r1, MVT::i64), GA), 0); - return CurDAG->getTargetNode(IA64::LD8, MVT::i64, Tmp); + return CurDAG->getTargetNode(IA64::LD8, MVT::i64, MVT::Other, Tmp); } /* XXX From resistor at mac.com Wed May 28 00:04:03 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 28 May 2008 00:04:03 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200805280504.m4S543r9018278@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.27 -> 1.28 --- Log message: Add new posts. --- Diffs of the changes: (+3 -1) InTheNews.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.27 llvm-www/InTheNews.html:1.28 --- llvm-www/InTheNews.html:1.27 Sun Mar 30 13:34:17 2008 +++ llvm-www/InTheNews.html Wed May 28 00:03:21 2008 @@ -15,6 +15,8 @@
News Articles

2008

    +
  • 2008-05-23, InformIT, "How the LLVM Compiler Infrastructure Works", David Chisnall
  • +
  • 2008-05-23, evan.musing, "Simple VM JIT with LLVM", Evan Phoenix
  • 2008-03-08, The OCaml Journal, "Run-time compilation with LLVM", Jon Harrop
@@ -117,6 +119,6 @@ Valid HTML 4.01!
- Last modified: $Date: 2008/03/30 18:34:17 $ + Last modified: $Date: 2008/05/28 05:03:21 $ From sabre at nondot.org Wed May 28 00:30:42 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 05:30:42 -0000 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll Message-ID: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> Author: lattner Date: Wed May 28 00:30:41 2008 New Revision: 51636 URL: http://llvm.org/viewvc/llvm-project?rev=51636&view=rev Log: Implement PR2370: memmove(x,x,size) -> noop. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/memmove.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=51636&r1=51635&r2=51636&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed May 28 00:30:41 2008 @@ -9131,6 +9131,10 @@ CI.setOperand(0, Intrinsic::getDeclaration(M, MemCpyID)); Changed = true; } + + // memmove(x,x,size) -> noop. + if (MMI->getSource() == MMI->getDest()) + return EraseInstFromFunction(CI); } // If we can determine a pointer alignment that is bigger than currently Modified: llvm/trunk/test/Transforms/InstCombine/memmove.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memmove.ll?rev=51636&r1=51635&r2=51636&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/memmove.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/memmove.ll Wed May 28 00:30:41 2008 @@ -34,3 +34,9 @@ ret i32 0 } +; PR2370 +define void @test4(i8* %a) { + tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, i32 1 ) + ret void +} + From clattner at apple.com Wed May 28 00:38:30 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 27 May 2008 22:38:30 -0700 Subject: [llvm-commits] llvm-gcc aggregate copy Message-ID: After looking into PR2371, I tried out this C testcase with llvm-gcc to see what it is generating: struct foo { double x[100]; }; void T(struct foo *F, struct foo* G) { *F = *G; } llvm-gcc currently compiles this into: define void @T(%struct.foo* %F, %struct.foo* %G) nounwind { entry: %tmp2 = bitcast %struct.foo* %F to i8* ; [#uses=1] %tmp13 = bitcast %struct.foo* %G to i8* ; [#uses=1] tail call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 800, i32 4 ) ret void } The problem is that F/G can be the same pointer, so using memcpy is undefined. Should llvm-gcc start emitting llvm.memmove calls, or is there something with GCC trees that can be improved to know when memmove is needed? -Chirs From sabre at nondot.org Wed May 28 01:10:32 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 06:10:32 -0000 Subject: [llvm-commits] [test-suite] r51637 - /test-suite/trunk/MultiSource/Applications/ClamAV/Makefile Message-ID: <200805280610.m4S6AWEU020274@zion.cs.uiuc.edu> Author: lattner Date: Wed May 28 01:10:32 2008 New Revision: 51637 URL: http://llvm.org/viewvc/llvm-project?rev=51637&view=rev Log: Fix PR2215 Modified: test-suite/trunk/MultiSource/Applications/ClamAV/Makefile Modified: test-suite/trunk/MultiSource/Applications/ClamAV/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/ClamAV/Makefile?rev=51637&r1=51636&r2=51637&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Applications/ClamAV/Makefile (original) +++ test-suite/trunk/MultiSource/Applications/ClamAV/Makefile Wed May 28 01:10:32 2008 @@ -26,7 +26,7 @@ PROG = clamscan CPPFLAGS += -DHAVE_CONFIG_H -I. LDFLAGS = -lz -RUN_OPTIONS = --debug --verbose -d$(PROJ_SRC_DIR)/dbdir -r $(PROJ_SRC_DIR)/inputs/* +RUN_OPTIONS = --debug --exclude-dir .svn --verbose -d$(PROJ_SRC_DIR)/dbdir -r $(PROJ_SRC_DIR)/inputs/* include $(LEVEL)/Makefile.config From sabre at nondot.org Wed May 28 01:16:08 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 28 May 2008 06:16:08 -0000 Subject: [llvm-commits] [llvm] r51638 - /llvm/trunk/docs/tutorial/LangImpl3.html Message-ID: <200805280616.m4S6G85L020477@zion.cs.uiuc.edu> Author: lattner Date: Wed May 28 01:16:08 2008 New Revision: 51638 URL: http://llvm.org/viewvc/llvm-project?rev=51638&view=rev Log: Update text to point people at the right version of the tutorial for their release. Modified: llvm/trunk/docs/tutorial/LangImpl3.html Modified: llvm/trunk/docs/tutorial/LangImpl3.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.html?rev=51638&r1=51637&r2=51638&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl3.html (original) +++ llvm/trunk/docs/tutorial/LangImpl3.html Wed May 28 01:16:08 2008 @@ -48,7 +48,11 @@

Please note: the code in this chapter and later require LLVM 2.2 or -LLVM SVN to work. LLVM 2.1 and before will not work with it.

+later. LLVM 2.1 and before will not work with it. Also note that you need +to use a version of this tutorial that matches your LLVM release: If you are +using an official LLVM release, use the version of the documentation included +with your release or on the llvm.org +releases page.

From baldrick at free.fr Wed May 28 01:46:14 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 08:46:14 +0200 Subject: [llvm-commits] llvm-gcc aggregate copy In-Reply-To: References: Message-ID: <200805280846.14744.baldrick@free.fr> Hi Chris, I discussed this problem with Dale some time ago. Since gcc mainline produces exactly the same memcpy call, we decided not to worry about it. I do remember a gcc guy telling me once that aggregate assignment assumes no overlap, so maybe there is nothing to worry about... My personal feeling is that memmove should be used and llvm should change it to memcpy if it can deduce that it is safe. There is also the problem of small structs for which llvm-gcc produces a hand-made memcpy, i.e. a series of loads and stores. That would need to be turned into something that works for overlapping objects. One possibility (inefficient but works) is to compare the addresses of the two objects and copy in order of increasing address or decreasing address correspondingly. A better solution is perhaps to exploit the new aggregates-as-first-class-values work and treat small structs as registers. Ciao, Duncan. > After looking into PR2371, I tried out this C testcase with llvm-gcc > to see what it is generating: > > struct foo { double x[100]; }; > void T(struct foo *F, struct foo* G) { > *F = *G; > } > > llvm-gcc currently compiles this into: > > define void @T(%struct.foo* %F, %struct.foo* %G) nounwind { > entry: > %tmp2 = bitcast %struct.foo* %F to i8* ; [#uses=1] > %tmp13 = bitcast %struct.foo* %G to i8* ; [#uses=1] > tail call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 800, i32 > 4 ) > ret void > } > > The problem is that F/G can be the same pointer, so using memcpy is > undefined. Should llvm-gcc start emitting llvm.memmove calls, or is > there something with GCC trees that can be improved to know when > memmove is needed? From baldrick at free.fr Wed May 28 02:24:45 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 09:24:45 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> Message-ID: <200805280924.45245.baldrick@free.fr> Hi Evan, > Really honor -fno-inline-functions. > - if (flag_inline_trees) // respect -fno-inline-functions > + if (flag_inline_trees > 1) // respect -fno-inline-functions the gcc middle- and back-ends do not make this distinction. All the places that use flag_inline_trees only check whether it is non-zero or not! However language front-ends do play with it in order to set DECL_INLINE, for example in c-decl.c there is: else if (flag_inline_trees == 2 && initialized) DECL_INLINE (decl) = 1; While the Ada front-end does: DECL_INLINE (fndecl) = DECL_DECLARED_INLINE_P (fndecl) || flag_inline_trees == 2; On the other hand the Fortran front-end doesn't do anything. I think the right thing to look at is DECL_INLINE, and only inline functions with the DECL_INLINE flag set. What do you think? Ciao, Duncan. From nicolas.geoffray at lip6.fr Wed May 28 04:42:31 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 28 May 2008 09:42:31 -0000 Subject: [llvm-commits] [vmkit] r51639 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaArray.cpp JavaArray.h JavaInitialise.cpp JavaIsolate.cpp LockedMap.h VirtualTables.cpp Message-ID: <200805280942.m4S9gWPo003413@zion.cs.uiuc.edu> Author: geoffray Date: Wed May 28 04:42:30 2008 New Revision: 51639 URL: http://llvm.org/viewvc/llvm-project?rev=51639&view=rev Log: Do not trace UTF8 objects. Allocate UTF8 objects with malloc instead of GC. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp?rev=51639&r1=51638&r2=51639&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp Wed May 28 04:42:30 2008 @@ -252,3 +252,15 @@ buf[size] = 0; return buf; } + +const UTF8* UTF8::acons(sint32 n, ClassArray* cl, Jnjvm* vm) { + if (n < 0) + negativeArraySizeException(n); + else if (n > JavaArray::MaxArraySize) + outOfMemoryError(n); + UTF8* res = (UTF8*) malloc(sizeof(UTF8) + n * sizeof(uint16)); + ((void**)res)[0] = ArrayUInt16::VT; + res->initialise(cl); + res->size = n; + return (const UTF8*)res; +} Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h?rev=51639&r1=51638&r2=51639&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h Wed May 28 04:42:30 2008 @@ -81,7 +81,8 @@ class UTF8 : public ArrayUInt16 { public: - static VirtualTable* VT; + + static const UTF8* acons(sint32 n, ClassArray* cl, Jnjvm* vm); const UTF8* internalToJava(Jnjvm *vm, unsigned int start, unsigned int len) const; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=51639&r1=51638&r2=51639&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp Wed May 28 04:42:30 2008 @@ -56,7 +56,6 @@ INIT(Reader); INIT(ZipFile); INIT(ZipArchive); - INIT(UTF8Map); INIT(ClassMap); INIT(ZipFileMap); INIT(StringMap); @@ -84,7 +83,6 @@ INIT(ArrayFloat); INIT(ArrayDouble); INIT(ArrayObject); - INIT(UTF8); #undef INIT } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=51639&r1=51638&r2=51639&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Wed May 28 04:42:30 2008 @@ -463,7 +463,7 @@ isolate->javavmEnv = &JNI_JavaVMTable; // We copy so that bootstrap utf8 such as "" are unique - isolate->hashUTF8 = vm_new(isolate, UTF8Map)(); + isolate->hashUTF8 = new UTF8Map(); bootstrapVM->hashUTF8->copy(isolate->hashUTF8); isolate->hashStr = vm_new(isolate, StringMap)(); isolate->bootstrapClasses = callingVM->bootstrapClasses; @@ -516,7 +516,7 @@ isolate->name = "bootstrapVM"; isolate->appClassLoader = 0; - isolate->hashUTF8 = vm_new(isolate, UTF8Map)(); + isolate->hashUTF8 = new UTF8Map(); isolate->hashStr = vm_new(isolate, StringMap)(); isolate->bootstrapClasses = vm_new(isolate, ClassMap)(); isolate->jniEnv = &JNI_JNIEnvTable; Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=51639&r1=51638&r2=51639&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Wed May 28 04:42:30 2008 @@ -101,25 +101,18 @@ }; -class UTF8Map : public mvm::Object { +class UTF8Map { public: typedef std::multimap::iterator iterator; mvm::Lock* lock; std::multimap, gc_allocator< std::pair > > map; - static VirtualTable* VT; const UTF8* lookupOrCreateAsciiz(Jnjvm* vm, const char* asciiz); const UTF8* lookupOrCreateReader(Jnjvm* vm, const uint16* buf, uint32 size); const UTF8* lookupAsciiz(const char* asciiz); const UTF8* lookupReader(const uint16* buf, uint32 size); - virtual void TRACER; - - virtual void print(mvm::PrintBuffer* buf) { - buf->write("UTF8 Hashtable<>"); - } - UTF8Map() { lock = mvm::Lock::allocNormal(); } Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp?rev=51639&r1=51638&r2=51639&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Wed May 28 04:42:30 2008 @@ -41,7 +41,6 @@ INIT(ArrayFloat); INIT(ArrayDouble); INIT(ArrayObject); - INIT(UTF8); INIT(CommonClass); INIT(Class); INIT(ClassArray); @@ -55,7 +54,6 @@ INIT(Reader); INIT(ZipFile); INIT(ZipArchive); - INIT(UTF8Map); INIT(ClassMap); INIT(ZipFileMap); INIT(StringMap); @@ -185,7 +183,6 @@ void Jnjvm::TRACER { appClassLoader->MARK_AND_TRACE; - hashUTF8->MARK_AND_TRACE; hashStr->MARK_AND_TRACE; bootstrapClasses->MARK_AND_TRACE; javaTypes->MARK_AND_TRACE; @@ -216,12 +213,6 @@ void JavaString::TRACER { } -void UTF8Map::TRACER { - for (iterator i = map.begin(), e = map.end(); i!= e; ++i) { - i->second->MARK_AND_TRACE; - } -} - void ClassMap::TRACER { for (iterator i = map.begin(), e = map.end(); i!= e; ++i) { i->second->MARK_AND_TRACE; From eli.friedman at gmail.com Wed May 28 05:22:41 2008 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 28 May 2008 03:22:41 -0700 Subject: [llvm-commits] llvm-gcc aggregate copy In-Reply-To: <200805280846.14744.baldrick@free.fr> References: <200805280846.14744.baldrick@free.fr> Message-ID: On Tue, May 27, 2008 at 11:46 PM, Duncan Sands wrote: > Hi Chris, I discussed this problem with Dale some time ago. > Since gcc mainline produces exactly the same memcpy call, we > decided not to worry about it. I do remember a gcc guy telling > me once that aggregate assignment assumes no overlap, so maybe > there is nothing to worry about... Hmm, just found it: C99 6.5.16.1p4, about the simple assignment operator: "If the value being stored in an object is read from another object that overlaps in any way the storage of the first object, then the overlap shall be exact and the two objects shall have qualified or unqualified versions of a compatible type; otherwise, the behavior is undefined." (C++ 5.17p8 is almost exactly the same.) So at least for C/C++, we are allowed by the standard to use a memcpy-like implementation for struct assignment (but not actually memcpy, unless we can make some sort of non-standard guarantee about the implementation). > My personal feeling is that > memmove should be used and llvm should change it to memcpy if > it can deduce that it is safe. There is also the problem of > small structs for which llvm-gcc produces a hand-made memcpy, > i.e. a series of loads and stores. That would need to be turned > into something that works for overlapping objects. One possibility > (inefficient but works) is to compare the addresses of the two > objects and copy in order of increasing address or decreasing address > correspondingly. A better solution is perhaps to exploit the new > aggregates-as-first-class-values work and treat small structs as > registers. No matter what we do, memmove is fundamentally more expensive than memcpy because it requires either an branch, some extra conditional arithmetic, or a bunch of free space in registers. We could add another intrinsic, llvm.struct.copy, which is memcpy that allows equal pointers. It would lower to an inline copy for small copies, and a branch over a call to memcpy for larger ones. That's kind of messy, though. -Eli From baldrick at free.fr Wed May 28 08:11:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 13:11:32 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51640 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h tree-inline.c Message-ID: <200805281311.m4SDBWaA009267@zion.cs.uiuc.edu> Author: baldrick Date: Wed May 28 08:11:30 2008 New Revision: 51640 URL: http://llvm.org/viewvc/llvm-project?rev=51640&view=rev Log: Fix the handling of multiply defined gimple temporaries. The current code assumes that if a temporary has a second definition then that definition will be seen before any uses of it. But since we don't output basic blocks in any particular order there is no reason why this should be true. The obvious solution is to not special case gimple temporaries, but this results in a 30% increase in the bitcode size at -O0. Instead, uniquify the value used as the first definition of a gimple temp, and fix up its uses if a second definition is seen. Since this still gives a 4% increase in the size of the bitcode at -O0, I've added some logic to un-uniquify values once the function is emitted. With this change both bitcode size at -O0 and compile time at -O1 do not increase significantly. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h llvm-gcc-4.2/trunk/gcc/tree-inline.c Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=51640&r1=51639&r2=51640&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed May 28 08:11:30 2008 @@ -843,6 +843,17 @@ // may be deleted when the optimizers run, so would be dangerous to keep. eraseLocalLLVMValues(); + // Simplify any values that were uniqued using a no-op bitcast. + for (std::vector::iterator I = UniquedValues.begin(), + E = UniquedValues.end(); I != E; ++I) { + BitCastInst *BI = *I; + assert(BI->getSrcTy() == BI->getDestTy() && "Not a no-op bitcast!"); + BI->replaceAllUsesWith(BI->getOperand(0)); + // Safe to erase because after the call to eraseLocalLLVMValues. + BI->eraseFromParent(); + } + UniquedValues.clear(); + return Fn; } @@ -2734,19 +2745,18 @@ return 0; } -/// HandleMultiplyDefinedGCCTemp - GCC temporaries are *mostly* single -/// definition, and always have all uses dominated by the definition. In cases -/// where the temporary has multiple uses, we will first see the initial -/// definition, some uses of that definition, then subsequently see another -/// definition with uses of this second definition. +/// HandleMultiplyDefinedGimpleTemporary - Gimple temporaries *mostly* have a +/// single definition, in which case all uses are dominated by the definition. +/// This routine exists to handle the rare case of a gimple temporary with +/// multiple definitions. It turns the temporary into an ordinary automatic +/// variable by creating an alloca for it, initializing the alloca with the +/// first definition that was seen, and fixing up any existing uses to load +/// the alloca instead. /// -/// Because LLVM temporaries *must* be single definition, when we see the second -/// definition, we actually change the temporary to mark it as not being a GCC -/// temporary anymore. We then create an alloca for it, initialize it with the -/// first value seen, then treat it as a normal variable definition. -/// -void TreeToLLVM::HandleMultiplyDefinedGCCTemp(tree Var) { - Value *FirstVal = DECL_LLVM(Var); +void TreeToLLVM::HandleMultiplyDefinedGimpleTemporary(tree Var) { + Value *UniqVal = DECL_LLVM(Var); + assert(isa(UniqVal) && "Invalid value for gimple temporary!"); + Value *FirstVal = cast(UniqVal)->getOperand(0); // Create a new temporary and set the VAR_DECL to use it as the llvm location. Value *NewTmp = CreateTemporary(FirstVal->getType()); @@ -2756,11 +2766,11 @@ // being stored is an instruction, emit the store right after the instruction, // otherwise, emit it into the entry block. StoreInst *SI = new StoreInst(FirstVal, NewTmp); - + BasicBlock::iterator InsertPt; if (Instruction *I = dyn_cast(FirstVal)) { InsertPt = I; // Insert after the init instruction. - + // If the instruction is an alloca in the entry block, the insert point // will be before the alloca. Advance to the AllocaInsertionPoint if we are // before it. @@ -2774,7 +2784,7 @@ } } } - + // If the instruction is an invoke, the init is inserted on the normal edge. if (InvokeInst *II = dyn_cast(I)) { InsertPt = II->getNormalDest()->begin(); @@ -2788,7 +2798,12 @@ } BasicBlock *BB = InsertPt->getParent(); BB->getInstList().insert(InsertPt, SI); - + + // Replace any uses of the original value with a load of the alloca. + for (Value::use_iterator U = UniqVal->use_begin(), E = UniqVal->use_end(); + U != E; ++U) + U.getUse().set(new LoadInst(NewTmp, "mtmp", cast(*U))); + // Finally, This is no longer a GCC temporary. DECL_GIMPLE_FORMAL_TEMP_P(Var) = 0; } @@ -2806,13 +2821,22 @@ if (isGimpleTemporary(lhs)) { // If DECL_LLVM is already set, this is a multiply defined gimple temporary. if (DECL_LLVM_SET_P(lhs)) { - HandleMultiplyDefinedGCCTemp(lhs); + HandleMultiplyDefinedGimpleTemporary(lhs); return EmitMODIFY_EXPR(exp, DestLoc); } Value *RHS = Emit(rhs, 0); - RHS = CastToAnyType(RHS, RHSSigned, ConvertType(TREE_TYPE(lhs)), LHSSigned); - SET_DECL_LLVM(lhs, RHS); - return RHS; + const Type *LHSTy = ConvertType(TREE_TYPE(lhs)); + // The value may need to be replaced later if this temporary is multiply + // defined - ensure it can be uniquely identified by not folding the cast. + Instruction::CastOps opc = CastInst::getCastOpcode(RHS, RHSSigned, + LHSTy, LHSSigned); + CastInst *Cast = CastInst::Create(opc, RHS, LHSTy, RHS->getNameStart()); + if (opc == Instruction::BitCast && RHS->getType() == LHSTy) + // Simplify this no-op bitcast once the function is emitted. + UniquedValues.push_back(cast(Cast)); + Builder.Insert(Cast); + SET_DECL_LLVM(lhs, Cast); + return Cast; } else if (TREE_CODE(lhs) == VAR_DECL && DECL_REGISTER(lhs) && TREE_STATIC(lhs)) { // If this is a store to a register variable, EmitLV can't handle the dest Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=51640&r1=51639&r2=51640&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Wed May 28 08:11:30 2008 @@ -285,6 +285,10 @@ // and managed by CreateTemporary. Instruction *AllocaInsertionPoint; + /// UniquedValues - Values defined using a no-op bitcast in order to make them + /// unique. These can be simplified once the function has been emitted. + std::vector UniquedValues; + //===---------------------- Exception Handling --------------------------===// /// LandingPads - The landing pad for a given EH region. @@ -448,7 +452,7 @@ /// static bool isNoopCast(Value *V, const Type *Ty); - void HandleMultiplyDefinedGCCTemp(tree_node *var); + void HandleMultiplyDefinedGimpleTemporary(tree_node *var); /// EmitAnnotateIntrinsic - Emits call to annotate attr intrinsic void EmitAnnotateIntrinsic(Value *V, tree_node *decl); Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-inline.c?rev=51640&r1=51639&r2=51640&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree-inline.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree-inline.c Wed May 28 08:11:30 2008 @@ -1261,16 +1261,6 @@ { var = modify_dest; use = NULL; - - /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM - /* The return node can suddenly become multiple assignment. Because of this - * conservatively don't consider this thing for SSA form anymore. - */ - if (TREE_CODE (var) == VAR_DECL) - DECL_GIMPLE_FORMAL_TEMP_P (var) = 0; -#endif - /* LLVM LOCAL end */ goto done; } } From nicolas.geoffray at lip6.fr Wed May 28 08:32:42 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 28 May 2008 13:32:42 -0000 Subject: [llvm-commits] [vmkit] r51641 - /vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Message-ID: <200805281332.m4SDWgmf009844@zion.cs.uiuc.edu> Author: geoffray Date: Wed May 28 08:32:41 2008 New Revision: 51641 URL: http://llvm.org/viewvc/llvm-project?rev=51641&view=rev Log: An UTF8 map does not allocate entries with the GC. Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=51641&r1=51640&r2=51641&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Wed May 28 08:32:41 2008 @@ -106,8 +106,7 @@ typedef std::multimap::iterator iterator; mvm::Lock* lock; - std::multimap, - gc_allocator< std::pair > > map; + std::multimap map; const UTF8* lookupOrCreateAsciiz(Jnjvm* vm, const char* asciiz); const UTF8* lookupOrCreateReader(Jnjvm* vm, const uint16* buf, uint32 size); const UTF8* lookupAsciiz(const char* asciiz); From nicolas.geoffray at lip6.fr Wed May 28 09:56:42 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 28 May 2008 14:56:42 -0000 Subject: [llvm-commits] [vmkit] r51642 - /vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp Message-ID: <200805281456.m4SEuhuY012533@zion.cs.uiuc.edu> Author: geoffray Date: Wed May 28 09:56:42 2008 New Revision: 51642 URL: http://llvm.org/viewvc/llvm-project?rev=51642&view=rev Log: Create a hashed UTF8 to create the string object. Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp?rev=51642&r1=51641&r2=51642&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp Wed May 28 09:56:42 2008 @@ -43,12 +43,15 @@ sint32 lgLib = strLib->count; sint32 lgPre = vm->prelib->size; sint32 lgPost = vm->postlib->size; + + uint32 size = (uint32)(lgPre + lgLib + lgPost); + uint16* elements = (uint16*)alloca(size * sizeof(uint16)); - UTF8* res = (UTF8*)UTF8::acons(lgPre + lgLib + lgPost, JavaArray::ofChar, vm); - - memmove(res->elements, vm->prelib->elements, lgPre * sizeof(uint16)); - memmove(&(res->elements[lgPre]), &(utf8Lib->elements[stLib]), lgLib * sizeof(uint16)); - memmove(&(res->elements[lgPre + lgLib]), vm->postlib->elements, lgPost * sizeof(uint16)); + memmove(elements, vm->prelib->elements, lgPre * sizeof(uint16)); + memmove(&(elements[lgPre]), &(utf8Lib->elements[stLib]), lgLib * sizeof(uint16)); + memmove(&(elements[lgPre + lgLib]), vm->postlib->elements, lgPost * sizeof(uint16)); + + const UTF8* res = vm->readerConstructUTF8(elements, size); return (jobject)(vm->UTF8ToStr(res)); From nicolas.geoffray at lip6.fr Wed May 28 09:59:32 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 28 May 2008 14:59:32 -0000 Subject: [llvm-commits] [vmkit] r51643 - in /vmkit/trunk/lib: JnJVM/VMCore/JavaClass.h JnJVM/VMCore/JavaInitialise.cpp JnJVM/VMCore/JavaIsolate.cpp JnJVM/VMCore/JavaTypes.cpp JnJVM/VMCore/JavaTypes.h JnJVM/VMCore/JnjvmModule.cpp JnJVM/VMCore/LockedMap.h JnJVM/VMCore/VirtualTables.cpp Mvm/MvmMemoryManager.cpp Message-ID: <200805281459.m4SExWOc012619@zion.cs.uiuc.edu> Author: geoffray Date: Wed May 28 09:59:31 2008 New Revision: 51643 URL: http://llvm.org/viewvc/llvm-project?rev=51643&view=rev Log: Make code objects root objects for now. Typedef, Signdef and TypeMap objects are not GC allocated anymore. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Wed May 28 09:59:31 2008 @@ -279,8 +279,6 @@ unsigned int minor; unsigned int major; ArrayUInt8* bytes; - mvm::Code* codeVirtualTracer; - mvm::Code* codeStaticTracer; JavaCtpInfo* ctpInfo; std::vector attributs; std::vector innerClasses; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp Wed May 28 09:59:31 2008 @@ -50,8 +50,6 @@ INIT(LockObj); INIT(JavaObject); INIT(JavaThread); - INIT(Typedef); - INIT(Signdef); INIT(Jnjvm); INIT(Reader); INIT(ZipFile); @@ -59,7 +57,6 @@ INIT(ClassMap); INIT(ZipFileMap); INIT(StringMap); - INIT(jnjvm::TypeMap); INIT(JavaIsolate); INIT(JavaString); #ifdef SERVICE_VM Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Wed May 28 09:59:31 2008 @@ -467,7 +467,7 @@ bootstrapVM->hashUTF8->copy(isolate->hashUTF8); isolate->hashStr = vm_new(isolate, StringMap)(); isolate->bootstrapClasses = callingVM->bootstrapClasses; - isolate->javaTypes = vm_new(isolate, TypeMap)(); + isolate->javaTypes = new TypeMap(); isolate->globalRefsLock = mvm::Lock::allocNormal(); #ifdef MULTIPLE_VM isolate->statics = vm_new(isolate, StaticInstanceMap)(); @@ -522,7 +522,7 @@ isolate->jniEnv = &JNI_JNIEnvTable; isolate->javavmEnv = &JNI_JavaVMTable; isolate->globalRefsLock = mvm::Lock::allocNormal(); - isolate->javaTypes = vm_new(isolate, TypeMap)(); + isolate->javaTypes = new TypeMap(); #ifdef MULTIPLE_VM isolate->statics = vm_new(isolate, StaticInstanceMap)(); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Wed May 28 09:59:31 2008 @@ -401,10 +401,12 @@ } } -void Typedef::print(mvm::PrintBuffer* buf) const { +const char* Typedef::printString() const { + mvm::PrintBuffer *buf= mvm::PrintBuffer::alloc(); buf->write("Type<"); tPrintBuf(buf); buf->write(">"); + return buf->contents()->cString(); } CommonClass* Typedef::assocClass(JavaObject* loader) { @@ -429,12 +431,14 @@ buf->write(")"); } -void Signdef::print(mvm::PrintBuffer* buf) const { +const char* Signdef::printString() const { + mvm::PrintBuffer *buf= mvm::PrintBuffer::alloc(); buf->write("Signature<"); ret->tPrintBuf(buf); buf->write("..."); Typedef::humanPrintArgs(&args, buf); buf->write(">"); + return buf->contents()->cString(); } void Signdef::printWithSign(CommonClass* cl, const UTF8* name, @@ -473,7 +477,7 @@ typeError(name, 0); } - Signdef* res = vm_new(vm, Signdef)(); + Signdef* res = new Signdef(); res->args = buf; res->ret = vm->constructType(name->extract(vm, pos, pred)); res->isolate = vm; @@ -496,7 +500,7 @@ if (funcs == AssessorDesc::dParg) { return Signdef::signDup(name, vm); } else { - Typedef* res = vm_new(vm, Typedef)(); + Typedef* res = new Typedef(); res->isolate = vm; res->keyName = name; res->funcs = funcs; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Wed May 28 09:59:31 2008 @@ -122,16 +122,14 @@ }; -class Typedef : public mvm::Object { +class Typedef { public: - static VirtualTable *VT; const UTF8* keyName; const UTF8* pseudoAssocClassName; const AssessorDesc* funcs; Jnjvm* isolate; - virtual void print(mvm::PrintBuffer* buf) const; - virtual void TRACER; + const char* printString() const; CommonClass* assocClass(JavaObject* loader); void typePrint(mvm::PrintBuffer* buf); @@ -154,12 +152,10 @@ void* virtualCallAP(); public: - static VirtualTable *VT; std::vector args; Typedef* ret; - virtual void print(mvm::PrintBuffer* buf) const; - virtual void TRACER; + const char* printString() const; void printWithSign(CommonClass* cl, const UTF8* name, mvm::PrintBuffer* buf); static Signdef* signDup(const UTF8* name, Jnjvm* vm); Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Wed May 28 09:59:31 2008 @@ -299,10 +299,8 @@ if (!stat) { LCI->virtualTracerFunction = func; - cl->codeVirtualTracer = mvm::Code::getCodeFromPointer(codePtr); } else { LCI->staticTracerFunction = func; - cl->codeStaticTracer = mvm::Code::getCodeFromPointer(codePtr); } #endif return res; Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Wed May 28 09:59:31 2008 @@ -170,22 +170,31 @@ virtual void TRACER; }; -class TypeMap : - public LockedMap { +class TypeMap { public: - static VirtualTable* VT; + mvm::Lock* lock; + + std::map map; + typedef std::map::iterator iterator; - inline Typedef* lookupOrCreate(const UTF8*& V, Jnjvm *vm, funcCreate func) { - assert(0); - return 0; + inline Typedef* lookup(const UTF8* V) { + lock->lock(); + iterator End = map.end(); + iterator I = map.find(V); + lock->unlock(); + return I != End ? I->second : 0; + } + + inline void hash(const UTF8* k, Typedef* c) { + lock->lock(); + map.insert(std::make_pair(k, c)); + lock->unlock(); } TypeMap() { lock = mvm::Lock::allocRecursive(); } - virtual void TRACER; - }; class StaticInstanceMap : Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Wed May 28 09:59:31 2008 @@ -48,8 +48,6 @@ INIT(LockObj); INIT(JavaObject); INIT(JavaThread); - INIT(Typedef); - INIT(Signdef); INIT(Jnjvm); INIT(Reader); INIT(ZipFile); @@ -57,7 +55,6 @@ INIT(ClassMap); INIT(ZipFileMap); INIT(StringMap); - INIT(TypeMap); INIT(StaticInstanceMap); INIT(JavaIsolate); INIT(JavaString); @@ -111,19 +108,6 @@ #ifndef MULTIPLE_VM delegatee->MARK_AND_TRACE; #endif - - for (method_iterator i = staticMethods.begin(), e = staticMethods.end(); - i!= e; ++i) { - mvm::Code* c = i->second->code; - if (c) c->MARK_AND_TRACE; - } - - for (method_iterator i = virtualMethods.begin(), e = virtualMethods.end(); - i!= e; ++i) { - mvm::Code* c = i->second->code; - if (c) c->MARK_AND_TRACE; - } - } void Class::TRACER { @@ -132,8 +116,6 @@ #ifndef MULTIPLE_VM _staticInstance->MARK_AND_TRACE; #endif - codeStaticTracer->MARK_AND_TRACE; - codeVirtualTracer->MARK_AND_TRACE; } void ClassArray::TRACER { @@ -171,21 +153,10 @@ if (pendingException) pendingException->MARK_AND_TRACE; } -void Typedef::TRACER { -} - -void Signdef::TRACER { - _staticCallBuf->MARK_AND_TRACE; - _virtualCallBuf->MARK_AND_TRACE; - _staticCallAP->MARK_AND_TRACE; - _virtualCallAP->MARK_AND_TRACE; -} - void Jnjvm::TRACER { appClassLoader->MARK_AND_TRACE; hashStr->MARK_AND_TRACE; bootstrapClasses->MARK_AND_TRACE; - javaTypes->MARK_AND_TRACE; TRACE_VECTOR(JavaObject*, gc_allocator, globalRefs); #ifdef MULTIPLE_VM statics->MARK_AND_TRACE; @@ -231,12 +202,6 @@ } } -void TypeMap::TRACER { - for (iterator i = map.begin(), e = map.end(); i!= e; ++i) { - i->second->MARK_AND_TRACE; - } -} - void StaticInstanceMap::TRACER { for (iterator i = map.begin(), e = map.end(); i!= e; ++i) { i->second->second->MARK_AND_TRACE; Modified: vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp?rev=51643&r1=51642&r2=51643&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp (original) +++ vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp Wed May 28 09:59:31 2008 @@ -32,6 +32,7 @@ meth->llvmFunction = F; res->method(meth); currentMethod = meth; + Object::pushRoot(meth); return (unsigned char*)((unsigned int*)res + 2); } From baldrick at free.fr Wed May 28 10:31:21 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 17:31:21 +0200 Subject: [llvm-commits] llvm-gcc aggregate copy In-Reply-To: References: <200805280846.14744.baldrick@free.fr> Message-ID: <200805281731.22082.baldrick@free.fr> A more sophisticated example: struct A { int a[1024]; }; struct B { int x; struct A y; }; union C { struct A x; struct B y; }; void g(struct A* a, struct A* b) { *a = *b; } union C u; main(void) { g(&u.x, &u.y.y); } Ciao, Duncan. From dalej at apple.com Wed May 28 11:18:18 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 09:18:18 -0700 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll In-Reply-To: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> Message-ID: volatile? On May 27, 2008, at 10:30 PM, Chris Lattner wrote: > Author: lattner > Date: Wed May 28 00:30:41 2008 > New Revision: 51636 > > URL: http://llvm.org/viewvc/llvm-project?rev=51636&view=rev > Log: > Implement PR2370: memmove(x,x,size) -> noop. > > > Modified: > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > llvm/trunk/test/Transforms/InstCombine/memmove.ll > > Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=51636&r1=51635&r2=51636&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed > May 28 00:30:41 2008 > @@ -9131,6 +9131,10 @@ > CI.setOperand(0, Intrinsic::getDeclaration(M, MemCpyID)); > Changed = true; > } > + > + // memmove(x,x,size) -> noop. > + if (MMI->getSource() == MMI->getDest()) > + return EraseInstFromFunction(CI); > } > > // If we can determine a pointer alignment that is bigger than > currently > > Modified: llvm/trunk/test/Transforms/InstCombine/memmove.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memmove.ll?rev=51636&r1=51635&r2=51636&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/memmove.ll (original) > +++ llvm/trunk/test/Transforms/InstCombine/memmove.ll Wed May 28 > 00:30:41 2008 > @@ -34,3 +34,9 @@ > ret i32 0 > } > > +; PR2370 > +define void @test4(i8* %a) { > + tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, > i32 1 ) > + ret void > +} > + > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From natebegeman at mac.com Wed May 28 11:31:37 2008 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 28 May 2008 16:31:37 -0000 Subject: [llvm-commits] [llvm] r51644 - /llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Message-ID: <200805281631.m4SGVc6f015243@zion.cs.uiuc.edu> Author: sampo Date: Wed May 28 11:31:36 2008 New Revision: 51644 URL: http://llvm.org/viewvc/llvm-project?rev=51644&view=rev Log: Update some comments noticed in a recent checkin Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=51644&r1=51643&r2=51644&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Wed May 28 11:31:36 2008 @@ -91,12 +91,17 @@ setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::LABEL, MVT::Other, Expand); - //IA64 has these, but they are not implemented - setOperationAction(ISD::CTTZ , MVT::i64 , Expand); + // IA64 has ctlz in the form of the 'fnorm' instruction. The Legalizer + // expansion for ctlz/cttz in terms of ctpop is much larger, but lower + // latency. + // FIXME: Custom lower CTLZ when compiling for size? setOperationAction(ISD::CTLZ , MVT::i64 , Expand); + setOperationAction(ISD::CTTZ , MVT::i64 , Expand); setOperationAction(ISD::ROTL , MVT::i64 , Expand); setOperationAction(ISD::ROTR , MVT::i64 , Expand); - setOperationAction(ISD::BSWAP, MVT::i64 , Expand); // mux @rev + + // FIXME: IA64 has this, but is not implemented. should be mux @rev + setOperationAction(ISD::BSWAP, MVT::i64 , Expand); // VASTART needs to be custom lowered to use the VarArgsFrameIndex setOperationAction(ISD::VAARG , MVT::Other, Custom); From dalej at apple.com Wed May 28 11:34:02 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 09:34:02 -0700 Subject: [llvm-commits] llvm-gcc aggregate copy In-Reply-To: <200805281731.22082.baldrick@free.fr> References: <200805280846.14744.baldrick@free.fr> <200805281731.22082.baldrick@free.fr> Message-ID: <813866FD-F718-4499-AF3C-63813A54C297@apple.com> On May 28, 2008, at 8:31 AM, Duncan Sands wrote: > A more sophisticated example: > > struct A { int a[1024]; }; > struct B { int x; struct A y; }; > union C { struct A x; struct B y; }; > void g(struct A* a, struct A* b) { *a = *b; } > union C u; > main(void) { g(&u.x, &u.y.y); } This one is derived from something in the gcc testsuite IIRC. From evan.cheng at apple.com Wed May 28 11:55:47 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 09:55:47 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200805280924.45245.baldrick@free.fr> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805280924.45245.baldrick@free.fr> Message-ID: <431C7EAC-A5C0-4EDC-8BBE-DB9A2FA5380C@apple.com> I was looking at c-opts.c: flag_inline_trees = 1; /* Use tree inlining. */ if (!flag_no_inline) flag_no_inline = 1; if (flag_inline_functions) flag_inline_trees = 2; flag_no_inline corresponds to -fno-inline, flag_inline_functions corresponds to -finline-functions. That is, if flag_inline_trees == 1, the frontend does trivial inlining for functions that are marked DECL_INLINE. We want to run llvm inliner pass only when flag_inline_trees > 1. Perhaps it would be simpler to check for flag_inline_functions instead in llvm-backend.cpp? Evan On May 28, 2008, at 12:24 AM, Duncan Sands wrote: > Hi Evan, > >> Really honor -fno-inline-functions. > >> - if (flag_inline_trees) // respect -fno- >> inline-functions >> + if (flag_inline_trees > 1) // respect -fno- >> inline-functions > > the gcc middle- and back-ends do not make this distinction. > All the places that use flag_inline_trees only check whether > it is non-zero or not! > > However language front-ends do play with it in order to set > DECL_INLINE, for example in c-decl.c there is: > > else if (flag_inline_trees == 2 && initialized) > DECL_INLINE (decl) = 1; > > While the Ada front-end does: > > DECL_INLINE (fndecl) > = DECL_DECLARED_INLINE_P (fndecl) || flag_inline_trees == 2; > > On the other hand the Fortran front-end doesn't do anything. > > I think the right thing to look at is DECL_INLINE, and only > inline functions with the DECL_INLINE flag set. What do you > think? > > Ciao, > > Duncan. From baldrick at free.fr Wed May 28 12:22:06 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 19:22:06 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <431C7EAC-A5C0-4EDC-8BBE-DB9A2FA5380C@apple.com> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805280924.45245.baldrick@free.fr> <431C7EAC-A5C0-4EDC-8BBE-DB9A2FA5380C@apple.com> Message-ID: <200805281922.06510.baldrick@free.fr> Hi Evan, > I was looking at c-opts.c: notice the "c" in c-opts? :) > flag_inline_trees = 1; > > /* Use tree inlining. */ > if (!flag_no_inline) > flag_no_inline = 1; > if (flag_inline_functions) > flag_inline_trees = 2; > > flag_no_inline corresponds to -fno-inline, flag_inline_functions > corresponds to -finline-functions. This is how the C front-end does it. > That is, if flag_inline_trees == 1, > the frontend does trivial inlining for functions that are marked > DECL_INLINE. I don't think that's right: the gcc inliner only looks at flag_inline_trees != 0 and DECL_INLINE. > We want to run llvm inliner pass only when > flag_inline_trees > 1. To get the same effect as gcc in a way that works for all languages, I think we need to run the inliner if flag_inline_trees != 0 and add all functions with !DECL_INLINE to llvm.noinline. Or would that be too expensive? > Perhaps it would be simpler to check for flag_inline_functions instead > in llvm-backend.cpp? It would be simpler, but it would only work the same way as gcc for the C like languages, and not for Ada or Fortran. Ciao, Duncan. From evan.cheng at apple.com Wed May 28 12:22:33 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 17:22:33 -0000 Subject: [llvm-commits] [llvm] r51647 - in /llvm/trunk: lib/CodeGen/RegAllocLocal.cpp test/CodeGen/X86/2008-05-28-LocalRegAllocBug.ll Message-ID: <200805281722.m4SHMXLY016965@zion.cs.uiuc.edu> Author: evancheng Date: Wed May 28 12:22:32 2008 New Revision: 51647 URL: http://llvm.org/viewvc/llvm-project?rev=51647&view=rev Log: Teach local register allocator to deal with landing pad MBB's. Added: llvm/trunk/test/CodeGen/X86/2008-05-28-LocalRegAllocBug.ll Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=51647&r1=51646&r2=51647&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Wed May 28 12:22:32 2008 @@ -549,10 +549,10 @@ // If this is the first basic block in the machine function, add live-in // registers as active. - if (&MBB == &*MF->begin()) { - for (MachineRegisterInfo::livein_iterator I=MF->getRegInfo().livein_begin(), - E = MF->getRegInfo().livein_end(); I != E; ++I) { - unsigned Reg = I->first; + if (&MBB == &*MF->begin() || MBB.isLandingPad()) { + for (MachineBasicBlock::livein_iterator I = MBB.livein_begin(), + E = MBB.livein_end(); I != E; ++I) { + unsigned Reg = *I; MF->getRegInfo().setPhysRegUsed(Reg); PhysRegsUsed[Reg] = 0; // It is free and reserved now AddToPhysRegsUseOrder(Reg); Added: llvm/trunk/test/CodeGen/X86/2008-05-28-LocalRegAllocBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-05-28-LocalRegAllocBug.ll?rev=51647&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-05-28-LocalRegAllocBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-05-28-LocalRegAllocBug.ll Wed May 28 12:22:32 2008 @@ -0,0 +1,30 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -regalloc=local + + at _ZTVN10Evaluation10GridOutputILi3EEE = external constant [5 x i32 (...)*] ; <[5 x i32 (...)*]*> [#uses=1] + +declare i8* @llvm.eh.exception() nounwind + +declare i8* @_Znwm(i32) + +declare i8* @__cxa_begin_catch(i8*) nounwind + +define i32 @main(i32 %argc, i8** %argv) { +entry: + br i1 false, label %bb37, label %bb34 + +bb34: ; preds = %entry + ret i32 1 + +bb37: ; preds = %entry + %tmp12.i.i.i.i.i66 = invoke i8* @_Znwm( i32 12 ) + to label %tmp12.i.i.i.i.i.noexc65 unwind label %lpad243 ; [#uses=0] + +tmp12.i.i.i.i.i.noexc65: ; preds = %bb37 + unreachable + +lpad243: ; preds = %bb37 + %eh_ptr244 = call i8* @llvm.eh.exception( ) ; [#uses=1] + store i32 (...)** getelementptr ([5 x i32 (...)*]* @_ZTVN10Evaluation10GridOutputILi3EEE, i32 0, i32 2), i32 (...)*** null, align 8 + %tmp133 = call i8* @__cxa_begin_catch( i8* %eh_ptr244 ) nounwind ; [#uses=0] + unreachable +} From evan.cheng at apple.com Wed May 28 12:40:35 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 17:40:35 -0000 Subject: [llvm-commits] [llvm] r51648 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-05-28-CoalescerBug.ll Message-ID: <200805281740.m4SHecXb017536@zion.cs.uiuc.edu> Author: evancheng Date: Wed May 28 12:40:10 2008 New Revision: 51648 URL: http://llvm.org/viewvc/llvm-project?rev=51648&view=rev Log: Fix PR2289: vr defined by multiple implicit_def as result of coalescing. Added: llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=51648&r1=51647&r2=51648&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed May 28 12:40:10 2008 @@ -751,7 +751,7 @@ /// identity copies so they will be removed. void SimpleRegisterCoalescing::RemoveCopiesFromValNo(LiveInterval &li, VNInfo *VNI) { - MachineInstr *ImpDef = NULL; + SmallVector ImpDefs; MachineOperand *LastUse = NULL; unsigned LastUseIdx = li_->getUseIndex(VNI->def); for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(li.reg), @@ -761,8 +761,7 @@ ++RI; if (MO->isDef()) { if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) { - assert(!ImpDef && "Multiple implicit_def defining same register?"); - ImpDef = MI; + ImpDefs.push_back(MI); } continue; } @@ -790,9 +789,13 @@ if (LastUse) LastUse->setIsKill(); else { - // Remove dead implicit_def. - li_->RemoveMachineInstrFromMaps(ImpDef); - ImpDef->eraseFromParent(); + // Remove dead implicit_def's. + while (!ImpDefs.empty()) { + MachineInstr *ImpDef = ImpDefs.back(); + ImpDefs.pop_back(); + li_->RemoveMachineInstrFromMaps(ImpDef); + ImpDef->eraseFromParent(); + } } } Added: llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll?rev=51648&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll Wed May 28 12:40:10 2008 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu +; PR2289 + +define void @_ada_ca11001() { +entry: + %tmp59 = call i16 @ca11001_0__cartesian_assign( i8 zeroext 0, i8 zeroext 0, i16 undef ) ; [#uses=0] + unreachable +} + +declare i16 @ca11001_0__cartesian_assign(i8 zeroext , i8 zeroext , i16) From resistor at mac.com Wed May 28 12:52:24 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 28 May 2008 12:52:24 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200805281752.m4SHqOV0017877@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.33 -> 1.34 --- Log message: Add the IOQuake3 project. --- Diffs of the changes: (+8 -2) Users.html | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.33 llvm-www/Users.html:1.34 --- llvm-www/Users.html:1.33 Sun Apr 20 19:15:03 2008 +++ llvm-www/Users.html Wed May 28 12:50:30 2008 @@ -293,7 +293,7 @@ Project Description - + PyPy Project @@ -310,6 +310,12 @@ iPhone tool chain llvm-gcc Compiler for iPhone Dev Wiki toolchain. + + + + IOQuake3 + IOQuake3 Raytracing Patch, uses LLVM for runtime shader compilation. + @@ -324,6 +330,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2008/04/21 00:15:03 $ + Last modified: $Date: 2008/05/28 17:50:30 $ From evan.cheng at apple.com Wed May 28 12:55:28 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 10:55:28 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200805281922.06510.baldrick@free.fr> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805280924.45245.baldrick@free.fr> <431C7EAC-A5C0-4EDC-8BBE-DB9A2FA5380C@apple.com> <200805281922.06510.baldrick@free.fr> Message-ID: <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> On May 28, 2008, at 10:22 AM, Duncan Sands wrote: > Hi Evan, > >> I was looking at c-opts.c: > > notice the "c" in c-opts? :) > >> flag_inline_trees = 1; >> >> /* Use tree inlining. */ >> if (!flag_no_inline) >> flag_no_inline = 1; >> if (flag_inline_functions) >> flag_inline_trees = 2; >> >> flag_no_inline corresponds to -fno-inline, flag_inline_functions >> corresponds to -finline-functions. > > This is how the C front-end does it. > >> That is, if flag_inline_trees == 1, >> the frontend does trivial inlining for functions that are marked >> DECL_INLINE. > > I don't think that's right: the gcc inliner only looks at > flag_inline_trees != 0 and DECL_INLINE. > >> We want to run llvm inliner pass only when >> flag_inline_trees > 1. > > To get the same effect as gcc in a way that works for all languages, > I think we need to run the inliner if flag_inline_trees != 0 and add > all functions with !DECL_INLINE to llvm.noinline. Or would that be > too expensive? That doesn't seem like the right solution to me. llvm language doesn't have the "inline" keyword. Can we just say llvm ignore the inline hint? > > >> Perhaps it would be simpler to check for flag_inline_functions >> instead >> in llvm-backend.cpp? > > It would be simpler, but it would only work the same way as gcc for > the C like languages, and not for Ada or Fortran. Is it possible to fix the Ada and Fortran frontend to match the C frontend? Evan > > > Ciao, > > Duncan. From dalej at apple.com Wed May 28 13:01:05 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 18:01:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51649 - in /llvm-gcc-4.2/trunk/gcc: modulo-sched.c sched-rgn.c Message-ID: <200805281801.m4SI157W018355@zion.cs.uiuc.edu> Author: johannes Date: Wed May 28 13:01:03 2008 New Revision: 51649 URL: http://llvm.org/viewvc/llvm-project?rev=51649&view=rev Log: Comment out code unused by llvm-gcc. Modified: llvm-gcc-4.2/trunk/gcc/modulo-sched.c llvm-gcc-4.2/trunk/gcc/sched-rgn.c Modified: llvm-gcc-4.2/trunk/gcc/modulo-sched.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/modulo-sched.c?rev=51649&r1=51648&r2=51649&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/modulo-sched.c (original) +++ llvm-gcc-4.2/trunk/gcc/modulo-sched.c Wed May 28 13:01:03 2008 @@ -50,6 +50,12 @@ #include "timevar.h" #include "tree-pass.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifdef ENABLE_LLVM +#undef INSN_SCHEDULING +#endif +/* LLVM LOCAL end */ + #ifdef INSN_SCHEDULING /* This file contains the implementation of the Swing Modulo Scheduler, Modified: llvm-gcc-4.2/trunk/gcc/sched-rgn.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/sched-rgn.c?rev=51649&r1=51648&r2=51649&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/sched-rgn.c (original) +++ llvm-gcc-4.2/trunk/gcc/sched-rgn.c Wed May 28 13:01:03 2008 @@ -68,6 +68,12 @@ #include "timevar.h" #include "tree-pass.h" +/* LLVM LOCAL begin comment out most of this file */ +#ifdef ENABLE_LLVM +#undef INSN_SCHEDULING +#endif +/* LLVM LOCAL end */ + /* Define when we want to do count REG_DEAD notes before and after scheduling for sanity checking. We can't do that when conditional execution is used, as REG_DEAD exist only for unconditional deaths. */ From dalej at apple.com Wed May 28 13:11:41 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 11:11:41 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805280924.45245.baldrick@free.fr> <431C7EAC-A5C0-4EDC-8BBE-DB9A2FA5380C@apple.com> <200805281922.06510.baldrick@free.fr> <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> Message-ID: <48BC2758-A1A9-4318-A819-323FED160E97@apple.com> On May 28, 2008, at 10:55 AM, Evan Cheng wrote: >>> We want to run llvm inliner pass only when >>> flag_inline_trees > 1. >> >> To get the same effect as gcc in a way that works for all languages, >> I think we need to run the inliner if flag_inline_trees != 0 and add >> all functions with !DECL_INLINE to llvm.noinline. Or would that be >> too expensive? > > That doesn't seem like the right solution to me. llvm language doesn't > have the "inline" keyword. Can we just say llvm ignore the inline > hint? I don't think that's a good idea; the hint should be added to the IR. Compilers are not at the point where they can make better decisions than an intelligent user about which things are good to inline, and IMO they never will be; for example, a user can know that certain calls are or aren't executed frequently. And honoring no-inline and always-inline is needed for correctness (assuming we accept GCC extensions as part of the language). fwiw, the inlining heuristics have changed in each release of gcc, and are not documented in a fashion useful to end users (to make it easy to change them, I suspect, although no one is willing to admit it.) No matter what you do here it is possible to construct cases where something else is better, IMO. >>> Perhaps it would be simpler to check for flag_inline_functions >>> instead >>> in llvm-backend.cpp? >> >> It would be simpler, but it would only work the same way as gcc for >> the C like languages, and not for Ada or Fortran. > > Is it possible to fix the Ada and Fortran frontend to match the C > frontend? From clattner at apple.com Wed May 28 13:15:34 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 11:15:34 -0700 Subject: [llvm-commits] llvm-gcc aggregate copy In-Reply-To: <200805280846.14744.baldrick@free.fr> References: <200805280846.14744.baldrick@free.fr> Message-ID: On May 27, 2008, at 11:46 PM, Duncan Sands wrote: > Hi Chris, I discussed this problem with Dale some time ago. > Since gcc mainline produces exactly the same memcpy call, we > decided not to worry about it. I do remember a gcc guy telling > me once that aggregate assignment assumes no overlap, so maybe > there is nothing to worry about... Ah right. > My personal feeling is that > memmove should be used and llvm should change it to memcpy if > it can deduce that it is safe. This would be nice. If there is no measurable perf impact on any code we care about, then I guess we could do this. It seems that lots of the cases that occur in practice will be to stack objects, which are relatively easy to disambiguate. > There is also the problem of > small structs for which llvm-gcc produces a hand-made memcpy, > i.e. a series of loads and stores. That would need to be turned > into something that works for overlapping objects. One possibility > (inefficient but works) is to compare the addresses of the two > objects and copy in order of increasing address or decreasing address > correspondingly. A better solution is perhaps to exploit the new > aggregates-as-first-class-values work and treat small structs as > registers. Ok. Lets evaluate this option as Dan's work gets farther along. -Chris From clattner at apple.com Wed May 28 13:16:54 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 11:16:54 -0700 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll In-Reply-To: References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> Message-ID: <38E31435-04B7-4216-8479-D67BA21A8434@apple.com> On May 28, 2008, at 9:18 AM, Dale Johannesen wrote: > volatile? memmove isn't volatile. -Chris From dalej at apple.com Wed May 28 13:19:08 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 11:19:08 -0700 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll In-Reply-To: <38E31435-04B7-4216-8479-D67BA21A8434@apple.com> References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> <38E31435-04B7-4216-8479-D67BA21A8434@apple.com> Message-ID: On May 28, 2008, at 11:16 AM, Chris Lattner wrote: > > On May 28, 2008, at 9:18 AM, Dale Johannesen wrote: > >> volatile? > > memmove isn't volatile. Its arguments may be ptr-to-volatile, and in that case the transform is invalid. From clattner at apple.com Wed May 28 13:19:25 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 11:19:25 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <48BC2758-A1A9-4318-A819-323FED160E97@apple.com> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805280924.45245.baldrick@free.fr> <431C7EAC-A5C0-4EDC-8BBE-DB9A2FA5380C@apple.com> <200805281922.06510.baldrick@free.fr> <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> <48BC2758-A1A9-4318-A819-323FED160E97@apple.com> Message-ID: On May 28, 2008, at 11:11 AM, Dale Johannesen wrote: > > On May 28, 2008, at 10:55 AM, Evan Cheng wrote: >>>> We want to run llvm inliner pass only when >>>> flag_inline_trees > 1. >>> >>> To get the same effect as gcc in a way that works for all languages, >>> I think we need to run the inliner if flag_inline_trees != 0 and add >>> all functions with !DECL_INLINE to llvm.noinline. Or would that be >>> too expensive? >> >> That doesn't seem like the right solution to me. llvm language >> doesn't >> have the "inline" keyword. Can we just say llvm ignore the inline >> hint? > > I don't think that's a good idea; the hint should be added to the IR. > Compilers are not at the point where they can make better decisions > than an intelligent user about which things are good to inline, Too bad there aren't more intelligent users out there. > And honoring no-inline and always-inline is needed for correctness > (assuming we accept GCC extensions as part of the language). Right. -Chris From dalej at apple.com Wed May 28 13:20:15 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 18:20:15 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51650 - /llvm-gcc-4.2/trunk/gcc/final.c Message-ID: <200805281820.m4SIKFuu019077@zion.cs.uiuc.edu> Author: johannes Date: Wed May 28 13:20:15 2008 New Revision: 51650 URL: http://llvm.org/viewvc/llvm-project?rev=51650&view=rev Log: Unbreak build for targets whose BEs call "final" (e.g. PPC). Modified: llvm-gcc-4.2/trunk/gcc/final.c Modified: llvm-gcc-4.2/trunk/gcc/final.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/final.c?rev=51650&r1=51649&r2=51650&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/final.c (original) +++ llvm-gcc-4.2/trunk/gcc/final.c Wed May 28 13:20:15 2008 @@ -2562,6 +2562,14 @@ } return false; } +#else +/* This is called from several BEs, we need a definition. */ +void +/* APPLE LOCAL optimization pragmas 3124235/3420242 */ +final (rtx first ATTRIBUTE_UNUSED, FILE *file ATTRIBUTE_UNUSED, + int optimizing ATTRIBUTE_UNUSED) +{ +} #endif /* LLVM LOCAL end */ From clattner at apple.com Wed May 28 13:20:13 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 11:20:13 -0700 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll In-Reply-To: References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> <38E31435-04B7-4216-8479-D67BA21A8434@apple.com> Message-ID: <33FDF58F-8B96-408F-914A-13CDF238106E@apple.com> On May 28, 2008, at 11:19 AM, Dale Johannesen wrote: > > On May 28, 2008, at 11:16 AM, Chris Lattner wrote: > >> >> On May 28, 2008, at 9:18 AM, Dale Johannesen wrote: >> >>> volatile? >> >> memmove isn't volatile. > > Its arguments may be ptr-to-volatile, and in that case the transform > is invalid. memmove takes void* arguments, so when you pass pointer to volatile, the implicit conversion strips off volatile. Is there some part of the standard I'm missing here? -Chris From baldrick at free.fr Wed May 28 13:30:01 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 20:30:01 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805281922.06510.baldrick@free.fr> <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> Message-ID: <200805282030.01890.baldrick@free.fr> Hi Evan, > > To get the same effect as gcc in a way that works for all languages, > > I think we need to run the inliner if flag_inline_trees != 0 and add > > all functions with !DECL_INLINE to llvm.noinline. Or would that be > > too expensive? > > That doesn't seem like the right solution to me. llvm language doesn't > have the "inline" keyword. Can we just say llvm ignore the inline hint? > > >> Perhaps it would be simpler to check for flag_inline_functions > >> instead > >> in llvm-backend.cpp? > > > > It would be simpler, but it would only work the same way as gcc for > > the C like languages, and not for Ada or Fortran. > > Is it possible to fix the Ada and Fortran frontend to match the C > frontend? Or fix the C front-end to match one of the others :) By the way, just looking at flag_inline_trees > 1 means you don't inline functions marked "inline" at -O2. Why don't we just run the inliner at -O2 with some kind of threshold that shouldn't increase size and be happy with that? Is there anything wrong with inlining at -O2? If people don't want certain functions to be inlined then they can mark them noinline. Ciao, Duncan. From dalej at apple.com Wed May 28 13:32:17 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 11:32:17 -0700 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll In-Reply-To: <33FDF58F-8B96-408F-914A-13CDF238106E@apple.com> References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> <38E31435-04B7-4216-8479-D67BA21A8434@apple.com> <33FDF58F-8B96-408F-914A-13CDF238106E@apple.com> Message-ID: On May 28, 2008, at 11:20 AM, Chris Lattner wrote: > > On May 28, 2008, at 11:19 AM, Dale Johannesen wrote: > >> >> On May 28, 2008, at 11:16 AM, Chris Lattner wrote: >> >>> >>> On May 28, 2008, at 9:18 AM, Dale Johannesen wrote: >>> >>>> volatile? >>> >>> memmove isn't volatile. >> >> Its arguments may be ptr-to-volatile, and in that case the transform >> is invalid. > > memmove takes void* arguments, so when you pass pointer to volatile, > the implicit conversion strips off volatile. Is there some part of > the standard I'm missing here? I guess you are right. C99 6.7.3 "If an attempt is made to refer to an object de?ned with a volatile-quali?ed type through use of an lvalue with non-volatile-quali?ed type, the behavior is unde?ned." So this is undefined behavior, and the FE does warn about it; I suppose this isn't the right place to check again. From baldrick at free.fr Wed May 28 13:33:29 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 20:33:29 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <48BC2758-A1A9-4318-A819-323FED160E97@apple.com> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> <48BC2758-A1A9-4318-A819-323FED160E97@apple.com> Message-ID: <200805282033.29672.baldrick@free.fr> Hi Dale, > I don't think that's a good idea; the hint should be added to the IR. > Compilers are not at the point where they can make better decisions > than an intelligent user about which things are good to inline, and > IMO they > never will be; for example, a user can know that certain calls are or > aren't > executed frequently. the linux kernel people removed "inline" almost everywhere because (1) people put it on functions that were too big (eg: that had more than one line in it), and (2) the gcc automatic inliner did a great job, so it wasn't worth spending time thinking where to put "inline". Ciao, Duncan. From clattner at apple.com Wed May 28 13:35:52 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 11:35:52 -0700 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll In-Reply-To: References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> <38E31435-04B7-4216-8479-D67BA21A8434@apple.com> <33FDF58F-8B96-408F-914A-13CDF238106E@apple.com> Message-ID: <1EC50FA1-D554-4B58-BFD9-E31DF2756ED9@apple.com> On May 28, 2008, at 11:32 AM, Dale Johannesen wrote: >> memmove takes void* arguments, so when you pass pointer to volatile, >> the implicit conversion strips off volatile. Is there some part of >> the standard I'm missing here? > > > I guess you are right. C99 6.7.3 "If an attempt is made to refer to > an object de?ned with a volatile-quali?ed type through use of an > lvalue > with non-volatile-quali?ed type, the behavior is unde?ned." So > this is undefined behavior, and the FE does warn about it; I suppose > this isn't the right place to check again. I guess the case that matters is when the CFE turns volatile struct assignment into a memcpy. We should probably add a isvolatile flag to llvm.memcpy/memmove/memset just for completeness. -Chris From baldrick at free.fr Wed May 28 13:41:14 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 20:41:14 +0200 Subject: [llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll In-Reply-To: <1EC50FA1-D554-4B58-BFD9-E31DF2756ED9@apple.com> References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> <1EC50FA1-D554-4B58-BFD9-E31DF2756ED9@apple.com> Message-ID: <200805282041.14872.baldrick@free.fr> > I guess the case that matters is when the CFE turns volatile struct > assignment into a memcpy. We should probably add a isvolatile flag to > llvm.memcpy/memmove/memset just for completeness. How about just outputting an explicit loop in that case? Also, someone assigning volatile structs probably has wrong expectations anyway: memcpy may copy the struct a byte at a time while they are probably hoping for field-at-a-time. For example they probably expect integer fields to be written using one processor operation (resulting in a consistent view of the integer from other processors) but that may not be what they get... Ciao, Duncan. From evan.cheng at apple.com Wed May 28 13:58:46 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 11:58:46 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200805282030.01890.baldrick@free.fr> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805281922.06510.baldrick@free.fr> <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> <200805282030.01890.baldrick@free.fr> Message-ID: On May 28, 2008, at 11:30 AM, Duncan Sands wrote: > Hi Evan, > >>> To get the same effect as gcc in a way that works for all languages, >>> I think we need to run the inliner if flag_inline_trees != 0 and add >>> all functions with !DECL_INLINE to llvm.noinline. Or would that be >>> too expensive? >> >> That doesn't seem like the right solution to me. llvm language >> doesn't >> have the "inline" keyword. Can we just say llvm ignore the inline >> hint? >> >>>> Perhaps it would be simpler to check for flag_inline_functions >>>> instead >>>> in llvm-backend.cpp? >>> >>> It would be simpler, but it would only work the same way as gcc for >>> the C like languages, and not for Ada or Fortran. >> >> Is it possible to fix the Ada and Fortran frontend to match the C >> frontend? > > Or fix the C front-end to match one of the others :) By the way, just > looking at flag_inline_trees > 1 means you don't inline functions > marked > "inline" at -O2. There is no guarantee we inline "inline" functions even if we run the inliner. llvm does not yet have a way to represent the "inline" keyword, right? > > > Why don't we just run the inliner at -O2 with some kind of threshold > that shouldn't increase size and be happy with that? Is there > anything > wrong with inlining at -O2? If people don't want certain functions > to be > inlined then they can mark them noinline. We are running the inliner at -O2, no? We are no longer checking the optimizer level. The issue here is llvm-gcc still run the inliner even with -fno-inline-function. Can we rely on the gcc inliner to handle functions that are marked inline until we add the inline hint to llvm? Could that be the reason why WebKit regressed when the gcc inliner is disabled completely? Evan > > > Ciao, > > Duncan. From baldrick at free.fr Wed May 28 14:04:27 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 21:04:27 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <48BC2758-A1A9-4318-A819-323FED160E97@apple.com> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <1A7B20D2-FDC2-4CEC-94B8-650DF5CD777B@apple.com> <48BC2758-A1A9-4318-A819-323FED160E97@apple.com> Message-ID: <200805282104.27867.baldrick@free.fr> Hi Dale, > And honoring no-inline and always-inline is needed for correctness > (assuming we accept GCC extensions as part of the language). for these it is irrelevant whether we run the LLVM inliner or not. * always-inline is handled by the gcc inliner using the usual gcc logic. * noinline: if the LLVM inliner is not run then these functions are not inlined; if it is run then they are not inlined either because they are noted in the llvm.noinline metadata. Ciao, Duncan. From baldrick at free.fr Wed May 28 14:53:17 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 21:53:17 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805282030.01890.baldrick@free.fr> Message-ID: <200805282153.18045.baldrick@free.fr> Hi Evan, > We are running the inliner at -O2, no? We are no longer checking the > optimizer level. The issue here is llvm-gcc still run the inliner even > with -fno-inline-function. I get it now - sorry for the confusion. Your patch seems fine :) > Can we rely on the gcc inliner to handle functions that are marked > inline until we add the inline hint to llvm? Could that be the reason > why WebKit regressed when the gcc inliner is disabled completely? Rather than adding an inline hint, there could be a per-function threshold. I'm not saying that I think this is a good idea, I'm just tossing the thought out for discussion. If we turn down the gcc inliner to the minimum (as I did before) then it won't inline functions marked inline, only those marked always_inline. Ciao, Duncan. From baldrick at free.fr Wed May 28 14:59:35 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 28 May 2008 21:59:35 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805282030.01890.baldrick@free.fr> Message-ID: <200805282159.35748.baldrick@free.fr> Hi Evan, I just noticed that C turns on flag_inline_functions at -O3, so doesn't your patch mean that there is no LLVM inlining at -O2? Ciao, Duncan. PS: The Ada f-e never sets flag_inline_functions, so I guess it's getting no LLVM inlining at all! From resistor at mac.com Wed May 28 15:54:51 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 28 May 2008 20:54:51 -0000 Subject: [llvm-commits] [llvm] r51652 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200805282054.m4SKsppS024274@zion.cs.uiuc.edu> Author: resistor Date: Wed May 28 15:54:50 2008 New Revision: 51652 URL: http://llvm.org/viewvc/llvm-project?rev=51652&view=rev Log: Factor the numbering computation into a separate method, and add the slightest attempt at some renumbering logic, which is currently unused. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=51652&r1=51651&r2=51652&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed May 28 15:54:50 2008 @@ -306,6 +306,9 @@ /// computeIntervals - Compute live intervals. void computeIntervals(); + /// computeNumbering - Compute the index numbering. + void computeNumbering(); + /// handleRegisterDef - update intervals for a register def /// (calls handlePhysicalRegisterDef and /// handleVirtualRegisterDef) Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=51652&r1=51651&r2=51652&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed May 28 15:54:50 2008 @@ -75,17 +75,14 @@ delete ClonedMIs[i]; } -/// runOnMachineFunction - Register allocate the whole function -/// -bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) { - mf_ = &fn; - mri_ = &mf_->getRegInfo(); - tm_ = &fn.getTarget(); - tri_ = tm_->getRegisterInfo(); - tii_ = tm_->getInstrInfo(); - lv_ = &getAnalysis(); - allocatableRegs_ = tri_->getAllocatableSet(fn); - +void LiveIntervals::computeNumbering() { + Index2MiMap OldI2MI = i2miMap_; + + Idx2MBBMap.clear(); + MBB2IdxMap.clear(); + mi2iMap_.clear(); + i2miMap_.clear(); + // Number MachineInstrs and MachineBasicBlocks. // Initialize MBB indexes to a sentinal. MBB2IdxMap.resize(mf_->getNumBlockIDs(), std::make_pair(~0U,~0U)); @@ -110,7 +107,28 @@ Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB)); } std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare()); + + if (!OldI2MI.empty()) + for (iterator I = begin(), E = end(); I != E; ++I) + for (LiveInterval::iterator LI = I->second.begin(), LE = I->second.end(); + LI != LE; ++LI) { + LI->start = mi2iMap_[OldI2MI[LI->start]]; + LI->end = mi2iMap_[OldI2MI[LI->end]]; + } +} + +/// runOnMachineFunction - Register allocate the whole function +/// +bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) { + mf_ = &fn; + mri_ = &mf_->getRegInfo(); + tm_ = &fn.getTarget(); + tri_ = tm_->getRegisterInfo(); + tii_ = tm_->getInstrInfo(); + lv_ = &getAnalysis(); + allocatableRegs_ = tri_->getAllocatableSet(fn); + computeNumbering(); computeIntervals(); numIntervals += getNumIntervals(); From dalej at apple.com Wed May 28 16:41:59 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 21:41:59 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51653 - /llvm-gcc-4.2/trunk/gcc/passes.c Message-ID: <200805282141.m4SLfx2t025632@zion.cs.uiuc.edu> Author: johannes Date: Wed May 28 16:41:58 2008 New Revision: 51653 URL: http://llvm.org/viewvc/llvm-project?rev=51653&view=rev Log: Remove warnings. Modified: llvm-gcc-4.2/trunk/gcc/passes.c Modified: llvm-gcc-4.2/trunk/gcc/passes.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/passes.c?rev=51653&r1=51652&r2=51653&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/passes.c (original) +++ llvm-gcc-4.2/trunk/gcc/passes.c Wed May 28 16:41:58 2008 @@ -239,15 +239,14 @@ void finish_optimization_passes (void) { - enum tree_dump_index i; - struct dump_file_info *dfi; - char *name; - /* LLVM LOCAL begin Dead code strip cc1. */ #ifdef ENABLE_LLVM return; #else - + enum tree_dump_index i; + struct dump_file_info *dfi; + char *name; + timevar_push (TV_DUMP); if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) { From dalej at apple.com Wed May 28 16:56:36 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 28 May 2008 21:56:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51654 - in /llvm-gcc-4.2/trunk/gcc: genattrtab.c genautomata.c Message-ID: <200805282156.m4SLubFc026068@zion.cs.uiuc.edu> Author: johannes Date: Wed May 28 16:56:36 2008 New Revision: 51654 URL: http://llvm.org/viewvc/llvm-project?rev=51654&view=rev Log: Remove more unneeded code. Modified: llvm-gcc-4.2/trunk/gcc/genattrtab.c llvm-gcc-4.2/trunk/gcc/genautomata.c Modified: llvm-gcc-4.2/trunk/gcc/genattrtab.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/genattrtab.c?rev=51654&r1=51653&r2=51654&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/genattrtab.c (original) +++ llvm-gcc-4.2/trunk/gcc/genattrtab.c Wed May 28 16:56:36 2008 @@ -4498,9 +4498,9 @@ } } - make_internal_attr ("*internal_dfa_insn_code", code_exp, ATTR_NONE); /* LLVM LOCAL begin */ #ifndef ENABLE_LLVM + make_internal_attr ("*internal_dfa_insn_code", code_exp, ATTR_NONE); make_internal_attr ("*insn_default_latency", lats_exp, ATTR_NONE); make_internal_attr ("*bypass_p", byps_exp, ATTR_NONE); #endif Modified: llvm-gcc-4.2/trunk/gcc/genautomata.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/genautomata.c?rev=51654&r1=51653&r2=51654&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/genautomata.c (original) +++ llvm-gcc-4.2/trunk/gcc/genautomata.c Wed May 28 16:56:36 2008 @@ -6720,6 +6720,8 @@ return result; } +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* The function outputs all initialization values of VECT. */ static void output_vect (vla_hwint_t vect) @@ -6745,7 +6747,8 @@ els_on_line++; } } - +#endif +/* LLVM LOCAL end */ /* The following is name of the structure which represents DFA(s) for PHR. */ #define CHIP_NAME "DFA_chip" @@ -6762,6 +6765,8 @@ automaton->corresponding_automaton_decl->name); } +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* The following is name of temporary variable which stores state of a DFA for PHR. */ static void @@ -6770,12 +6775,16 @@ fprintf (f, "_"); output_chip_member_name (f, automaton); } +#endif +/* LLVM LOCAL end */ /* This is name of macro value which is code of pseudo_insn representing advancing cpu cycle. Its value is used as internal code unknown insn. */ #define ADVANCE_CYCLE_VALUE_NAME "DFA__ADVANCE_CYCLE" +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* Output name of translate vector for given automaton. */ static void output_translate_vect_name (FILE *f, automaton_t automaton) @@ -6841,6 +6850,8 @@ fprintf (f, "%s_min_issue_delay", automaton->corresponding_automaton_decl->name); } +#endif +/* LLVM LOCAL end */ /* Output name of deadlock vector for given automaton. */ static void @@ -6985,6 +6996,8 @@ } +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* The function outputs translate vector of internal insn code into insn equivalence class number. The equivalence class number is used to access to table and vectors representing DFA(s). */ @@ -7018,7 +7031,6 @@ fprintf (output_file, "};\n\n"); VEC_free (vect_el_t,heap, translate_vect); } - /* The value in a table state x ainsn -> something which represents undefined value. */ static int undefined_vect_el_value; @@ -7382,6 +7394,8 @@ VEC_free (state_t,heap, output_states_vect); VEC_free (vect_el_t,heap, transition_vect); } +#endif +/* LLVM LOCAL end */ /* The current number of passing states to find minimal issue delay value for an ainsn and state. */ @@ -7430,6 +7444,8 @@ return min_insn_issue_delay; } +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* The function searches minimal issue delay value for AINSN in STATE. The function can return negative value if we can not issue AINSN. We will report about it later. */ @@ -7658,6 +7674,8 @@ fprintf (output_file, "\n#define %s %d\n\n", ADVANCE_CYCLE_VALUE_NAME, DECL_INSN_RESERV (advance_cycle_insn_decl)->insn_num); } +#endif +/* LLVM LOCAL end */ /* The function outputs definition and value of PHR interface variable `max_insn_queue_index'. Its value is not less than maximal queue @@ -7692,6 +7710,8 @@ (1 << i) - 1); } +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* The function outputs switch cases for insn reservations using function *output_automata_list_code. */ static void @@ -7939,13 +7959,16 @@ fprintf (output_file, " }\n else\n %s = %s;\n\n", insn_code_name, ADVANCE_CYCLE_VALUE_NAME); } - +#endif +/* LLVM LOCAL end */ /* This function outputs `dfa_insn_code' and its helper function `dfa_insn_code_enlarge'. */ static void output_dfa_insn_code_func (void) { +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* Emacs c-mode gets really confused if there's a { or } in column 0 inside a string, so don't do that. */ fprintf (output_file, "\ @@ -7988,12 +8011,22 @@ INTERNAL_DFA_INSN_CODE_FUNC_NAME, INSN_PARAMETER_NAME, DFA_INSN_CODES_VARIABLE_NAME, INTERNAL_INSN_CODE_NAME); fprintf (output_file, " return %s;\n}\n\n", INTERNAL_INSN_CODE_NAME); +#endif +/* LLVM LOCAL end */ } /* The function outputs PHR interface function `state_transition'. */ static void output_trans_func (void) { +/* LLVM LOCAL begin remove unneeded code */ +#ifdef ENABLE_LLVM + fprintf (output_file, + "int\n%s (%s %s ATTRIBUTE_UNUSED, rtx %s ATTRIBUTE_UNUSED)\n" + "{ return -1; }\n", + TRANSITION_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME, + INSN_PARAMETER_NAME); +#else fprintf (output_file, "int\n%s (%s %s, rtx %s)\n", TRANSITION_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME, INSN_PARAMETER_NAME); @@ -8002,12 +8035,22 @@ INTERNAL_INSN_CODE_NAME, -1); fprintf (output_file, " return %s (%s, %s);\n}\n\n", INTERNAL_TRANSITION_FUNC_NAME, INTERNAL_INSN_CODE_NAME, STATE_NAME); +#endif +/* LLVM LOCAL end */ } /* Output function `min_issue_delay'. */ static void output_min_issue_delay_func (void) { +/* LLVM LOCAL begin remove unneeded code */ +#ifdef ENABLE_LLVM + fprintf (output_file, + "int\n%s (%s %s ATTRIBUTE_UNUSED, rtx %s ATTRIBUTE_UNUSED)\n" + "{ return -1;}\n", + MIN_ISSUE_DELAY_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME, + INSN_PARAMETER_NAME); +#else fprintf (output_file, "int\n%s (%s %s, rtx %s)\n", MIN_ISSUE_DELAY_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME, INSN_PARAMETER_NAME); @@ -8023,6 +8066,8 @@ INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, INTERNAL_INSN_CODE_NAME, STATE_NAME); fprintf (output_file, "}\n\n"); +#endif +/* LLVM LOCAL end */ } /* Output function `internal_dead_lock'. */ @@ -8090,6 +8135,14 @@ static void output_min_insn_conflict_delay_func (void) { +/* LLVM LOCAL begin remove unneeded code */ +#ifdef ENABLE_LLVM + fprintf (output_file, + "int\n%s (%s %s ATTRIBUTE_UNUSED, rtx %s ATTRIBUTE_UNUSED, " + "rtx %s ATTRIBUTE_UNUSED)\n{ return -1; }\n", + MIN_INSN_CONFLICT_DELAY_FUNC_NAME, STATE_TYPE_NAME, + STATE_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME); +#else fprintf (output_file, "int\n%s (%s %s, rtx %s, rtx %s)\n", MIN_INSN_CONFLICT_DELAY_FUNC_NAME, STATE_TYPE_NAME, @@ -8111,8 +8164,12 @@ INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, INTERNAL_INSN2_CODE_NAME, CHIP_NAME); fprintf (output_file, "}\n\n"); +#endif +/* LLVM LOCAL end */ } +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* Output function `internal_insn_latency'. */ static void output_internal_insn_latency_func (void) @@ -8207,11 +8264,20 @@ fprintf (output_file, " }\n return default_latencies[%s];\n}\n\n", INTERNAL_INSN_CODE_NAME); } +#endif +/* LLVM LOCAL end */ /* The function outputs PHR interface function `insn_latency'. */ static void output_insn_latency_func (void) { +/* LLVM LOCAL begin remove unneeded code */ +#ifdef ENABLE_LLVM + fprintf (output_file, + "int\n%s (rtx %s ATTRIBUTE_UNUSED, rtx %s ATTRIBUTE_UNUSED)\n" + "{ return -1; }\n", + INSN_LATENCY_FUNC_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME); +#else fprintf (output_file, "int\n%s (rtx %s, rtx %s)\n", INSN_LATENCY_FUNC_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME); fprintf (output_file, "{\n int %s, %s;\n", @@ -8224,12 +8290,22 @@ INTERNAL_INSN_LATENCY_FUNC_NAME, INTERNAL_INSN_CODE_NAME, INTERNAL_INSN2_CODE_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME); +#endif +/* LLVM LOCAL end */ } /* The function outputs PHR interface function `print_reservation'. */ static void output_print_reservation_func (void) { +/* LLVM LOCAL begin remove unneeded code */ +#ifdef ENABLE_LLVM + fprintf (output_file, + "void\n%s (FILE *%s ATTRIBUTE_UNUSED, rtx %s ATTRIBUTE_UNUSED)\n" + "{}\n", + PRINT_RESERVATION_FUNC_NAME, FILE_PARAMETER_NAME, + INSN_PARAMETER_NAME); +#else decl_t decl; int i, j; @@ -8283,6 +8359,8 @@ fprintf (output_file, " fputs (reservation_names[%s], %s);\n}\n\n", INTERNAL_INSN_CODE_NAME, FILE_PARAMETER_NAME); +#endif +/* LLVM LOCAL end */ } /* The following function is used to sort unit declaration by their @@ -8770,6 +8848,8 @@ /* The page contains top level function for generation DFA(s) used for PHR. */ +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM /* The function outputs statistics about work of different phases of DFA generator. */ static void @@ -8837,6 +8917,8 @@ fprintf (f, "%5d all locked states\n", locked_states); #endif } +#endif +/* LLVM LOCAL end */ /* The function output times of work of different phases of DFA generator. */ @@ -9153,7 +9235,11 @@ output_time = create_ticker (); if (progress_flag) fprintf (stderr, "Forming and outputting automata tables..."); +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM output_tables (); +#endif +/* LLVM LOCAL end */ if (progress_flag) { fprintf (stderr, "done\n"); @@ -9161,8 +9247,12 @@ } output_chip_definitions (); output_max_insn_queue_index_def (); +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM output_internal_min_issue_delay_func (); output_internal_trans_func (); +#endif +/* LLVM LOCAL end */ /* Cache of insn dfa codes: */ fprintf (output_file, "\nstatic int *%s;\n", DFA_INSN_CODES_VARIABLE_NAME); fprintf (output_file, "\nstatic int %s;\n\n", @@ -9176,7 +9266,11 @@ output_internal_reset_func (); output_reset_func (); output_min_insn_conflict_delay_func (); +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM output_internal_insn_latency_func (); +#endif +/* LLVM LOCAL end */ output_insn_latency_func (); output_print_reservation_func (); /* Output function get_cpu_unit_code. */ @@ -9204,9 +9298,17 @@ output_automaton_descriptions (); if (progress_flag) fprintf (stderr, "done\n"); +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM output_statistics (output_description_file); +#endif +/* LLVM LOCAL end */ } +/* LLVM LOCAL begin remove unneeded code */ +#ifndef ENABLE_LLVM output_statistics (stderr); +#endif +/* LLVM LOCAL end */ ticker_off (&output_time); output_time_statistics (stderr); finish_states (); From evan.cheng at apple.com Wed May 28 17:07:37 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 22:07:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51655 - /llvm-gcc-4.2/trunk/gcc/opts.c Message-ID: <200805282207.m4SM7bCj026373@zion.cs.uiuc.edu> Author: evancheng Date: Wed May 28 17:07:37 2008 New Revision: 51655 URL: http://llvm.org/viewvc/llvm-project?rev=51655&view=rev Log: Enable non-trivial inlining at -O2. Modified: llvm-gcc-4.2/trunk/gcc/opts.c Modified: llvm-gcc-4.2/trunk/gcc/opts.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/opts.c?rev=51655&r1=51654&r2=51655&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/opts.c (original) +++ llvm-gcc-4.2/trunk/gcc/opts.c Wed May 28 17:07:37 2008 @@ -526,6 +526,9 @@ /* Enable loop unrolling at -O2 if -f[no-]unroll-loops is not used. */ if (!flag_unroll_loops_set && !optimize_size) flag_unroll_loops = 1; + /* Enable llvm inliner at -O2. */ + if (cmdline) + flag_inline_functions = 1; /* LLVM LOCAL end */ } From evan.cheng at apple.com Wed May 28 17:07:56 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 15:07:56 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200805282159.35748.baldrick@free.fr> References: <200805272040.m4RKeD5x004160@zion.cs.uiuc.edu> <200805282030.01890.baldrick@free.fr> <200805282159.35748.baldrick@free.fr> Message-ID: <1AF53612-601F-4F32-9DCF-D7CA82459F13@apple.com> On May 28, 2008, at 12:59 PM, Duncan Sands wrote: > Hi Evan, I just noticed that C turns on > flag_inline_functions at -O3, so doesn't > your patch mean that there is no LLVM > inlining at -O2? Looks that way. I have fixed it. > > > Ciao, > > Duncan. > > PS: The Ada f-e never sets flag_inline_functions, > so I guess it's getting no LLVM inlining at all! Ok. Please fix it. :-) Thanks, Evan From isanbard at gmail.com Wed May 28 17:13:09 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 28 May 2008 22:13:09 -0000 Subject: [llvm-commits] [llvm] r51656 - /llvm/tags/Apple/llvmCore-2045/ Message-ID: <200805282213.m4SMD9HJ026542@zion.cs.uiuc.edu> Author: void Date: Wed May 28 17:13:09 2008 New Revision: 51656 URL: http://llvm.org/viewvc/llvm-project?rev=51656&view=rev Log: Creating llvmCore-2045 branch Added: llvm/tags/Apple/llvmCore-2045/ - copied from r51655, llvm/trunk/ From isanbard at gmail.com Wed May 28 17:13:16 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 28 May 2008 22:13:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r51657 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2045/ Message-ID: <200805282213.m4SMDGsn026561@zion.cs.uiuc.edu> Author: void Date: Wed May 28 17:13:15 2008 New Revision: 51657 URL: http://llvm.org/viewvc/llvm-project?rev=51657&view=rev Log: Creating llvmgcc42-2045 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2045/ - copied from r51656, llvm-gcc-4.2/trunk/ From resistor at mac.com Wed May 28 17:40:09 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 28 May 2008 22:40:09 -0000 Subject: [llvm-commits] [llvm] r51658 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200805282240.m4SMe9wv027626@zion.cs.uiuc.edu> Author: resistor Date: Wed May 28 17:40:08 2008 New Revision: 51658 URL: http://llvm.org/viewvc/llvm-project?rev=51658&view=rev Log: Remap VNInfo data as well when doing renumbering. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=51658&r1=51657&r2=51658&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed May 28 17:40:08 2008 @@ -114,6 +114,12 @@ LI != LE; ++LI) { LI->start = mi2iMap_[OldI2MI[LI->start]]; LI->end = mi2iMap_[OldI2MI[LI->end]]; + + VNInfo* vni = LI->valno; + vni->def = mi2iMap_[OldI2MI[vni->def]]; + + for (size_t i = 0; i < vni->kills.size(); ++i) + vni->kills[i] = mi2iMap_[OldI2MI[vni->kills[i]]]; } } From isanbard at gmail.com Wed May 28 17:52:47 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 28 May 2008 22:52:47 -0000 Subject: [llvm-commits] [llvm] r51659 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200805282252.m4SMql9J027953@zion.cs.uiuc.edu> Author: void Date: Wed May 28 17:52:47 2008 New Revision: 51659 URL: http://llvm.org/viewvc/llvm-project?rev=51659&view=rev Log: Check the "isSafeToMove" predicate, which has a series of tests to make sure that it's safe to remat an instruction. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51659&r1=51658&r2=51659&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed May 28 17:52:47 2008 @@ -330,8 +330,10 @@ InstructionRearranged: const TargetRegisterClass* rc = MF.getRegInfo().getRegClass(regA); MachineInstr *Orig = MRI->getVRegDef(regB); + bool SawStore = false; - if (EnableReMat && Orig && TII->isTriviallyReMaterializable(Orig)) { + if (EnableReMat && Orig && Orig->isSafeToMove(TII, SawStore) && + TII->isTriviallyReMaterializable(Orig)) { TII->reMaterialize(*mbbi, mi, regA, Orig); ReMattedInstrs.insert(Orig); } else { From isanbard at gmail.com Wed May 28 17:54:52 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 28 May 2008 22:54:52 -0000 Subject: [llvm-commits] [llvm] r51660 - in /llvm/trunk: include/llvm/Target/TargetInstrDesc.h lib/CodeGen/MachineInstr.cpp lib/Target/Target.td utils/TableGen/CodeGenInstruction.cpp utils/TableGen/CodeGenInstruction.h utils/TableGen/InstrInfoEmitter.cpp Message-ID: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> Author: void Date: Wed May 28 17:54:52 2008 New Revision: 51660 URL: http://llvm.org/viewvc/llvm-project?rev=51660&view=rev Log: Add a flag to indicate that an instruction is as cheap (or cheaper) than a move instruction to execute. This can be used for transformations (like two-address conversion) to remat an instruction instead of generating a "move" instruction. The idea is to decrease the live ranges and register pressure and all that jazz. Modified: llvm/trunk/include/llvm/Target/TargetInstrDesc.h llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/Target/Target.td llvm/trunk/utils/TableGen/CodeGenInstruction.cpp llvm/trunk/utils/TableGen/CodeGenInstruction.h llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetInstrDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrDesc.h?rev=51660&r1=51659&r2=51660&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrDesc.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrDesc.h Wed May 28 17:54:52 2008 @@ -95,7 +95,8 @@ Commutable, ConvertibleTo3Addr, UsesCustomDAGSchedInserter, - Rematerializable + Rematerializable, + CheapAsAMove }; } @@ -387,6 +388,15 @@ bool isRematerializable() const { return Flags & (1 << TID::Rematerializable); } + + /// isAsCheapAsAMove - Returns true if this instruction has the same cost (or + /// less) than a move instruction. This is useful during certain types of + /// rematerializations (e.g., during two-address conversion) where we would + /// like to remat the instruction, but not if it costs more than moving the + /// instruction into the appropriate register. + bool isAsCheapAsAMove() const { + return Flags & (1 << TID::CheapAsAMove); + } }; } // end namespace llvm Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=51660&r1=51659&r2=51660&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed May 28 17:54:52 2008 @@ -639,9 +639,9 @@ } } -/// isSafeToMove - Return true if it is safe to this instruction. If SawStore -/// true, it means there is a store (or call) between the instruction the -/// localtion and its intended destination. +/// isSafeToMove - Return true if it is safe to this instruction. If SawStore is +/// set to true, it means that there is a store (or call) between the +/// instruction's location and its intended destination. bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII, bool &SawStore) { // Ignore stuff that we obviously can't move. if (TID->mayStore() || TID->isCall()) { Modified: llvm/trunk/lib/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.td?rev=51660&r1=51659&r2=51660&view=diff ============================================================================== --- llvm/trunk/lib/Target/Target.td (original) +++ llvm/trunk/lib/Target/Target.td Wed May 28 17:54:52 2008 @@ -203,22 +203,25 @@ bit usesCustomDAGSchedInserter = 0; // Pseudo instr needing special help. bit hasCtrlDep = 0; // Does this instruction r/w ctrl-flow chains? bit isNotDuplicable = 0; // Is it unsafe to duplicate this instruction? + bit isAsCheapAsAMove = 0; // As cheap (or cheaper) than a move instruction. // Side effect flags - When set, the flags have these meanings: // // hasSideEffects - The instruction has side effects that are not // captured by any operands of the instruction or other flags. + // // mayHaveSideEffects - Some instances of the instruction can have side // effects. The virtual method "isReallySideEffectFree" is called to // determine this. Load instructions are an example of where this is // useful. In general, loads always have side effects. However, loads from // constant pools don't. Individual back ends make this determination. + // // neverHasSideEffects - Set on an instruction with no pattern if it has no // side effects. bit hasSideEffects = 0; bit mayHaveSideEffects = 0; bit neverHasSideEffects = 0; - + InstrItinClass Itinerary = NoItinerary;// Execution steps used for scheduling. string Constraints = ""; // OperandConstraint, e.g. $src = $dst. Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=51660&r1=51659&r2=51660&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Wed May 28 17:54:52 2008 @@ -99,6 +99,7 @@ hasSideEffects = R->getValueAsBit("hasSideEffects"); mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects"); neverHasSideEffects = R->getValueAsBit("neverHasSideEffects"); + isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove"); hasOptionalDef = false; isVariadic = false; Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.h?rev=51660&r1=51659&r2=51660&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.h (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.h Wed May 28 17:54:52 2008 @@ -102,7 +102,10 @@ bool hasCtrlDep; bool isNotDuplicable; bool hasOptionalDef; - bool hasSideEffects, mayHaveSideEffects, neverHasSideEffects; + bool hasSideEffects; + bool mayHaveSideEffects; + bool neverHasSideEffects; + bool isAsCheapAsAMove; /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar", /// where $foo is a whole operand and $foo.bar refers to a suboperand. Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=51660&r1=51659&r2=51660&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Wed May 28 17:54:52 2008 @@ -208,26 +208,27 @@ << ",\t\"" << Inst.TheDef->getName() << "\", 0"; // Emit all of the target indepedent flags... - if (Inst.isReturn) OS << "|(1< References: <200805280530.m4S5UgI0019004@zion.cs.uiuc.edu> <1EC50FA1-D554-4B58-BFD9-E31DF2756ED9@apple.com> <200805282041.14872.baldrick@free.fr> Message-ID: <6E718596-F4FC-4A5C-8E6D-EEBB92295F99@apple.com> On May 28, 2008, at 11:41 AM, Duncan Sands wrote: >> I guess the case that matters is when the CFE turns volatile struct >> assignment into a memcpy. We should probably add a isvolatile flag >> to >> llvm.memcpy/memmove/memset just for completeness. > > How about just outputting an explicit loop in that case? > Also, someone assigning volatile structs probably has > wrong expectations anyway: memcpy may copy the struct > a byte at a time while they are probably hoping for > field-at-a-time. For example they probably expect > integer fields to be written using one processor > operation (resulting in a consistent view of the > integer from other processors) but that may not be what > they get... I'd rather just add an i1 argument to llvm.mem* indicating whether it is volatile or not. I agree that people using this have dubious expectations, but adding the argument is simple and has clean semantics. -Chris From evan.cheng at apple.com Wed May 28 18:50:21 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 16:50:21 -0700 Subject: [llvm-commits] [llvm] r51660 - in /llvm/trunk: include/llvm/Target/TargetInstrDesc.h lib/CodeGen/MachineInstr.cpp lib/Target/Target.td utils/TableGen/CodeGenInstruction.cpp utils/TableGen/CodeGenInstruction.h utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> References: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> Message-ID: Please don't add another flag. For now, please check if an instruction is rematerializable && !mayload. Evan On May 28, 2008, at 3:54 PM, Bill Wendling wrote: > Author: void > Date: Wed May 28 17:54:52 2008 > New Revision: 51660 > > URL: http://llvm.org/viewvc/llvm-project?rev=51660&view=rev > Log: > Add a flag to indicate that an instruction is as cheap (or cheaper) > than a move > instruction to execute. This can be used for transformations (like > two-address > conversion) to remat an instruction instead of generating a "move" > instruction. The idea is to decrease the live ranges and register > pressure and > all that jazz. > > Modified: > llvm/trunk/include/llvm/Target/TargetInstrDesc.h > llvm/trunk/lib/CodeGen/MachineInstr.cpp > llvm/trunk/lib/Target/Target.td > llvm/trunk/utils/TableGen/CodeGenInstruction.cpp > llvm/trunk/utils/TableGen/CodeGenInstruction.h > llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp > > Modified: llvm/trunk/include/llvm/Target/TargetInstrDesc.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrDesc.h?rev=51660&r1=51659&r2=51660&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetInstrDesc.h (original) > +++ llvm/trunk/include/llvm/Target/TargetInstrDesc.h Wed May 28 > 17:54:52 2008 > @@ -95,7 +95,8 @@ > Commutable, > ConvertibleTo3Addr, > UsesCustomDAGSchedInserter, > - Rematerializable > + Rematerializable, > + CheapAsAMove > }; > } > > @@ -387,6 +388,15 @@ > bool isRematerializable() const { > return Flags & (1 << TID::Rematerializable); > } > + > + /// isAsCheapAsAMove - Returns true if this instruction has the > same cost (or > + /// less) than a move instruction. This is useful during certain > types of > + /// rematerializations (e.g., during two-address conversion) > where we would > + /// like to remat the instruction, but not if it costs more than > moving the > + /// instruction into the appropriate register. > + bool isAsCheapAsAMove() const { > + return Flags & (1 << TID::CheapAsAMove); > + } > }; > > } // end namespace llvm > > Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=51660&r1=51659&r2=51660&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed May 28 17:54:52 2008 > @@ -639,9 +639,9 @@ > } > } > > -/// isSafeToMove - Return true if it is safe to this instruction. > If SawStore > -/// true, it means there is a store (or call) between the > instruction the > -/// localtion and its intended destination. > +/// isSafeToMove - Return true if it is safe to this instruction. > If SawStore is > +/// set to true, it means that there is a store (or call) between the > +/// instruction's location and its intended destination. > bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII, bool > &SawStore) { > // Ignore stuff that we obviously can't move. > if (TID->mayStore() || TID->isCall()) { > > Modified: llvm/trunk/lib/Target/Target.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.td?rev=51660&r1=51659&r2=51660&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Target.td (original) > +++ llvm/trunk/lib/Target/Target.td Wed May 28 17:54:52 2008 > @@ -203,22 +203,25 @@ > bit usesCustomDAGSchedInserter = 0; // Pseudo instr needing > special help. > bit hasCtrlDep = 0; // Does this instruction r/w ctrl-flow > chains? > bit isNotDuplicable = 0; // Is it unsafe to duplicate this > instruction? > + bit isAsCheapAsAMove = 0; // As cheap (or cheaper) than a move > instruction. > > // Side effect flags - When set, the flags have these meanings: > // > // hasSideEffects - The instruction has side effects that are not > // captured by any operands of the instruction or other flags. > + // > // mayHaveSideEffects - Some instances of the instruction can > have side > // effects. The virtual method "isReallySideEffectFree" is > called to > // determine this. Load instructions are an example of where > this is > // useful. In general, loads always have side effects. However, > loads from > // constant pools don't. Individual back ends make this > determination. > + // > // neverHasSideEffects - Set on an instruction with no pattern if > it has no > // side effects. > bit hasSideEffects = 0; > bit mayHaveSideEffects = 0; > bit neverHasSideEffects = 0; > - > + > InstrItinClass Itinerary = NoItinerary;// Execution steps used for > scheduling. > > string Constraints = ""; // OperandConstraint, e.g. $src = $dst. > > Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=51660&r1=51659&r2=51660&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original) > +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Wed May 28 > 17:54:52 2008 > @@ -99,6 +99,7 @@ > hasSideEffects = R->getValueAsBit("hasSideEffects"); > mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects"); > neverHasSideEffects = R->getValueAsBit("neverHasSideEffects"); > + isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove"); > hasOptionalDef = false; > isVariadic = false; > > > Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.h?rev=51660&r1=51659&r2=51660&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/CodeGenInstruction.h (original) > +++ llvm/trunk/utils/TableGen/CodeGenInstruction.h Wed May 28 > 17:54:52 2008 > @@ -102,7 +102,10 @@ > bool hasCtrlDep; > bool isNotDuplicable; > bool hasOptionalDef; > - bool hasSideEffects, mayHaveSideEffects, neverHasSideEffects; > + bool hasSideEffects; > + bool mayHaveSideEffects; > + bool neverHasSideEffects; > + bool isAsCheapAsAMove; > > /// ParseOperandName - Parse an operand name like "$foo" or > "$foo.bar", > /// where $foo is a whole operand and $foo.bar refers to a > suboperand. > > Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=51660&r1=51659&r2=51660&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Wed May 28 > 17:54:52 2008 > @@ -208,26 +208,27 @@ > << ",\t\"" << Inst.TheDef->getName() << "\", 0"; > > // Emit all of the target indepedent flags... > - if (Inst.isReturn) OS << "|(1< - if (Inst.isBranch) OS << "|(1< - if (Inst.isIndirectBranch) OS << "|(1< - if (Inst.isBarrier) OS << "|(1< - if (Inst.hasDelaySlot) OS << "|(1< - if (Inst.isCall) OS << "|(1< - if (Inst.isSimpleLoad) OS << "|(1< - if (Inst.mayLoad) OS << "|(1< - if (Inst.mayStore) OS << "|(1< - if (Inst.isPredicable) OS << "|(1< + if (Inst.isReturn) OS << "|(1< + if (Inst.isBranch) OS << "|(1< + if (Inst.isIndirectBranch) OS << "|(1< + if (Inst.isBarrier) OS << "|(1< + if (Inst.hasDelaySlot) OS << "|(1< + if (Inst.isCall) OS << "|(1< + if (Inst.isSimpleLoad) OS << "|(1< + if (Inst.mayLoad) OS << "|(1< + if (Inst.mayStore) OS << "|(1< + if (Inst.isPredicable) OS << "|(1< if (Inst.isConvertibleToThreeAddress) OS << "| > (1< - if (Inst.isCommutable) OS << "|(1< - if (Inst.isTerminator) OS << "|(1< + if (Inst.isCommutable) OS << "|(1< + if (Inst.isTerminator) OS << "|(1< if (Inst.isReMaterializable) OS << "|(1< if (Inst.isNotDuplicable) OS << "|(1< if (Inst.hasOptionalDef) OS << "|(1< if (Inst.usesCustomDAGSchedInserter) > OS << "|(1< if (Inst.isVariadic) OS << "|(1< - if (Inst.hasSideEffects) OS << "| > (1< + if (Inst.hasSideEffects) OS << "| > (1< + if (Inst.isAsCheapAsAMove) OS << "|(1< OS << ", 0"; > > // Emit all of the target-specific flags... > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed May 28 18:56:50 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 16:56:50 -0700 Subject: [llvm-commits] [llvm] r51660 - in /llvm/trunk: include/llvm/Target/TargetInstrDesc.h lib/CodeGen/MachineInstr.cpp lib/Target/Target.td utils/TableGen/CodeGenInstruction.cpp utils/TableGen/CodeGenInstruction.h utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: References: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> Message-ID: <64D771FE-3B33-4D70-8EE8-102C8ACF141A@apple.com> On May 28, 2008, at 4:50 PM, Evan Cheng wrote: > Please don't add another flag. For now, please check if an instruction > is rematerializable && !mayload. Why? -Chris From ggreif at gmail.com Wed May 28 19:51:09 2008 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 29 May 2008 00:51:09 -0000 Subject: [llvm-commits] [llvm] r51661 - /llvm/trunk/lib/Analysis/ValueNumbering.cpp Message-ID: <200805290051.m4T0p9iP031109@zion.cs.uiuc.edu> Author: ggreif Date: Wed May 28 19:51:08 2008 New Revision: 51661 URL: http://llvm.org/viewvc/llvm-project?rev=51661&view=rev Log: convert another operand loop to iterator formulation Modified: llvm/trunk/lib/Analysis/ValueNumbering.cpp Modified: llvm/trunk/lib/Analysis/ValueNumbering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueNumbering.cpp?rev=51661&r1=51660&r2=51661&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueNumbering.cpp (original) +++ llvm/trunk/lib/Analysis/ValueNumbering.cpp Wed May 28 19:51:08 2008 @@ -244,9 +244,9 @@ // Try to pick a local operand if possible instead of a constant or a global // that might have a lot of uses. - for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i) - if (isa(I.getOperand(i)) || isa(I.getOperand(i))) { - Op = I.getOperand(i); + for (User::op_iterator i = I.op_begin() + 1, e = I.op_end(); i != e; ++i) + if (isa(*i) || isa(*i)) { + Op = *i; break; } From isanbard at gmail.com Wed May 28 20:02:09 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 29 May 2008 01:02:09 -0000 Subject: [llvm-commits] [llvm] r51662 - in /llvm/trunk/lib: CodeGen/TwoAddressInstructionPass.cpp Target/X86/X86InstrInfo.td Message-ID: <200805290102.m4T129Qs031402@zion.cs.uiuc.edu> Author: void Date: Wed May 28 20:02:09 2008 New Revision: 51662 URL: http://llvm.org/viewvc/llvm-project?rev=51662&view=rev Log: Implement "AsCheapAsAMove" for some obviously cheap instructions: xor and the like. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51662&r1=51661&r2=51662&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed May 28 20:02:09 2008 @@ -330,10 +330,13 @@ InstructionRearranged: const TargetRegisterClass* rc = MF.getRegInfo().getRegClass(regA); MachineInstr *Orig = MRI->getVRegDef(regB); + const TargetInstrDesc &OrigTID = Orig->getDesc(); bool SawStore = false; if (EnableReMat && Orig && Orig->isSafeToMove(TII, SawStore) && - TII->isTriviallyReMaterializable(Orig)) { + OrigTID.isAsCheapAsAMove() && !OrigTID.mayLoad() && + !OrigTID.isSimpleLoad()) { + DEBUG(cerr << "2addr: REMATTING : " << *Orig << "\n"); TII->reMaterialize(*mbbi, mi, regA, Orig); ReMattedInstrs.insert(Orig); } else { Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=51662&r1=51661&r2=51662&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed May 28 20:02:09 2008 @@ -1309,23 +1309,24 @@ def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src), "or{l}\t{$src, $dst|$dst, $src}", [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; -} +} // isTwoAddress = 0 -let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y -def XOR8rr : I<0x30, MRMDestReg, - (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), - "xor{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>; -def XOR16rr : I<0x31, MRMDestReg, - (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), - "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize; -def XOR32rr : I<0x31, MRMDestReg, - (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), - "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>; -} +let isAsCheapAsAMove = 1, + isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y + def XOR8rr : I<0x30, MRMDestReg, + (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), + "xor{b}\t{$src2, $dst|$dst, $src2}", + [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>; + def XOR16rr : I<0x31, MRMDestReg, + (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), + "xor{w}\t{$src2, $dst|$dst, $src2}", + [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize; + def XOR32rr : I<0x31, MRMDestReg, + (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), + "xor{l}\t{$src2, $dst|$dst, $src2}", + [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>; +} // isAsCheapAsAMove = 1, isCommutable = 1 def XOR8rm : I<0x32, MRMSrcMem , (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2), @@ -1334,33 +1335,37 @@ def XOR16rm : I<0x33, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize; + [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, + OpSize; def XOR32rm : I<0x33, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), "xor{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>; -def XOR8ri : Ii8<0x80, MRM6r, - (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), - "xor{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>; -def XOR16ri : Ii16<0x81, MRM6r, - (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), - "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize; -def XOR32ri : Ii32<0x81, MRM6r, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), - "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>; -def XOR16ri8 : Ii8<0x83, MRM6r, - (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), - "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>, - OpSize; -def XOR32ri8 : Ii8<0x83, MRM6r, - (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), - "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>; +let isAsCheapAsAMove = 1 in { + def XOR8ri : Ii8<0x80, MRM6r, + (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), + "xor{b}\t{$src2, $dst|$dst, $src2}", + [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>; + def XOR16ri : Ii16<0x81, MRM6r, + (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), + "xor{w}\t{$src2, $dst|$dst, $src2}", + [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize; + def XOR32ri : Ii32<0x81, MRM6r, + (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + "xor{l}\t{$src2, $dst|$dst, $src2}", + [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>; + def XOR16ri8 : Ii8<0x83, MRM6r, + (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), + "xor{w}\t{$src2, $dst|$dst, $src2}", + [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>, + OpSize; + def XOR32ri8 : Ii8<0x83, MRM6r, + (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), + "xor{l}\t{$src2, $dst|$dst, $src2}", + [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>; +} // isAsCheapAsAMove = 1 + let isTwoAddress = 0 in { def XOR8mr : I<0x30, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src), @@ -1397,7 +1402,7 @@ (outs), (ins i32mem:$dst, i32i8imm :$src), "xor{l}\t{$src, $dst|$dst, $src}", [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; -} +} // isTwoAddress = 0 } // Defs = [EFLAGS] // Shift instructions @@ -1412,7 +1417,7 @@ def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src), "shl{l}\t{%cl, $dst|$dst, %CL}", [(set GR32:$dst, (shl GR32:$src, CL))]>; -} +} // Uses = [CL] def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), "shl{b}\t{$src2, $dst|$dst, $src2}", @@ -1426,7 +1431,7 @@ [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>; // NOTE: We don't use shifts of a register by one, because 'add reg,reg' is // cheaper. -} +} // isConvertibleToThreeAddress = 1 let isTwoAddress = 0 in { let Uses = [CL] in { @@ -2482,7 +2487,7 @@ // Alias instructions that map movr0 to xor. // FIXME: remove when we can teach regalloc that xor reg, reg is ok. -let Defs = [EFLAGS], isReMaterializable = 1 in { +let Defs = [EFLAGS], isReMaterializable = 1, isAsCheapAsAMove = 1 in { def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins), "xor{b}\t$dst, $dst", [(set GR8:$dst, 0)]>; From clattner at apple.com Wed May 28 20:14:24 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 18:14:24 -0700 Subject: [llvm-commits] [llvm] r51662 - in /llvm/trunk/lib: CodeGen/TwoAddressInstructionPass.cpp Target/X86/X86InstrInfo.td In-Reply-To: <200805290102.m4T129Qs031402@zion.cs.uiuc.edu> References: <200805290102.m4T129Qs031402@zion.cs.uiuc.edu> Message-ID: <3ADDDC2E-ADEF-4A00-B87C-C26F148F2263@apple.com> On May 28, 2008, at 6:02 PM, Bill Wendling wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=51662&view=rev > Log: > Implement "AsCheapAsAMove" for some obviously cheap instructions: > xor and the > like. Hey Bill, I don't think the "xorRI" instructions shoudl qualify, just the "zero reg" xors, and the "movRI" instructions. What do you think Evan? -Chris > > > Modified: > llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > llvm/trunk/lib/Target/X86/X86InstrInfo.td > > Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=51662&r1=51661&r2=51662&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) > +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed May 28 > 20:02:09 2008 > @@ -330,10 +330,13 @@ > InstructionRearranged: > const TargetRegisterClass* rc = > MF.getRegInfo().getRegClass(regA); > MachineInstr *Orig = MRI->getVRegDef(regB); > + const TargetInstrDesc &OrigTID = Orig->getDesc(); > bool SawStore = false; > > if (EnableReMat && Orig && Orig->isSafeToMove(TII, > SawStore) && > - TII->isTriviallyReMaterializable(Orig)) { > + OrigTID.isAsCheapAsAMove() && !OrigTID.mayLoad() && > + !OrigTID.isSimpleLoad()) { > + DEBUG(cerr << "2addr: REMATTING : " << *Orig << "\n"); > TII->reMaterialize(*mbbi, mi, regA, Orig); > ReMattedInstrs.insert(Orig); > } else { > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=51662&r1=51661&r2=51662&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed May 28 20:02:09 2008 > @@ -1309,23 +1309,24 @@ > def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm: > $src), > "or{l}\t{$src, $dst|$dst, $src}", > [(store (or (load addr:$dst), i32immSExt8:$src), > addr:$dst)]>; > -} > +} // isTwoAddress = 0 > > > -let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y > -def XOR8rr : I<0x30, MRMDestReg, > - (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), > - "xor{b}\t{$src2, $dst|$dst, $src2}", > - [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>; > -def XOR16rr : I<0x31, MRMDestReg, > - (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), > - "xor{w}\t{$src2, $dst|$dst, $src2}", > - [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, > OpSize; > -def XOR32rr : I<0x31, MRMDestReg, > - (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), > - "xor{l}\t{$src2, $dst|$dst, $src2}", > - [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>; > -} > +let isAsCheapAsAMove = 1, > + isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y > + def XOR8rr : I<0x30, MRMDestReg, > + (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), > + "xor{b}\t{$src2, $dst|$dst, $src2}", > + [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>; > + def XOR16rr : I<0x31, MRMDestReg, > + (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), > + "xor{w}\t{$src2, $dst|$dst, $src2}", > + [(set GR16:$dst, (xor GR16:$src1, > GR16:$src2))]>, OpSize; > + def XOR32rr : I<0x31, MRMDestReg, > + (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), > + "xor{l}\t{$src2, $dst|$dst, $src2}", > + [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>; > +} // isAsCheapAsAMove = 1, isCommutable = 1 > > def XOR8rm : I<0x32, MRMSrcMem , > (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2), > @@ -1334,33 +1335,37 @@ > def XOR16rm : I<0x33, MRMSrcMem , > (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), > "xor{w}\t{$src2, $dst|$dst, $src2}", > - [(set GR16:$dst, (xor GR16:$src1, (load addr: > $src2)))]>, OpSize; > + [(set GR16:$dst, (xor GR16:$src1, (load addr: > $src2)))]>, > + OpSize; > def XOR32rm : I<0x33, MRMSrcMem , > (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), > "xor{l}\t{$src2, $dst|$dst, $src2}", > [(set GR32:$dst, (xor GR32:$src1, (load addr: > $src2)))]>; > > -def XOR8ri : Ii8<0x80, MRM6r, > - (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), > - "xor{b}\t{$src2, $dst|$dst, $src2}", > - [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>; > -def XOR16ri : Ii16<0x81, MRM6r, > - (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), > - "xor{w}\t{$src2, $dst|$dst, $src2}", > - [(set GR16:$dst, (xor GR16:$src1, imm: > $src2))]>, OpSize; > -def XOR32ri : Ii32<0x81, MRM6r, > - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), > - "xor{l}\t{$src2, $dst|$dst, $src2}", > - [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>; > -def XOR16ri8 : Ii8<0x83, MRM6r, > - (outs GR16:$dst), (ins GR16:$src1, i16i8imm: > $src2), > - "xor{w}\t{$src2, $dst|$dst, $src2}", > - [(set GR16:$dst, (xor GR16:$src1, > i16immSExt8:$src2))]>, > - OpSize; > -def XOR32ri8 : Ii8<0x83, MRM6r, > - (outs GR32:$dst), (ins GR32:$src1, i32i8imm: > $src2), > - "xor{l}\t{$src2, $dst|$dst, $src2}", > - [(set GR32:$dst, (xor GR32:$src1, > i32immSExt8:$src2))]>; > +let isAsCheapAsAMove = 1 in { > + def XOR8ri : Ii8<0x80, MRM6r, > + (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), > + "xor{b}\t{$src2, $dst|$dst, $src2}", > + [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>; > + def XOR16ri : Ii16<0x81, MRM6r, > + (outs GR16:$dst), (ins GR16:$src1, i16imm: > $src2), > + "xor{w}\t{$src2, $dst|$dst, $src2}", > + [(set GR16:$dst, (xor GR16:$src1, imm: > $src2))]>, OpSize; > + def XOR32ri : Ii32<0x81, MRM6r, > + (outs GR32:$dst), (ins GR32:$src1, i32imm: > $src2), > + "xor{l}\t{$src2, $dst|$dst, $src2}", > + [(set GR32:$dst, (xor GR32:$src1, imm: > $src2))]>; > + def XOR16ri8 : Ii8<0x83, MRM6r, > + (outs GR16:$dst), (ins GR16:$src1, i16i8imm: > $src2), > + "xor{w}\t{$src2, $dst|$dst, $src2}", > + [(set GR16:$dst, (xor GR16:$src1, > i16immSExt8:$src2))]>, > + OpSize; > + def XOR32ri8 : Ii8<0x83, MRM6r, > + (outs GR32:$dst), (ins GR32:$src1, i32i8imm: > $src2), > + "xor{l}\t{$src2, $dst|$dst, $src2}", > + [(set GR32:$dst, (xor GR32:$src1, > i32immSExt8:$src2))]>; > +} // isAsCheapAsAMove = 1 > + > let isTwoAddress = 0 in { > def XOR8mr : I<0x30, MRMDestMem, > (outs), (ins i8mem :$dst, GR8 :$src), > @@ -1397,7 +1402,7 @@ > (outs), (ins i32mem:$dst, i32i8imm :$src), > "xor{l}\t{$src, $dst|$dst, $src}", > [(store (xor (load addr:$dst), i32immSExt8:$src), > addr:$dst)]>; > -} > +} // isTwoAddress = 0 > } // Defs = [EFLAGS] > > // Shift instructions > @@ -1412,7 +1417,7 @@ > def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src), > "shl{l}\t{%cl, $dst|$dst, %CL}", > [(set GR32:$dst, (shl GR32:$src, CL))]>; > -} > +} // Uses = [CL] > > def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, > i8imm:$src2), > "shl{b}\t{$src2, $dst|$dst, $src2}", > @@ -1426,7 +1431,7 @@ > [(set GR32:$dst, (shl GR32:$src1, (i8 imm: > $src2)))]>; > // NOTE: We don't use shifts of a register by one, because 'add > reg,reg' is > // cheaper. > -} > +} // isConvertibleToThreeAddress = 1 > > let isTwoAddress = 0 in { > let Uses = [CL] in { > @@ -2482,7 +2487,7 @@ > > // Alias instructions that map movr0 to xor. > // FIXME: remove when we can teach regalloc that xor reg, reg is ok. > -let Defs = [EFLAGS], isReMaterializable = 1 in { > +let Defs = [EFLAGS], isReMaterializable = 1, isAsCheapAsAMove = 1 > in { > def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins), > "xor{b}\t$dst, $dst", > [(set GR8:$dst, 0)]>; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed May 28 20:22:37 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 18:22:37 -0700 Subject: [llvm-commits] [llvm] r51660 - in /llvm/trunk: include/llvm/Target/TargetInstrDesc.h lib/CodeGen/MachineInstr.cpp lib/Target/Target.td utils/TableGen/CodeGenInstruction.cpp utils/TableGen/CodeGenInstruction.h utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <64D771FE-3B33-4D70-8EE8-102C8ACF141A@apple.com> References: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> <64D771FE-3B33-4D70-8EE8-102C8ACF141A@apple.com> Message-ID: <2651206B-F168-49E7-B367-102F9800BDCB@apple.com> Why do we want another flag? In two-address pass, we want to remat the def instead of copying its value if the instruction is *cheap*. Most of the rematerializable instructions are cheap. But I don't think we want to remat load from constantpool here, do we? In the long run, we want proper cost information for every instruction instead of Rematerializable and / or CheapAsMove. Then we can replace the whole mess with proper checks. Until then, I don't see something like CheapAsAMove buys us. Evan On May 28, 2008, at 4:56 PM, Chris Lattner wrote: > > On May 28, 2008, at 4:50 PM, Evan Cheng wrote: > >> Please don't add another flag. For now, please check if an >> instruction >> is rematerializable && !mayload. > > Why? > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed May 28 20:26:37 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 18:26:37 -0700 Subject: [llvm-commits] [llvm] r51660 - in /llvm/trunk: include/llvm/Target/TargetInstrDesc.h lib/CodeGen/MachineInstr.cpp lib/Target/Target.td utils/TableGen/CodeGenInstruction.cpp utils/TableGen/CodeGenInstruction.h utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <2651206B-F168-49E7-B367-102F9800BDCB@apple.com> References: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> <64D771FE-3B33-4D70-8EE8-102C8ACF141A@apple.com> <2651206B-F168-49E7-B367-102F9800BDCB@apple.com> Message-ID: On May 28, 2008, at 6:22 PM, Evan Cheng wrote: > Why do we want another flag? In two-address pass, we want to remat the > def instead of copying its value if the instruction is *cheap*. > > Most of the rematerializable instructions are cheap. But I don't think > we want to remat load from constantpool here, do we? > > In the long run, we want proper cost information for every instruction > instead of Rematerializable and / or CheapAsMove. Then we can replace > the whole mess with proper checks. Until then, I don't see something > like CheapAsAMove buys us. This is specifically trying to decide if the instruction is as cheap as a move. If the instruction is more expensive (e.g. an add or xor) it should not have this. We want to eventually remat adds and xors when register pressure is high... these are very different concepts. Does that seem reasonable? -Chris > > > Evan > > On May 28, 2008, at 4:56 PM, Chris Lattner wrote: > >> >> On May 28, 2008, at 4:50 PM, Evan Cheng wrote: >> >>> Please don't add another flag. For now, please check if an >>> instruction >>> is rematerializable && !mayload. >> >> Why? >> >> -Chris >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From ggreif at gmail.com Wed May 28 20:59:19 2008 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 29 May 2008 01:59:19 -0000 Subject: [llvm-commits] [llvm] r51663 - in /llvm/trunk/lib/Transforms/IPO: ArgumentPromotion.cpp GlobalOpt.cpp Message-ID: <200805290159.m4T1xJRI000412@zion.cs.uiuc.edu> Author: ggreif Date: Wed May 28 20:59:18 2008 New Revision: 51663 URL: http://llvm.org/viewvc/llvm-project?rev=51663&view=rev Log: convert more operand loops to iterator formulation Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=51663&r1=51662&r2=51663&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Wed May 28 20:59:18 2008 @@ -262,8 +262,9 @@ } // Ensure that all of the indices are constants. SmallVector Operands; - for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i) - if (ConstantInt *C = dyn_cast(GEP->getOperand(i))) + for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end(); + i != e; ++i) + if (ConstantInt *C = dyn_cast(*i)) Operands.push_back(C); else return false; // Not a constant operand GEP! Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=51663&r1=51662&r2=51663&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed May 28 20:59:18 2008 @@ -704,8 +704,9 @@ // Should handle GEP here. SmallVector Idxs; Idxs.reserve(GEPI->getNumOperands()-1); - for (unsigned i = 1, e = GEPI->getNumOperands(); i != e; ++i) - if (Constant *C = dyn_cast(GEPI->getOperand(i))) + for (User::op_iterator i = GEPI->op_begin() + 1, e = GEPI->op_end(); + i != e; ++i) + if (Constant *C = dyn_cast(*i)) Idxs.push_back(C); else break; @@ -984,8 +985,8 @@ if (LoadInst *LI = dyn_cast(*UI)) { // We permit two users of the load: setcc comparing against the null // pointer, and a getelementptr of a specific form. - for (Value::use_iterator UI = LI->use_begin(), E = LI->use_end(); UI != E; - ++UI) { + for (Value::use_iterator UI = LI->use_begin(), E = LI->use_end(); + UI != E; ++UI) { // Comparison against null is ok. if (ICmpInst *ICI = dyn_cast(*UI)) { if (!isa(ICI->getOperand(1))) @@ -1279,9 +1280,10 @@ else if (GetElementPtrInst *GEPI =dyn_cast(StoredOnceVal)){ // "getelementptr Ptr, 0, 0, 0" is really just a cast. bool IsJustACast = true; - for (unsigned i = 1, e = GEPI->getNumOperands(); i != e; ++i) - if (!isa(GEPI->getOperand(i)) || - !cast(GEPI->getOperand(i))->isNullValue()) { + for (User::op_iterator i = GEPI->op_begin() + 1, e = GEPI->op_end(); + i != e; ++i) + if (!isa(*i) || + !cast(*i)->isNullValue()) { IsJustACast = false; break; } @@ -1606,8 +1608,9 @@ if (!isa(User) && !isa(User)) return false; // See if the function address is passed as an argument. - for (unsigned i = 1, e = User->getNumOperands(); i != e; ++i) - if (User->getOperand(i) == F) return false; + for (User::op_iterator i = User->op_begin() + 1, e = User->op_end(); + i != e; ++i) + if (*i == F) return false; } return true; } @@ -1712,8 +1715,8 @@ if (!I->hasInitializer()) return 0; ConstantArray *CA = dyn_cast(I->getInitializer()); if (!CA) return 0; - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - if (ConstantStruct *CS = dyn_cast(CA->getOperand(i))) { + for (User::op_iterator i = CA->op_begin(), e = CA->op_end(); i != e; ++i) + if (ConstantStruct *CS = dyn_cast(*i)) { if (isa(CS->getOperand(1))) continue; @@ -1740,8 +1743,8 @@ ConstantArray *CA = cast(GV->getInitializer()); std::vector Result; Result.reserve(CA->getNumOperands()); - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) { - ConstantStruct *CS = cast(CA->getOperand(i)); + for (User::op_iterator i = CA->op_begin(), e = CA->op_end(); i != e; ++i) { + ConstantStruct *CS = cast(*i); Result.push_back(dyn_cast(CS->getOperand(1))); } return Result; @@ -1854,8 +1857,8 @@ // Break up the constant into its elements. if (ConstantStruct *CS = dyn_cast(Init)) { - for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) - Elts.push_back(CS->getOperand(i)); + for (User::op_iterator i = CS->op_begin(), e = CS->op_end(); i != e; ++i) + Elts.push_back(cast(*i)); } else if (isa(Init)) { for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) Elts.push_back(Constant::getNullValue(STy->getElementType(i))); @@ -1882,8 +1885,8 @@ // Break up the array into elements. std::vector Elts; if (ConstantArray *CA = dyn_cast(Init)) { - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - Elts.push_back(CA->getOperand(i)); + for (User::op_iterator i = CA->op_begin(), e = CA->op_end(); i != e; ++i) + Elts.push_back(cast(*i)); } else if (isa(Init)) { Constant *Elt = Constant::getNullValue(ATy->getElementType()); Elts.assign(ATy->getNumElements(), Elt); @@ -2011,8 +2014,9 @@ } else if (GetElementPtrInst *GEP = dyn_cast(CurInst)) { Constant *P = getVal(Values, GEP->getOperand(0)); SmallVector GEPOps; - for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i) - GEPOps.push_back(getVal(Values, GEP->getOperand(i))); + for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end(); + i != e; ++i) + GEPOps.push_back(getVal(Values, *i)); InstResult = ConstantExpr::getGetElementPtr(P, &GEPOps[0], GEPOps.size()); } else if (LoadInst *LI = dyn_cast(CurInst)) { if (LI->isVolatile()) return false; // no volatile accesses. @@ -2036,8 +2040,9 @@ if (!Callee) return false; // Cannot resolve. std::vector Formals; - for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i) - Formals.push_back(getVal(Values, CI->getOperand(i))); + for (User::op_iterator i = CI->op_begin() + 1, e = CI->op_end(); + i != e; ++i) + Formals.push_back(getVal(Values, *i)); if (Callee->isDeclaration()) { // If this is a function we can constant fold, do it. From evan.cheng at apple.com Wed May 28 21:25:19 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 28 May 2008 19:25:19 -0700 Subject: [llvm-commits] [llvm] r51660 - in /llvm/trunk: include/llvm/Target/TargetInstrDesc.h lib/CodeGen/MachineInstr.cpp lib/Target/Target.td utils/TableGen/CodeGenInstruction.cpp utils/TableGen/CodeGenInstruction.h utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: References: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> <64D771FE-3B33-4D70-8EE8-102C8ACF141A@apple.com> <2651206B-F168-49E7-B367-102F9800BDCB@apple.com> Message-ID: Fine with me as long as we eventually replace all these TargetInstrDesc flags when we have proper instruction cost estimates. Evan On May 28, 2008, at 6:26 PM, Chris Lattner wrote: > > On May 28, 2008, at 6:22 PM, Evan Cheng wrote: > >> Why do we want another flag? In two-address pass, we want to remat >> the >> def instead of copying its value if the instruction is *cheap*. >> >> Most of the rematerializable instructions are cheap. But I don't >> think >> we want to remat load from constantpool here, do we? >> >> In the long run, we want proper cost information for every >> instruction >> instead of Rematerializable and / or CheapAsMove. Then we can replace >> the whole mess with proper checks. Until then, I don't see something >> like CheapAsAMove buys us. > > This is specifically trying to decide if the instruction is as cheap > as a move. If the instruction is more expensive (e.g. an add or xor) > it should not have this. > > We want to eventually remat adds and xors when register pressure is > high... these are very different concepts. Does that seem reasonable? > > -Chris > >> >> >> Evan >> >> On May 28, 2008, at 4:56 PM, Chris Lattner wrote: >> >>> >>> On May 28, 2008, at 4:50 PM, Evan Cheng wrote: >>> >>>> Please don't add another flag. For now, please check if an >>>> instruction >>>> is rematerializable && !mayload. >>> >>> Why? >>> >>> -Chris >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Wed May 28 22:46:37 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 29 May 2008 03:46:37 -0000 Subject: [llvm-commits] [llvm] r51664 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td Message-ID: <200805290346.m4T3kbLS003439@zion.cs.uiuc.edu> Author: void Date: Wed May 28 22:46:36 2008 New Revision: 51664 URL: http://llvm.org/viewvc/llvm-project?rev=51664&view=rev Log: XOR?RI instructions aren't as cheap as moves. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=51664&r1=51663&r2=51664&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed May 28 22:46:36 2008 @@ -1342,29 +1342,27 @@ "xor{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>; -let isAsCheapAsAMove = 1 in { - def XOR8ri : Ii8<0x80, MRM6r, - (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), - "xor{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>; - def XOR16ri : Ii16<0x81, MRM6r, - (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), - "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize; - def XOR32ri : Ii32<0x81, MRM6r, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), - "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>; - def XOR16ri8 : Ii8<0x83, MRM6r, - (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), - "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>, - OpSize; - def XOR32ri8 : Ii8<0x83, MRM6r, - (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), - "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>; -} // isAsCheapAsAMove = 1 +def XOR8ri : Ii8<0x80, MRM6r, + (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), + "xor{b}\t{$src2, $dst|$dst, $src2}", + [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>; +def XOR16ri : Ii16<0x81, MRM6r, + (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), + "xor{w}\t{$src2, $dst|$dst, $src2}", + [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize; +def XOR32ri : Ii32<0x81, MRM6r, + (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + "xor{l}\t{$src2, $dst|$dst, $src2}", + [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>; +def XOR16ri8 : Ii8<0x83, MRM6r, + (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), + "xor{w}\t{$src2, $dst|$dst, $src2}", + [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>, + OpSize; +def XOR32ri8 : Ii8<0x83, MRM6r, + (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), + "xor{l}\t{$src2, $dst|$dst, $src2}", + [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>; let isTwoAddress = 0 in { def XOR8mr : I<0x30, MRMDestMem, From isanbard at gmail.com Wed May 28 22:47:32 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 28 May 2008 20:47:32 -0700 Subject: [llvm-commits] [llvm] r51662 - in /llvm/trunk/lib: CodeGen/TwoAddressInstructionPass.cpp Target/X86/X86InstrInfo.td In-Reply-To: <3ADDDC2E-ADEF-4A00-B87C-C26F148F2263@apple.com> References: <200805290102.m4T129Qs031402@zion.cs.uiuc.edu> <3ADDDC2E-ADEF-4A00-B87C-C26F148F2263@apple.com> Message-ID: <0BD73256-4D30-46FF-B4CD-BEC2F6DEACBA@gmail.com> On May 28, 2008, at 6:14 PM, Chris Lattner wrote: > On May 28, 2008, at 6:02 PM, Bill Wendling wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=51662&view=rev >> Log: >> Implement "AsCheapAsAMove" for some obviously cheap instructions: >> xor and the >> like. > > Hey Bill, > > I don't think the "xorRI" instructions shoudl qualify, just the "zero > reg" xors, and the "movRI" instructions. What do you think Evan? > Sure. Done. -bw From clattner at apple.com Thu May 29 00:09:01 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 28 May 2008 22:09:01 -0700 Subject: [llvm-commits] [llvm] r51660 - in /llvm/trunk: include/llvm/Target/TargetInstrDesc.h lib/CodeGen/MachineInstr.cpp lib/Target/Target.td utils/TableGen/CodeGenInstruction.cpp utils/TableGen/CodeGenInstruction.h utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: References: <200805282254.m4SMsrsq028025@zion.cs.uiuc.edu> <64D771FE-3B33-4D70-8EE8-102C8ACF141A@apple.com> <2651206B-F168-49E7-B367-102F9800BDCB@apple.com> Message-ID: <5F58DDE7-E7B5-426F-BD46-4E3A2C62AE4D@apple.com> On May 28, 2008, at 7:25 PM, Evan Cheng wrote: > Fine with me as long as we eventually replace all these > TargetInstrDesc flags when we have proper instruction cost estimates. Makes sense. -Chris From evan.cheng at apple.com Thu May 29 02:09:26 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 29 May 2008 07:09:26 -0000 Subject: [llvm-commits] [llvm] r51665 - in /llvm/trunk/test/CodeGen/X86: vec_ctbits.ll vec_insert-2.ll Message-ID: <200805290709.m4T79QOl009334@zion.cs.uiuc.edu> Author: evancheng Date: Thu May 29 02:09:24 2008 New Revision: 51665 URL: http://llvm.org/viewvc/llvm-project?rev=51665&view=rev Log: Add nounwind. Modified: llvm/trunk/test/CodeGen/X86/vec_ctbits.ll llvm/trunk/test/CodeGen/X86/vec_insert-2.ll Modified: llvm/trunk/test/CodeGen/X86/vec_ctbits.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_ctbits.ll?rev=51665&r1=51664&r2=51665&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_ctbits.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_ctbits.ll Thu May 29 02:09:24 2008 @@ -4,15 +4,15 @@ declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>) declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>) -define <2 x i64> @footz(<2 x i64> %a) { +define <2 x i64> @footz(<2 x i64> %a) nounwind { %c = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a) ret <2 x i64> %c } -define <2 x i64> @foolz(<2 x i64> %a) { +define <2 x i64> @foolz(<2 x i64> %a) nounwind { %c = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a) ret <2 x i64> %c } -define <2 x i64> @foopop(<2 x i64> %a) { +define <2 x i64> @foopop(<2 x i64> %a) nounwind { %c = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a) ret <2 x i64> %c } Modified: llvm/trunk/test/CodeGen/X86/vec_insert-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_insert-2.ll?rev=51665&r1=51664&r2=51665&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_insert-2.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_insert-2.ll Thu May 29 02:09:24 2008 @@ -5,22 +5,22 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movhpd | count 1 ; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep unpcklpd | count 1 -define <4 x float> @t1(float %s, <4 x float> %tmp) { +define <4 x float> @t1(float %s, <4 x float> %tmp) nounwind { %tmp1 = insertelement <4 x float> %tmp, float %s, i32 3 ret <4 x float> %tmp1 } -define <4 x i32> @t2(i32 %s, <4 x i32> %tmp) { +define <4 x i32> @t2(i32 %s, <4 x i32> %tmp) nounwind { %tmp1 = insertelement <4 x i32> %tmp, i32 %s, i32 3 ret <4 x i32> %tmp1 } -define <2 x double> @t3(double %s, <2 x double> %tmp) { +define <2 x double> @t3(double %s, <2 x double> %tmp) nounwind { %tmp1 = insertelement <2 x double> %tmp, double %s, i32 1 ret <2 x double> %tmp1 } -define <8 x i16> @t4(i16 %s, <8 x i16> %tmp) { +define <8 x i16> @t4(i16 %s, <8 x i16> %tmp) nounwind { %tmp1 = insertelement <8 x i16> %tmp, i16 %s, i32 5 ret <8 x i16> %tmp1 } From resistor at mac.com Thu May 29 03:15:50 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 29 May 2008 08:15:50 -0000 Subject: [llvm-commits] [llvm] r51666 - /llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Message-ID: <200805290815.m4T8Fo91019514@zion.cs.uiuc.edu> Author: resistor Date: Thu May 29 03:15:48 2008 New Revision: 51666 URL: http://llvm.org/viewvc/llvm-project?rev=51666&view=rev Log: Remove debugging code. Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=51666&r1=51665&r2=51666&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Thu May 29 03:15:48 2008 @@ -258,12 +258,8 @@ // NOTE: This iteration is safe because erasing the block does not remove its // entry from the loop's block list. We do that in the next section. for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end(); - LI != LE; ++LI) { - for (Value::use_iterator UI = (*LI)->use_begin(), UE = (*LI)->use_end(); - UI != UE; ++UI) - (*UI)->dump(); + LI != LE; ++LI) (*LI)->eraseFromParent(); - } // Finally, the blocks from loopinfo. This has to happen late because // otherwise our loop iterators won't work. From evan.cheng at apple.com Thu May 29 03:22:04 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 29 May 2008 08:22:04 -0000 Subject: [llvm-commits] [llvm] r51667 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrMMX.td lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/mmx-insert-element.ll test/CodeGen/X86/vec_clear.ll test/CodeGen/X86/vec_insert-3.ll test/CodeGen/X86/vec_insert-5.ll test/CodeGen/X86/vec_insert-6.ll Message-ID: <200805290822.m4T8M5B9019716@zion.cs.uiuc.edu> Author: evancheng Date: Thu May 29 03:22:04 2008 New Revision: 51667 URL: http://llvm.org/viewvc/llvm-project?rev=51667&view=rev Log: Implement vector shift up / down and insert zero with ps{rl}lq / ps{rl}ldq. Added: llvm/trunk/test/CodeGen/X86/vec_insert-5.ll llvm/trunk/test/CodeGen/X86/vec_insert-6.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrMMX.td llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/CodeGen/X86/mmx-insert-element.ll llvm/trunk/test/CodeGen/X86/vec_clear.ll llvm/trunk/test/CodeGen/X86/vec_insert-3.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu May 29 03:22:04 2008 @@ -1853,10 +1853,17 @@ unsigned NumElems = PermMask.getNumOperands(); SDOperand V = (Idx < NumElems) ? N->getOperand(0) : N->getOperand(1); Idx %= NumElems; - if (V.getOpcode() == ISD::SCALAR_TO_VECTOR) { - return (Idx == 0) - ? V.getOperand(0) : getNode(ISD::UNDEF, MVT::getVectorElementType(VT)); - } + + if (V.getOpcode() == ISD::BIT_CONVERT) { + V = V.getOperand(0); + if (MVT::getVectorNumElements(V.getValueType()) != NumElems) + return SDOperand(); + } + if (V.getOpcode() == ISD::SCALAR_TO_VECTOR) + return (Idx == 0) ? V.getOperand(0) + : getNode(ISD::UNDEF, MVT::getVectorElementType(VT)); + if (V.getOpcode() == ISD::BUILD_VECTOR) + return V.getOperand(Idx); if (V.getOpcode() == ISD::VECTOR_SHUFFLE) { SDOperand Elt = PermMask.getOperand(Idx); if (Elt.getOpcode() == ISD::UNDEF) Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu May 29 03:22:04 2008 @@ -2923,6 +2923,70 @@ return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, Mask); } +/// getNumOfConsecutiveZeros - Return the number of elements in a result of +/// a shuffle that is zero. +static +unsigned getNumOfConsecutiveZeros(SDOperand Op, SDOperand Mask, + unsigned NumElems, bool Low, + SelectionDAG &DAG) { + unsigned NumZeros = 0; + for (unsigned i = 0; i < NumElems; ++i) { + SDOperand Idx = Mask.getOperand(Low ? i : NumElems-i-1); + if (Idx.getOpcode() == ISD::UNDEF) { + ++NumZeros; + continue; + } + unsigned Index = cast(Idx)->getValue(); + SDOperand Elt = DAG.getShuffleScalarElt(Op.Val, Index); + if (Elt.Val && isZeroNode(Elt)) + ++NumZeros; + else + break; + } + return NumZeros; +} + +/// isVectorShift - Returns true if the shuffle can be implemented as a +/// logical left or right shift of a vector. +static bool isVectorShift(SDOperand Op, SDOperand Mask, SelectionDAG &DAG, + bool &isLeft, SDOperand &ShVal, unsigned &ShAmt) { + unsigned NumElems = Mask.getNumOperands(); + + isLeft = true; + unsigned NumZeros= getNumOfConsecutiveZeros(Op, Mask, NumElems, true, DAG); + if (!NumZeros) { + isLeft = false; + NumZeros = getNumOfConsecutiveZeros(Op, Mask, NumElems, false, DAG); + if (!NumZeros) + return false; + } + + bool SeenV1 = false; + bool SeenV2 = false; + for (unsigned i = NumZeros; i < NumElems; ++i) { + unsigned Val = isLeft ? (i - NumZeros) : i; + SDOperand Idx = Mask.getOperand(isLeft ? i : (i - NumZeros)); + if (Idx.getOpcode() == ISD::UNDEF) + continue; + unsigned Index = cast(Idx)->getValue(); + if (Index < NumElems) + SeenV1 = true; + else { + Index -= NumElems; + SeenV2 = true; + } + if (Index != Val) + return false; + } + if (SeenV1 && SeenV2) + return false; + + ShVal = SeenV1 ? Op.getOperand(0) : Op.getOperand(1); + ShAmt = NumZeros; + return true; +} + + /// LowerBuildVectorv16i8 - Custom lower build_vector of v16i8. /// static SDOperand LowerBuildVectorv16i8(SDOperand Op, unsigned NonZeros, @@ -2995,6 +3059,20 @@ return V; } +/// getVShift - Return a vector logical shift node. +/// +static SDOperand getVShift(bool isLeft, MVT::ValueType VT, SDOperand SrcOp, + unsigned NumBits, SelectionDAG &DAG, + const TargetLowering &TLI) { + bool isMMX = MVT::getSizeInBits(VT) == 64; + MVT::ValueType ShVT = isMMX ? MVT::v1i64 : MVT::v2i64; + unsigned Opc = isLeft ? X86ISD::VSHL : X86ISD::VSRL; + SrcOp = DAG.getNode(ISD::BIT_CONVERT, ShVT, SrcOp); + return DAG.getNode(ISD::BIT_CONVERT, VT, + DAG.getNode(Opc, ShVT, SrcOp, + DAG.getConstant(NumBits, TLI.getShiftAmountTy()))); +} + SDOperand X86TargetLowering::LowerBUILD_VECTOR(SDOperand Op, SelectionDAG &DAG) { // All zero's are handled with pxor, all one's are handled with pcmpeqd. @@ -3091,6 +3169,15 @@ return getShuffleVectorZeroOrUndef(Item, 0, NumZero > 0, Subtarget->hasSSE2(), DAG); } + + // Is it a vector logical left shift? + if (NumElems == 2 && Idx == 1 && + isZeroNode(Op.getOperand(0)) && !isZeroNode(Op.getOperand(1))) { + unsigned NumBits = MVT::getSizeInBits(VT); + return getVShift(true, VT, + DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, Op.getOperand(1)), + NumBits/2, DAG, *this); + } if (IsAllConstants) // Otherwise, it's better to do a constpool load. return SDOperand(); @@ -3615,6 +3702,19 @@ } } + // Check if this can be converted into a logical shift. + bool isLeft = false; + unsigned ShAmt = 0; + SDOperand ShVal; + bool isShift = isVectorShift(Op, PermMask, DAG, isLeft, ShVal, ShAmt); + if (isShift && ShVal.hasOneUse()) { + // If the shifted value has multiple uses, it may be cheaper to use + // v_set0 + movlhps or movhlps, etc. + MVT::ValueType EVT = MVT::getVectorElementType(VT); + ShAmt *= MVT::getSizeInBits(EVT); + return getVShift(isLeft, VT, ShVal, ShAmt, DAG, *this); + } + if (X86::isMOVLMask(PermMask.Val)) { if (V1IsUndef) return V2; @@ -3634,6 +3734,13 @@ ShouldXformToMOVLP(V1.Val, V2.Val, PermMask.Val)) return CommuteVectorShuffle(Op, V1, V2, PermMask, DAG); + if (isShift) { + // No better options. Use a vshl / vsrl. + MVT::ValueType EVT = MVT::getVectorElementType(VT); + ShAmt *= MVT::getSizeInBits(EVT); + return getVShift(isLeft, VT, ShVal, ShAmt, DAG, *this); + } + bool Commuted = false; // FIXME: This should also accept a bitcast of a splat? Be careful, not // 1,1,1,1 -> v8i16 though. @@ -5729,6 +5836,8 @@ case X86ISD::LCMPXCHG8_DAG: return "X86ISD::LCMPXCHG8_DAG"; case X86ISD::VZEXT_MOVL: return "X86ISD::VZEXT_MOVL"; case X86ISD::VZEXT_LOAD: return "X86ISD::VZEXT_LOAD"; + case X86ISD::VSHL: return "X86ISD::VSHL"; + case X86ISD::VSRL: return "X86ISD::VSRL"; } } @@ -6296,8 +6405,10 @@ static SDOperand PerformBuildVectorCombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget, const TargetLowering &TLI) { + unsigned NumOps = N->getNumOperands(); + // Ignore single operand BUILD_VECTOR. - if (N->getNumOperands() == 1) + if (NumOps == 1) return SDOperand(); MVT::ValueType VT = N->getValueType(0); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Thu May 29 03:22:04 2008 @@ -205,7 +205,10 @@ VZEXT_MOVL, // VZEXT_LOAD - Load, scalar_to_vector, and zero extend. - VZEXT_LOAD + VZEXT_LOAD, + + // VSHL, VSRL - Vector logical left / right shift. + VSHL, VSRL }; } Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Thu May 29 03:22:04 2008 @@ -294,6 +294,12 @@ defm MMX_PSRAD : MMXI_binop_rmi_int<0xE2, 0x72, MRM4r, "psrad", int_x86_mmx_psra_d, int_x86_mmx_psrai_d>; +// Shift up / down and insert zero's. +def : Pat<(v1i64 (X86vshl VR64:$src, (i8 imm:$amt))), + (v1i64 (MMX_PSLLQri VR64:$src, imm:$amt))>; +def : Pat<(v1i64 (X86vshr VR64:$src, (i8 imm:$amt))), + (v1i64 (MMX_PSRLQri VR64:$src, imm:$amt))>; + // Comparison Instructions defm MMX_PCMPEQB : MMXI_binop_rm_int<0x74, "pcmpeqb", int_x86_mmx_pcmpeq_b>; defm MMX_PCMPEQW : MMXI_binop_rm_int<0x75, "pcmpeqw", int_x86_mmx_pcmpeq_w>; Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu May 29 03:22:04 2008 @@ -51,6 +51,8 @@ SDTypeProfile<1, 1, [SDTCisSameAs<0,1>]>>; def X86vzload : SDNode<"X86ISD::VZEXT_LOAD", SDTLoad, [SDNPHasChain, SDNPMayLoad]>; +def X86vshl : SDNode<"X86ISD::VSHL", SDTIntShiftOp>; +def X86vshr : SDNode<"X86ISD::VSRL", SDTIntShiftOp>; //===----------------------------------------------------------------------===// // SSE Complex Patterns @@ -1957,6 +1959,12 @@ (v2i64 (PSRLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; def : Pat<(v2f64 (X86fsrl VR128:$src1, i32immSExt8:$src2)), (v2f64 (PSRLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; + + // Shift up / down and insert zero's. + def : Pat<(v2i64 (X86vshl VR128:$src, (i8 imm:$amt))), + (v2i64 (PSLLDQri VR128:$src, (PSxLDQ_imm imm:$amt)))>; + def : Pat<(v2i64 (X86vshr VR128:$src, (i8 imm:$amt))), + (v2i64 (PSRLDQri VR128:$src, (PSxLDQ_imm imm:$amt)))>; } // Logical Modified: llvm/trunk/test/CodeGen/X86/mmx-insert-element.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mmx-insert-element.ll?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/mmx-insert-element.ll (original) +++ llvm/trunk/test/CodeGen/X86/mmx-insert-element.ll Thu May 29 03:22:04 2008 @@ -1,23 +1,7 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx | grep movq | count 3 - -; FIXME: This code outputs: -; -; subl $28, %esp -; movl 32(%esp), %eax -; movd %eax, %mm0 -; movq %mm0, (%esp) -; movl (%esp), %eax -; movl %eax, 20(%esp) -; movq %mm0, 8(%esp) -; movl 12(%esp), %eax -; movl %eax, 16(%esp) -; movq 16(%esp), %mm0 -; addl $28, %esp -; -; Which is ugly. We need to fix this. +; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx | not grep movq +; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx | grep psllq define <2 x i32> @qux(i32 %A) nounwind { -entry: %tmp3 = insertelement <2 x i32> < i32 0, i32 undef >, i32 %A, i32 1 ; <<2 x i32>> [#uses=1] ret <2 x i32> %tmp3 } Modified: llvm/trunk/test/CodeGen/X86/vec_clear.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_clear.ll?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_clear.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_clear.ll Thu May 29 03:22:04 2008 @@ -1,6 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -mtriple=i386-apple-darwin | not grep and +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -mtriple=i386-apple-darwin | grep psrldq -define <4 x float> @test(<4 x float>* %v1) { +define <4 x float> @test(<4 x float>* %v1) nounwind { %tmp = load <4 x float>* %v1 ; <<4 x float>> [#uses=1] %tmp15 = bitcast <4 x float> %tmp to <2 x i64> ; <<2 x i64>> [#uses=1] %tmp24 = and <2 x i64> %tmp15, bitcast (<4 x i32> < i32 0, i32 0, i32 -1, i32 -1 > to <2 x i64>) ; <<2 x i64>> [#uses=1] Modified: llvm/trunk/test/CodeGen/X86/vec_insert-3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_insert-3.ll?rev=51667&r1=51666&r2=51667&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_insert-3.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_insert-3.ll Thu May 29 03:22:04 2008 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep punpcklqdq | count 1 -define <2 x i64> @t1(i64 %s, <2 x i64> %tmp) { +define <2 x i64> @t1(i64 %s, <2 x i64> %tmp) nounwind { %tmp1 = insertelement <2 x i64> %tmp, i64 %s, i32 1 ret <2 x i64> %tmp1 } Added: llvm/trunk/test/CodeGen/X86/vec_insert-5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_insert-5.ll?rev=51667&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_insert-5.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_insert-5.ll Thu May 29 03:22:04 2008 @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep psllq | grep 32 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pslldq | grep 12 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep psrldq | grep 8 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep psrldq | grep 12 + +define void @t1(i32 %a, <1 x i64>* %P) nounwind { + %tmp12 = shl i32 %a, 12 + %tmp21 = insertelement <2 x i32> undef, i32 %tmp12, i32 1 + %tmp22 = insertelement <2 x i32> %tmp21, i32 0, i32 0 + %tmp23 = bitcast <2 x i32> %tmp22 to <1 x i64> + store <1 x i64> %tmp23, <1 x i64>* %P + ret void +} + +define <4 x float> @t2(<4 x float>* %P) nounwind { + %tmp1 = load <4 x float>* %P + %tmp2 = shufflevector <4 x float> %tmp1, <4 x float> zeroinitializer, <4 x i32> < i32 4, i32 4, i32 4, i32 0 > + ret <4 x float> %tmp2 +} + +define <4 x float> @t3(<4 x float>* %P) nounwind { + %tmp1 = load <4 x float>* %P + %tmp2 = shufflevector <4 x float> %tmp1, <4 x float> zeroinitializer, <4 x i32> < i32 2, i32 3, i32 4, i32 4 > + ret <4 x float> %tmp2 +} + +define <4 x float> @t4(<4 x float>* %P) nounwind { + %tmp1 = load <4 x float>* %P + %tmp2 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp1, <4 x i32> < i32 7, i32 0, i32 0, i32 0 > + ret <4 x float> %tmp2 +} Added: llvm/trunk/test/CodeGen/X86/vec_insert-6.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_insert-6.ll?rev=51667&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_insert-6.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_insert-6.ll Thu May 29 03:22:04 2008 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep pslldq + +define <4 x float> @t3(<4 x float>* %P) nounwind { + %tmp1 = load <4 x float>* %P + %tmp2 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp1, <4 x i32> < i32 4, i32 4, i32 4, i32 0 > + ret <4 x float> %tmp2 +} From resistor at mac.com Thu May 29 03:45:13 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 29 May 2008 08:45:13 -0000 Subject: [llvm-commits] [llvm] r51668 - in /llvm/trunk: lib/Transforms/Scalar/ADCE.cpp test/Transforms/ADCE/2003-12-19-MergeReturn.ll test/Transforms/ADCE/dead-phi-edge.ll Message-ID: <200805290845.m4T8jDlo020433@zion.cs.uiuc.edu> Author: resistor Date: Thu May 29 03:45:13 2008 New Revision: 51668 URL: http://llvm.org/viewvc/llvm-project?rev=51668&view=rev Log: Replace the old ADCE implementation with a new one that more simply solves the one case that ADCE catches that normal DCE doesn't: non-induction variable loop computations. This implementation handles this problem without using postdominators. Removed: llvm/trunk/test/Transforms/ADCE/2003-12-19-MergeReturn.ll llvm/trunk/test/Transforms/ADCE/dead-phi-edge.ll Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=51668&r1=51667&r2=51668&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Thu May 29 03:45:13 2008 @@ -1,4 +1,4 @@ -//===- ADCE.cpp - Code to perform aggressive dead code elimination --------===// +//===- DCE.cpp - Code to perform dead code elimination --------------------===// // // The LLVM Compiler Infrastructure // @@ -7,481 +7,86 @@ // //===----------------------------------------------------------------------===// // -// This file implements "aggressive" dead code elimination. ADCE is DCe where -// values are assumed to be dead until proven otherwise. This is similar to -// SCCP, except applied to the liveness of values. +// This file implements the Aggressive Dead Code Elimination pass. This pass +// optimistically assumes that all instructions are dead until proven otherwise, +// allowing it to eliminate dead computations that other DCE passes do not +// catch, particularly involving loop computations. // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "adce" #include "llvm/Transforms/Scalar.h" -#include "llvm/Constants.h" #include "llvm/Instructions.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/PostDominators.h" -#include "llvm/Support/CFG.h" -#include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/Transforms/Utils/Local.h" -#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" -#include "llvm/Support/Debug.h" -#include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/ADT/STLExtras.h" +#include "llvm/Pass.h" #include "llvm/Support/Compiler.h" -#include +#include "llvm/Support/InstIterator.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/ADT/SmallPtrSet.h" + using namespace llvm; -STATISTIC(NumBlockRemoved, "Number of basic blocks removed"); -STATISTIC(NumInstRemoved , "Number of instructions removed"); -STATISTIC(NumCallRemoved , "Number of calls removed"); +STATISTIC(NumRemoved, "Number of instructions removed"); namespace { -//===----------------------------------------------------------------------===// -// ADCE Class -// -// This class does all of the work of Aggressive Dead Code Elimination. -// It's public interface consists of a constructor and a doADCE() method. -// -class VISIBILITY_HIDDEN ADCE : public FunctionPass { - Function *Func; // The function that we are working on - std::vector WorkList; // Instructions that just became live - std::set LiveSet; // The set of live instructions - - //===--------------------------------------------------------------------===// - // The public interface for this class - // -public: - static char ID; // Pass identification, replacement for typeid - ADCE() : FunctionPass((intptr_t)&ID) {} - - // Execute the Aggressive Dead Code Elimination Algorithm - // - virtual bool runOnFunction(Function &F) { - Func = &F; - bool Changed = doADCE(); - assert(WorkList.empty()); - LiveSet.clear(); - return Changed; - } - // getAnalysisUsage - We require post dominance frontiers (aka Control - // Dependence Graph) - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - // We require that all function nodes are unified, because otherwise code - // can be marked live that wouldn't necessarily be otherwise. - AU.addRequired(); - AU.addRequired(); - AU.addRequired(); - AU.addRequired(); - } - - - //===--------------------------------------------------------------------===// - // The implementation of this class - // -private: - // doADCE() - Run the Aggressive Dead Code Elimination algorithm, returning - // true if the function was modified. - // - bool doADCE(); - - void markBlockAlive(BasicBlock *BB); - - - // deleteDeadInstructionsInLiveBlock - Loop over all of the instructions in - // the specified basic block, deleting ones that are dead according to - // LiveSet. - bool deleteDeadInstructionsInLiveBlock(BasicBlock *BB); - - TerminatorInst *convertToUnconditionalBranch(TerminatorInst *TI); - - inline void markInstructionLive(Instruction *I) { - if (!LiveSet.insert(I).second) return; - DOUT << "Insn Live: " << *I; - WorkList.push_back(I); - } - - inline void markTerminatorLive(const BasicBlock *BB) { - DOUT << "Terminator Live: " << *BB->getTerminator(); - markInstructionLive(const_cast(BB->getTerminator())); - } -}; -} // End of anonymous namespace - -char ADCE::ID = 0; -static RegisterPass X("adce", "Aggressive Dead Code Elimination"); - -FunctionPass *llvm::createAggressiveDCEPass() { return new ADCE(); } - -void ADCE::markBlockAlive(BasicBlock *BB) { - // Mark the basic block as being newly ALIVE... and mark all branches that - // this block is control dependent on as being alive also... - // - PostDominanceFrontier &CDG = getAnalysis(); - - PostDominanceFrontier::const_iterator It = CDG.find(BB); - if (It != CDG.end()) { - // Get the blocks that this node is control dependent on... - const PostDominanceFrontier::DomSetType &CDB = It->second; - for (PostDominanceFrontier::DomSetType::const_iterator I = - CDB.begin(), E = CDB.end(); I != E; ++I) - markTerminatorLive(*I); // Mark all their terminators as live - } - - // If this basic block is live, and it ends in an unconditional branch, then - // the branch is alive as well... - if (BranchInst *BI = dyn_cast(BB->getTerminator())) - if (BI->isUnconditional()) - markTerminatorLive(BB); -} - -// deleteDeadInstructionsInLiveBlock - Loop over all of the instructions in the -// specified basic block, deleting ones that are dead according to LiveSet. -bool ADCE::deleteDeadInstructionsInLiveBlock(BasicBlock *BB) { - bool Changed = false; - for (BasicBlock::iterator II = BB->begin(), E = --BB->end(); II != E; ) { - Instruction *I = II++; - if (!LiveSet.count(I)) { // Is this instruction alive? - if (!I->use_empty()) - I->replaceAllUsesWith(UndefValue::get(I->getType())); - - // Nope... remove the instruction from it's basic block... - if (isa(I)) - ++NumCallRemoved; - else - ++NumInstRemoved; - BB->getInstList().erase(I); - Changed = true; + struct VISIBILITY_HIDDEN ADCE : public FunctionPass { + static char ID; // Pass identification, replacement for typeid + ADCE() : FunctionPass((intptr_t)&ID) {} + + virtual bool runOnFunction(Function& F); + + virtual void getAnalysisUsage(AnalysisUsage& AU) const { + AU.setPreservesCFG(); } - } - return Changed; -} - - -/// convertToUnconditionalBranch - Transform this conditional terminator -/// instruction into an unconditional branch because we don't care which of the -/// successors it goes to. This eliminate a use of the condition as well. -/// -TerminatorInst *ADCE::convertToUnconditionalBranch(TerminatorInst *TI) { - BranchInst *NB = BranchInst::Create(TI->getSuccessor(0), TI); - BasicBlock *BB = TI->getParent(); - - // Remove entries from PHI nodes to avoid confusing ourself later... - for (unsigned i = 1, e = TI->getNumSuccessors(); i != e; ++i) - TI->getSuccessor(i)->removePredecessor(BB); - - // Delete the old branch itself... - BB->getInstList().erase(TI); - return NB; + + }; } +char ADCE::ID = 0; +static RegisterPass X("adce", "Aggressive Dead Code Elimination"); -// doADCE() - Run the Aggressive Dead Code Elimination algorithm, returning -// true if the function was modified. -// -bool ADCE::doADCE() { - bool MadeChanges = false; - - AliasAnalysis &AA = getAnalysis(); - - // Iterate over all of the instructions in the function, eliminating trivially - // dead instructions, and marking instructions live that are known to be - // needed. Perform the walk in depth first order so that we avoid marking any - // instructions live in basic blocks that are unreachable. These blocks will - // be eliminated later, along with the instructions inside. - // - std::set ReachableBBs; - std::vector Stack; - Stack.push_back(&Func->getEntryBlock()); +bool ADCE::runOnFunction(Function& F) { + SmallPtrSet alive; + std::vector worklist; - while (!Stack.empty()) { - BasicBlock* BB = Stack.back(); - if (ReachableBBs.count(BB)) { - Stack.pop_back(); - continue; - } else { - ReachableBBs.insert(BB); - } - - for (BasicBlock::iterator II = BB->begin(), EI = BB->end(); II != EI; ) { - Instruction *I = II++; - if (CallInst *CI = dyn_cast(I)) { - if (AA.onlyReadsMemory(CI)) { - if (CI->use_empty()) { - BB->getInstList().erase(CI); - ++NumCallRemoved; - } - } else { - markInstructionLive(I); - } - } else if (I->mayWriteToMemory() || isa(I) || - isa(I) || isa(I)) { - // FIXME: Unreachable instructions should not be marked intrinsically - // live here. - markInstructionLive(I); - } else if (isInstructionTriviallyDead(I)) { - // Remove the instruction from it's basic block... - BB->getInstList().erase(I); - ++NumInstRemoved; - } + // Collect the set of "root" instructions that are known live. + for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) + if (isa(I.getInstructionIterator()) || + I->mayWriteToMemory()) { + alive.insert(I.getInstructionIterator()); + worklist.push_back(I.getInstructionIterator()); } - for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI) { - // Back edges (as opposed to cross edges) indicate loops, so implicitly - // mark them live. - if (std::find(Stack.begin(), Stack.end(), *SI) != Stack.end()) - markInstructionLive(BB->getTerminator()); - if (!ReachableBBs.count(*SI)) - Stack.push_back(*SI); - } - } - - // Check to ensure we have an exit node for this CFG. If we don't, we won't - // have any post-dominance information, thus we cannot perform our - // transformations safely. - // - PostDominatorTree &DT = getAnalysis(); - if (DT[&Func->getEntryBlock()] == 0) { - WorkList.clear(); - return MadeChanges; - } - - // Scan the function marking blocks without post-dominance information as - // live. Blocks without post-dominance information occur when there is an - // infinite loop in the program. Because the infinite loop could contain a - // function which unwinds, exits or has side-effects, we don't want to delete - // the infinite loop or those blocks leading up to it. - for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I) - if (DT[I] == 0 && ReachableBBs.count(I)) - for (pred_iterator PI = pred_begin(I), E = pred_end(I); PI != E; ++PI) - markInstructionLive((*PI)->getTerminator()); - - DOUT << "Processing work list\n"; - - // AliveBlocks - Set of basic blocks that we know have instructions that are - // alive in them... - // - std::set AliveBlocks; - - // Process the work list of instructions that just became live... if they - // became live, then that means that all of their operands are necessary as - // well... make them live as well. - // - while (!WorkList.empty()) { - Instruction *I = WorkList.back(); // Get an instruction that became live... - WorkList.pop_back(); - - BasicBlock *BB = I->getParent(); - if (!ReachableBBs.count(BB)) continue; - if (AliveBlocks.insert(BB).second) // Basic block not alive yet. - markBlockAlive(BB); // Make it so now! - - // PHI nodes are a special case, because the incoming values are actually - // defined in the predecessor nodes of this block, meaning that the PHI - // makes the predecessors alive. - // - if (PHINode *PN = dyn_cast(I)) { - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { - // If the incoming edge is clearly dead, it won't have control - // dependence information. Do not mark it live. - BasicBlock *PredBB = PN->getIncomingBlock(i); - if (ReachableBBs.count(PredBB)) { - // FIXME: This should mark the control dependent edge as live, not - // necessarily the predecessor itself! - if (AliveBlocks.insert(PredBB).second) - markBlockAlive(PN->getIncomingBlock(i)); // Block is newly ALIVE! - if (Instruction *Op = dyn_cast(PN->getIncomingValue(i))) - markInstructionLive(Op); - } - } - } else { - // Loop over all of the operands of the live instruction, making sure that - // they are known to be alive as well. - // - for (unsigned op = 0, End = I->getNumOperands(); op != End; ++op) - if (Instruction *Operand = dyn_cast(I->getOperand(op))) - markInstructionLive(Operand); - } + // Propagate liveness backwards to operands. + while (!worklist.empty()) { + Instruction* curr = worklist.back(); + worklist.pop_back(); + + for (Instruction::op_iterator OI = curr->op_begin(), OE = curr->op_end(); + OI != OE; ++OI) + if (Instruction* Inst = dyn_cast(OI)) + if (alive.insert(Inst)) + worklist.push_back(Inst); } - - DEBUG( - DOUT << "Current Function: X = Live\n"; - for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I){ - DOUT << I->getName() << ":\t" - << (AliveBlocks.count(I) ? "LIVE\n" : "DEAD\n"); - for (BasicBlock::iterator BI = I->begin(), BE = I->end(); BI != BE; ++BI){ - if (LiveSet.count(BI)) DOUT << "X "; - DOUT << *BI; - } - }); - - // All blocks being live is a common case, handle it specially. - if (AliveBlocks.size() == Func->size()) { // No dead blocks? - for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I) { - // Loop over all of the instructions in the function deleting instructions - // to drop their references. - deleteDeadInstructionsInLiveBlock(I); - - // Check to make sure the terminator instruction is live. If it isn't, - // this means that the condition that it branches on (we know it is not an - // unconditional branch), is not needed to make the decision of where to - // go to, because all outgoing edges go to the same place. We must remove - // the use of the condition (because it's probably dead), so we convert - // the terminator to an unconditional branch. - // - TerminatorInst *TI = I->getTerminator(); - if (!LiveSet.count(TI)) - convertToUnconditionalBranch(TI); + + // The inverse of the live set is the dead set. These are those instructions + // which have no side effects and do not influence the control flow or return + // value of the function, and may therefore be deleted safely. + SmallPtrSet dead; + for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) + if (!alive.count(I.getInstructionIterator())) { + dead.insert(I.getInstructionIterator()); + I->dropAllReferences(); } - - return MadeChanges; - } - - - // If the entry node is dead, insert a new entry node to eliminate the entry - // node as a special case. - // - if (!AliveBlocks.count(&Func->front())) { - BasicBlock *NewEntry = BasicBlock::Create(); - BranchInst::Create(&Func->front(), NewEntry); - Func->getBasicBlockList().push_front(NewEntry); - AliveBlocks.insert(NewEntry); // This block is always alive! - LiveSet.insert(NewEntry->getTerminator()); // The branch is live + + for (SmallPtrSet::iterator I = dead.begin(), + E = dead.end(); I != E; ++I) { + NumRemoved++; + (*I)->eraseFromParent(); } - - // Loop over all of the alive blocks in the function. If any successor - // blocks are not alive, we adjust the outgoing branches to branch to the - // first live postdominator of the live block, adjusting any PHI nodes in - // the block to reflect this. - // - for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I) - if (AliveBlocks.count(I)) { - BasicBlock *BB = I; - TerminatorInst *TI = BB->getTerminator(); - - // If the terminator instruction is alive, but the block it is contained - // in IS alive, this means that this terminator is a conditional branch on - // a condition that doesn't matter. Make it an unconditional branch to - // ONE of the successors. This has the side effect of dropping a use of - // the conditional value, which may also be dead. - if (!LiveSet.count(TI)) - TI = convertToUnconditionalBranch(TI); - - // Loop over all of the successors, looking for ones that are not alive. - // We cannot save the number of successors in the terminator instruction - // here because we may remove them if we don't have a postdominator. - // - for (unsigned i = 0; i != TI->getNumSuccessors(); ++i) - if (!AliveBlocks.count(TI->getSuccessor(i))) { - // Scan up the postdominator tree, looking for the first - // postdominator that is alive, and the last postdominator that is - // dead... - // - DomTreeNode *LastNode = DT[TI->getSuccessor(i)]; - DomTreeNode *NextNode = 0; - - if (LastNode) { - NextNode = LastNode->getIDom(); - while (!AliveBlocks.count(NextNode->getBlock())) { - LastNode = NextNode; - NextNode = NextNode->getIDom(); - if (NextNode == 0) { - LastNode = 0; - break; - } - } - } - - // There is a special case here... if there IS no post-dominator for - // the block we have nowhere to point our branch to. Instead, convert - // it to a return. This can only happen if the code branched into an - // infinite loop. Note that this may not be desirable, because we - // _are_ altering the behavior of the code. This is a well known - // drawback of ADCE, so in the future if we choose to revisit the - // decision, this is where it should be. - // - if (LastNode == 0) { // No postdominator! - if (!isa(TI)) { - // Call RemoveSuccessor to transmogrify the terminator instruction - // to not contain the outgoing branch, or to create a new - // terminator if the form fundamentally changes (i.e., - // unconditional branch to return). Note that this will change a - // branch into an infinite loop into a return instruction! - // - RemoveSuccessor(TI, i); - - // RemoveSuccessor may replace TI... make sure we have a fresh - // pointer. - // - TI = BB->getTerminator(); - - // Rescan this successor... - --i; - } else { - - } - } else { - // Get the basic blocks that we need... - BasicBlock *LastDead = LastNode->getBlock(); - BasicBlock *NextAlive = NextNode->getBlock(); - - // Make the conditional branch now go to the next alive block... - TI->getSuccessor(i)->removePredecessor(BB); - TI->setSuccessor(i, NextAlive); - - // If there are PHI nodes in NextAlive, we need to add entries to - // the PHI nodes for the new incoming edge. The incoming values - // should be identical to the incoming values for LastDead. - // - for (BasicBlock::iterator II = NextAlive->begin(); - isa(II); ++II) { - PHINode *PN = cast(II); - if (LiveSet.count(PN)) { // Only modify live phi nodes - // Get the incoming value for LastDead... - int OldIdx = PN->getBasicBlockIndex(LastDead); - assert(OldIdx != -1 &&"LastDead is not a pred of NextAlive!"); - Value *InVal = PN->getIncomingValue(OldIdx); - - // Add an incoming value for BB now... - PN->addIncoming(InVal, BB); - } - } - } - } - - // Now loop over all of the instructions in the basic block, deleting - // dead instructions. This is so that the next sweep over the program - // can safely delete dead instructions without other dead instructions - // still referring to them. - // - deleteDeadInstructionsInLiveBlock(BB); - } - - // Loop over all of the basic blocks in the function, dropping references of - // the dead basic blocks. We must do this after the previous step to avoid - // dropping references to PHIs which still have entries... - // - std::vector DeadBlocks; - for (Function::iterator BB = Func->begin(), E = Func->end(); BB != E; ++BB) - if (!AliveBlocks.count(BB)) { - // Remove PHI node entries for this block in live successor blocks. - for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) - if (!SI->empty() && isa(SI->front()) && AliveBlocks.count(*SI)) - (*SI)->removePredecessor(BB); - - BB->dropAllReferences(); - MadeChanges = true; - DeadBlocks.push_back(BB); - } - - NumBlockRemoved += DeadBlocks.size(); - - // Now loop through all of the blocks and delete the dead ones. We can safely - // do this now because we know that there are no references to dead blocks - // (because they have dropped all of their references). - for (std::vector::iterator I = DeadBlocks.begin(), - E = DeadBlocks.end(); I != E; ++I) - Func->getBasicBlockList().erase(*I); - - return MadeChanges; + + return !dead.empty(); } + +FunctionPass *llvm::createAggressiveDCEPass() { + return new ADCE(); +} \ No newline at end of file Removed: llvm/trunk/test/Transforms/ADCE/2003-12-19-MergeReturn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ADCE/2003-12-19-MergeReturn.ll?rev=51667&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ADCE/2003-12-19-MergeReturn.ll (original) +++ llvm/trunk/test/Transforms/ADCE/2003-12-19-MergeReturn.ll (removed) @@ -1,27 +0,0 @@ -; This testcase was failing because without merging the return blocks, ADCE -; didn't know that it could get rid of the then.0 block. - -; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep load - - -define void @main(i32 %argc, i8** %argv) { -entry: - call void @__main( ) - %tmp.1 = icmp ule i32 %argc, 5 ; [#uses=1] - br i1 %tmp.1, label %then.0, label %return - -then.0: ; preds = %entry - %tmp.8 = load i8** %argv ; [#uses=1] - %tmp.10 = load i8* %tmp.8 ; [#uses=1] - %tmp.11 = icmp eq i8 %tmp.10, 98 ; [#uses=1] - br i1 %tmp.11, label %then.1, label %return - -then.1: ; preds = %then.0 - ret void - -return: ; preds = %then.0, %entry - ret void -} - -declare void @__main() - Removed: llvm/trunk/test/Transforms/ADCE/dead-phi-edge.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ADCE/dead-phi-edge.ll?rev=51667&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ADCE/dead-phi-edge.ll (original) +++ llvm/trunk/test/Transforms/ADCE/dead-phi-edge.ll (removed) @@ -1,17 +0,0 @@ -; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep call - -; The call is not live just because the PHI uses the call retval! - -define i32 @test(i32 %X) { -;