From sabre at nondot.org Mon Feb 18 00:11:00 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 06:11:00 -0000 Subject: [llvm-commits] [llvm] r47257 - /llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Message-ID: <200802180611.m1I6B0VV023678@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 00:11:00 2008 New Revision: 47257 URL: http://llvm.org/viewvc/llvm-project?rev=47257&view=rev Log: upgrade this test. Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll?rev=47257&r1=47256&r2=47257&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Mon Feb 18 00:11:00 2008 @@ -1,19 +1,19 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep {call.*stackrestore} +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {call.*stackrestore} ;; Test that llvm.stackrestore is removed when possible. - -int* %test1(uint %P) { - %tmp = call sbyte* %llvm.stacksave() - call void %llvm.stackrestore(sbyte* %tmp) ;; not restoring anything - %A = alloca int, uint %P - ret int* %A +define i32* @test1(i32 %P) { + %tmp = call i8* @llvm.stacksave( ) + call void @llvm.stackrestore( i8* %tmp ) ;; not restoring anything + %A = alloca i32, i32 %P + ret i32* %A } -void %test2(sbyte* %X) { - call void %llvm.stackrestore(sbyte* %X) ;; no allocas before return. +define void @test2(i8* %X) { + call void @llvm.stackrestore( i8* %X ) ;; no allocas before return. ret void } -declare sbyte* %llvm.stacksave() +declare i8* @llvm.stacksave() + +declare void @llvm.stackrestore(i8*) -declare void %llvm.stackrestore(sbyte*) From sabre at nondot.org Mon Feb 18 00:12:38 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 06:12:38 -0000 Subject: [llvm-commits] [llvm] r47258 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/stacksaverestore.ll Message-ID: <200802180612.m1I6Cd1t023731@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 00:12:38 2008 New Revision: 47258 URL: http://llvm.org/viewvc/llvm-project?rev=47258&view=rev Log: optimize away stackrestore calls that have no intervening alloca or call. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47258&r1=47257&r2=47258&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 18 00:12:38 2008 @@ -8199,22 +8199,30 @@ } } - // If the stack restore is in a return/unwind block and if there are no - // allocas or calls between the restore and the return, nuke the restore. + // Scan down this block to see if there is another stack restore in the + // same block without an intervening call/alloca. + BasicBlock::iterator BI = II; TerminatorInst *TI = II->getParent()->getTerminator(); - if (isa(TI) || isa(TI)) { - BasicBlock::iterator BI = II; - bool CannotRemove = false; - for (++BI; &*BI != TI; ++BI) { - if (isa(BI) || - (isa(BI) && !isa(BI))) { + bool CannotRemove = false; + for (++BI; &*BI != TI; ++BI) { + if (isa(BI)) { + CannotRemove = true; + break; + } + if (isa(BI)) { + if (!isa(BI)) { CannotRemove = true; break; } - } - if (!CannotRemove) + // If there is a stackrestore below this one, remove this one. return EraseInstFromFunction(CI); + } } + + // If the stack restore is in a return/unwind block and if there are no + // allocas or calls between the restore and the return, nuke the restore. + if (!CannotRemove && (isa(TI) || isa(TI))) + return EraseInstFromFunction(CI); break; } } Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll?rev=47258&r1=47257&r2=47258&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Mon Feb 18 00:12:38 2008 @@ -1,4 +1,7 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {call.*stackrestore} +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*stackrestore} | count 1 + +declare i8* @llvm.stacksave() +declare void @llvm.stackrestore(i8*) ;; Test that llvm.stackrestore is removed when possible. define i32* @test1(i32 %P) { @@ -13,7 +16,41 @@ ret void } -declare i8* @llvm.stacksave() +define void @foo(i32 %size) nounwind { +entry: + %tmp118124 = icmp sgt i32 %size, 0 ; [#uses=1] + br i1 %tmp118124, label %bb.preheader, label %return -declare void @llvm.stackrestore(i8*) +bb.preheader: ; preds = %entry + %tmp25 = add i32 %size, -1 ; [#uses=1] + %tmp125 = icmp slt i32 %size, 1 ; [#uses=1] + %smax = select i1 %tmp125, i32 1, i32 %size ; [#uses=1] + br label %bb + +bb: ; preds = %bb, %bb.preheader + %i.0.reg2mem.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb ] ; [#uses=2] + %tmp = call i8* @llvm.stacksave( ) ; [#uses=1] + %tmp23 = alloca i8, i32 %size ; [#uses=2] + %tmp27 = getelementptr i8* %tmp23, i32 %tmp25 ; [#uses=1] + store i8 0, i8* %tmp27, align 1 + %tmp28 = call i8* @llvm.stacksave( ) ; [#uses=1] + %tmp52 = alloca i8, i32 %size ; [#uses=1] + %tmp53 = call i8* @llvm.stacksave( ) ; [#uses=1] + %tmp77 = alloca i8, i32 %size ; [#uses=1] + %tmp78 = call i8* @llvm.stacksave( ) ; [#uses=1] + %tmp102 = alloca i8, i32 %size ; [#uses=1] + call void @bar( i32 %i.0.reg2mem.0, i8* %tmp23, i8* %tmp52, i8* %tmp77, i8* %tmp102, i32 %size ) nounwind + call void @llvm.stackrestore( i8* %tmp78 ) + call void @llvm.stackrestore( i8* %tmp53 ) + call void @llvm.stackrestore( i8* %tmp28 ) + call void @llvm.stackrestore( i8* %tmp ) + %indvar.next = add i32 %i.0.reg2mem.0, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %smax ; [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb, %entry + ret void +} + +declare void @bar(i32, i8*, i8*, i8*, i8*, i32) From isanbard at gmail.com Mon Feb 18 00:25:39 2008 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Feb 2008 22:25:39 -0800 Subject: [llvm-commits] [llvm] r47086 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp In-Reply-To: <8E88CC4E-5772-4991-AFAC-84507B6311D3@apple.com> References: <200802132111.m1DLB6LR020357@zion.cs.uiuc.edu> <16e5fdf90802131722o59781bf6k1bcbb5d20a3c16ae@mail.gmail.com> <8E88CC4E-5772-4991-AFAC-84507B6311D3@apple.com> Message-ID: <01F5CAB6-6A3B-4F70-A4BB-9F9DEF8E9FA1@gmail.com> Dan submitted a fix last week. -bw On Feb 17, 2008, at 2:16 PM, Evan Cheng wrote: > Ping. Is this fixed? Does it affect build with -Werror set? > > Evan > > On Feb 13, 2008, at 5:22 PM, Bill Wendling wrote: > >> Hi Dan, >> >>> +uint32_t APInt::countTrailingOnes() const { >>> + if (isSingleWord()) >>> + return std::min(uint32_t(CountTrailingOnes_64(VAL)), BitWidth); >>> + uint32_t Count = 0; >>> + uint32_t i = 0; >>> + for (; i < getNumWords() && pVal[i] == -1; ++i) >> >> This compare leads to this warning: >> >> llvm[1]: Compiling APInt.cpp for Debug build >> /Volumes/Gir/devel/llvm/llvm.src/lib/Support/APInt.cpp: In member >> function 'uint32_t llvm::APInt::countTrailingOnes() const': >> /Volumes/Gir/devel/llvm/llvm.src/lib/Support/APInt.cpp:821: warning: >> comparison between signed and unsigned integer expressions >> >> Could you take a look at it please? >> >> -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 isanbard at gmail.com Mon Feb 18 00:27:54 2008 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Feb 2008 22:27:54 -0800 Subject: [llvm-commits] [llvm] r47252 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp In-Reply-To: <200802180231.m1I2VNH8017598@zion.cs.uiuc.edu> References: <200802180231.m1I2VNH8017598@zion.cs.uiuc.edu> Message-ID: <12955534-E2B8-4531-943E-5D1868E79098@gmail.com> What are the bugs? -bw On Feb 17, 2008, at 6:31 PM, Owen Anderson wrote: > Author: resistor > Date: Sun Feb 17 20:31:23 2008 > New Revision: 47252 > > URL: http://llvm.org/viewvc/llvm-project?rev=47252&view=rev > Log: > Fix bugs that Chris noticed in my last patch. > > Modified: > llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp > > Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ > BasicAliasAnalysis.cpp?rev=47252&r1=47251&r2=47252&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) > +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 > 20:31:23 2008 > @@ -250,22 +250,30 @@ > const Value *Object = getUnderlyingObject(P); > // Allocations and byval arguments are "new" objects. > if (Object && > - (isa(Object) || > - (isa(Object) && > - (cast(Object)- > >hasByValAttr() || > - cast(Object)- > >hasNoAliasAttr())))) { > + (isa(Object) || isa(Object))) { > // Okay, the pointer is to a stack allocated (or effectively > so, for > // for noalias parameters) object. If we can prove that > // the pointer never "escapes", then we know the call cannot > clobber it, > // because it simply can't get its address. > - if (!AddressMightEscape(Object)) > - return NoModRef; > + if (isa(Object) || > + cast(Object)->hasByValAttr() || > + cast(Object)->hasNoAliasAttr()) > + if (!AddressMightEscape(Object)) { > + for (CallSite::arg_iterator CI = CS.arg_begin(), CE = > CS.arg_end(); > + CI != CE; ++CI) > + if (getUnderlyingObject(CI->get()) == P) > + return AliasAnalysis::getModRefInfo(CS, P, Size); > + > + return NoModRef; > + } > > // If this is a tail call and P points to a stack location, > we know that > // the tail call cannot access or modify the local stack. > - if (CallInst *CI = dyn_cast(CS.getInstruction())) > - if (CI->isTailCall() && !isa(Object)) > - return NoModRef; > + if (isa(Object) || > + cast(Object)->hasByValAttr()) > + if (CallInst *CI = dyn_cast(CS.getInstruction())) > + if (CI->isTailCall() && !isa(Object)) > + return NoModRef; > } > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Feb 18 01:34:56 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 17 Feb 2008 23:34:56 -0800 Subject: [llvm-commits] [llvm] r47252 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp In-Reply-To: <12955534-E2B8-4531-943E-5D1868E79098@gmail.com> References: <200802180231.m1I2VNH8017598@zion.cs.uiuc.edu> <12955534-E2B8-4531-943E-5D1868E79098@gmail.com> Message-ID: <1CE86670-6CC4-4FC8-8074-BEF9815E1E88@apple.com> On Feb 17, 2008, at 10:27 PM, Bill Wendling wrote: > What are the bugs? Specifically, it is good to say what you're fixing in the commit log, so that it shows up in svn log. -Chris > > -bw > > On Feb 17, 2008, at 6:31 PM, Owen Anderson wrote: > >> Author: resistor >> Date: Sun Feb 17 20:31:23 2008 >> New Revision: 47252 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=47252&view=rev >> Log: >> Fix bugs that Chris noticed in my last patch. >> >> Modified: >> llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp >> >> Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ >> BasicAliasAnalysis.cpp?rev=47252&r1=47251&r2=47252&view=diff >> >> = >> ===================================================================== >> ======== >> --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) >> +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 >> 20:31:23 2008 >> @@ -250,22 +250,30 @@ >> const Value *Object = getUnderlyingObject(P); >> // Allocations and byval arguments are "new" objects. >> if (Object && >> - (isa(Object) || >> - (isa(Object) && >> - (cast(Object)- >>> hasByValAttr() || >> - cast(Object)- >>> hasNoAliasAttr())))) { >> + (isa(Object) || isa(Object))) { >> // Okay, the pointer is to a stack allocated (or effectively >> so, for >> // for noalias parameters) object. If we can prove that >> // the pointer never "escapes", then we know the call cannot >> clobber it, >> // because it simply can't get its address. >> - if (!AddressMightEscape(Object)) >> - return NoModRef; >> + if (isa(Object) || >> + cast(Object)->hasByValAttr() || >> + cast(Object)->hasNoAliasAttr()) >> + if (!AddressMightEscape(Object)) { >> + for (CallSite::arg_iterator CI = CS.arg_begin(), CE = >> CS.arg_end(); >> + CI != CE; ++CI) >> + if (getUnderlyingObject(CI->get()) == P) >> + return AliasAnalysis::getModRefInfo(CS, P, Size); >> + >> + return NoModRef; >> + } >> >> // If this is a tail call and P points to a stack location, >> we know that >> // the tail call cannot access or modify the local stack. >> - if (CallInst *CI = dyn_cast(CS.getInstruction())) >> - if (CI->isTailCall() && !isa(Object)) >> - return NoModRef; >> + if (isa(Object) || >> + cast(Object)->hasByValAttr()) >> + if (CallInst *CI = dyn_cast(CS.getInstruction())) >> + if (CI->isTailCall() && !isa(Object)) >> + return NoModRef; >> } >> } >> >> >> >> _______________________________________________ >> 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 sabre at nondot.org Mon Feb 18 01:42:57 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 07:42:57 -0000 Subject: [llvm-commits] [llvm] r47261 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200802180742.m1I7gvgx027395@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 01:42:56 2008 New Revision: 47261 URL: http://llvm.org/viewvc/llvm-project?rev=47261&view=rev Log: switch simplifycfg from using vectors for most things to smallvectors, this speeds it up 2.3% on eon. Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=47261&r1=47260&r2=47261&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 18 01:42:56 2008 @@ -158,7 +158,7 @@ // If there is more than one pred of succ, and there are PHI nodes in // the successor, then we need to add incoming edges for the PHI nodes // - const std::vector BBPreds(pred_begin(BB), pred_end(BB)); + const SmallVector BBPreds(pred_begin(BB), pred_end(BB)); // Loop over all of the PHI nodes in the successor of BB. for (BasicBlock::iterator I = Succ->begin(); isa(I); ++I) { @@ -174,17 +174,15 @@ PN->addIncoming(OldValPN->getIncomingValue(i), OldValPN->getIncomingBlock(i)); } else { - for (std::vector::const_iterator PredI = BBPreds.begin(), - End = BBPreds.end(); PredI != End; ++PredI) { - // Add an incoming value for each of the new incoming values... - PN->addIncoming(OldVal, *PredI); - } + // Add an incoming value for each of the new incoming values. + for (unsigned i = 0, e = BBPreds.size(); i != e; ++i) + PN->addIncoming(OldVal, BBPreds[i]); } } } if (isa(&BB->front())) { - std::vector + SmallVector OldSuccPreds(pred_begin(Succ), pred_end(Succ)); // Move all PHI nodes in BB to Succ if they are alive, otherwise @@ -464,7 +462,7 @@ static void ErasePossiblyDeadInstructionTree(Instruction *I) { if (!isInstructionTriviallyDead(I)) return; - std::vector InstrsToInspect; + SmallVector InstrsToInspect; InstrsToInspect.push_back(I); while (!InstrsToInspect.empty()) { @@ -713,7 +711,7 @@ assert(CV && "Not a comparison?"); bool Changed = false; - std::vector Preds(pred_begin(BB), pred_end(BB)); + SmallVector Preds(pred_begin(BB), pred_end(BB)); while (!Preds.empty()) { BasicBlock *Pred = Preds.back(); Preds.pop_back(); @@ -733,7 +731,7 @@ // Based on whether the default edge from PTI goes to BB or not, fill in // PredCases and PredDefault with the new switch cases we would like to // build. - std::vector NewSuccessors; + SmallVector NewSuccessors; if (PredDefault == BB) { // If this is the default destination from PTI, only the edges in TI @@ -1233,8 +1231,8 @@ BasicBlock::iterator BBI = BB->getTerminator(); if (BBI == BB->begin() || isa(--BBI)) { // Find predecessors that end with branches. - std::vector UncondBranchPreds; - std::vector CondBranchPreds; + SmallVector UncondBranchPreds; + SmallVector CondBranchPreds; for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) { TerminatorInst *PTI = (*PI)->getTerminator(); if (BranchInst *BI = dyn_cast(PTI)) @@ -1357,7 +1355,7 @@ // destination with call instructions, and any unconditional branch // predecessor with an unwind. // - std::vector Preds(pred_begin(BB), pred_end(BB)); + SmallVector Preds(pred_begin(BB), pred_end(BB)); while (!Preds.empty()) { BasicBlock *Pred = Preds.back(); if (BranchInst *BI = dyn_cast(Pred->getTerminator())) { @@ -1676,7 +1674,7 @@ // If the unreachable instruction is the first in the block, take a gander // at all of the predecessors of this instruction, and simplify them. if (&BB->front() == Unreachable) { - std::vector Preds(pred_begin(BB), pred_end(BB)); + SmallVector Preds(pred_begin(BB), pred_end(BB)); for (unsigned i = 0, e = Preds.size(); i != e; ++i) { TerminatorInst *TI = Preds[i]->getTerminator(); From evan.cheng at apple.com Mon Feb 18 02:40:53 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Feb 2008 08:40:53 -0000 Subject: [llvm-commits] [llvm] r47262 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200802180840.m1I8erOk002529@zion.cs.uiuc.edu> Author: evancheng Date: Mon Feb 18 02:40:53 2008 New Revision: 47262 URL: http://llvm.org/viewvc/llvm-project?rev=47262&view=rev Log: For now, avoid commuting def MI for copy MI's whose source is not killed. That simply trade a live interval for another and because only the non-two-address operands can be folded into loads, may end up pessimising code. 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=47262&r1=47261&r2=47262&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Feb 18 02:40:53 2008 @@ -247,6 +247,13 @@ unsigned CopyIdx = li_->getDefIndex(li_->getInstructionIndex(CopyMI)); + // FIXME: For now, only eliminate the copy by commuting its def is the source + // does not live pass the move. Coalescing those copies may end up may simply + // end up swapping a live interval for another. That and because usually only + // the non-two address operand can be folded can end up pessimizing the code. + if (CopyMI->findRegisterUseOperandIdx(IntA.reg, true) != -1) + return false; + // BValNo is a value number in B that is defined by a copy from A. 'B3' in // the example above. LiveInterval::iterator BLR = IntB.FindLiveRangeContaining(CopyIdx); From resistor at mac.com Mon Feb 18 03:09:02 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 03:09:02 -0600 Subject: [llvm-commits] [llvm] r47252 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp In-Reply-To: <12955534-E2B8-4531-943E-5D1868E79098@gmail.com> References: <200802180231.m1I2VNH8017598@zion.cs.uiuc.edu> <12955534-E2B8-4531-943E-5D1868E79098@gmail.com> Message-ID: <98ED3FC0-9DA2-4DAA-BB50-12C69F7CC560@mac.com> Two issues: first, it was ignoring the parameters to a memcpy when determining if the memcpy mod/ref'ed a value, and the tail call based check is invalid for sret arguments. --Owen On Feb 18, 2008, at 12:27 AM, Bill Wendling wrote: > What are the bugs? > > -bw > > On Feb 17, 2008, at 6:31 PM, Owen Anderson wrote: > >> Author: resistor >> Date: Sun Feb 17 20:31:23 2008 >> New Revision: 47252 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=47252&view=rev >> Log: >> Fix bugs that Chris noticed in my last patch. >> >> Modified: >> llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp >> >> Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ >> BasicAliasAnalysis.cpp?rev=47252&r1=47251&r2=47252&view=diff >> >> = >> ===================================================================== >> ======== >> --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) >> +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 >> 20:31:23 2008 >> @@ -250,22 +250,30 @@ >> const Value *Object = getUnderlyingObject(P); >> // Allocations and byval arguments are "new" objects. >> if (Object && >> - (isa(Object) || >> - (isa(Object) && >> - (cast(Object)- >>> hasByValAttr() || >> - cast(Object)- >>> hasNoAliasAttr())))) { >> + (isa(Object) || isa(Object))) { >> // Okay, the pointer is to a stack allocated (or effectively >> so, for >> // for noalias parameters) object. If we can prove that >> // the pointer never "escapes", then we know the call cannot >> clobber it, >> // because it simply can't get its address. >> - if (!AddressMightEscape(Object)) >> - return NoModRef; >> + if (isa(Object) || >> + cast(Object)->hasByValAttr() || >> + cast(Object)->hasNoAliasAttr()) >> + if (!AddressMightEscape(Object)) { >> + for (CallSite::arg_iterator CI = CS.arg_begin(), CE = >> CS.arg_end(); >> + CI != CE; ++CI) >> + if (getUnderlyingObject(CI->get()) == P) >> + return AliasAnalysis::getModRefInfo(CS, P, Size); >> + >> + return NoModRef; >> + } >> >> // If this is a tail call and P points to a stack location, >> we know that >> // the tail call cannot access or modify the local stack. >> - if (CallInst *CI = dyn_cast(CS.getInstruction())) >> - if (CI->isTailCall() && !isa(Object)) >> - return NoModRef; >> + if (isa(Object) || >> + cast(Object)->hasByValAttr()) >> + if (CallInst *CI = dyn_cast(CS.getInstruction())) >> + if (CI->isTailCall() && !isa(Object)) >> + return NoModRef; >> } >> } >> >> >> >> _______________________________________________ >> 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2555 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080218/1b1ed20b/attachment.bin From resistor at mac.com Mon Feb 18 03:11:02 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 09:11:02 -0000 Subject: [llvm-commits] [llvm] r47263 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200802180911.m1I9B2nH005260@zion.cs.uiuc.edu> Author: resistor Date: Mon Feb 18 03:11:02 2008 New Revision: 47263 URL: http://llvm.org/viewvc/llvm-project?rev=47263&view=rev Log: This check is not correct for mallocs, so exclude them earlier. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=47263&r1=47262&r2=47263&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Feb 18 03:11:02 2008 @@ -271,10 +271,10 @@ // If this is a tail call and P points to a stack location, we know that // the tail call cannot access or modify the local stack. - if (isa(Object) || + if (isa(Object) || cast(Object)->hasByValAttr()) if (CallInst *CI = dyn_cast(CS.getInstruction())) - if (CI->isTailCall() && !isa(Object)) + if (CI->isTailCall()) return NoModRef; } } From resistor at mac.com Mon Feb 18 03:22:21 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 09:22:21 -0000 Subject: [llvm-commits] [llvm] r47264 - /llvm/trunk/lib/VMCore/Function.cpp Message-ID: <200802180922.m1I9MMKi005574@zion.cs.uiuc.edu> Author: resistor Date: Mon Feb 18 03:22:21 2008 New Revision: 47264 URL: http://llvm.org/viewvc/llvm-project?rev=47264&view=rev Log: I got the predicate backwards in my last patch. The comment is correct, the code was not. Modified: llvm/trunk/lib/VMCore/Function.cpp Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=47264&r1=47263&r2=47264&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Mon Feb 18 03:22:21 2008 @@ -107,7 +107,7 @@ /// it in its containing function. bool Argument::hasStructRetAttr() const { if (!isa(getType())) return false; - if (getArgNo()) return false; // StructRet param must be first param + if (this != getParent()->arg_begin()) return false; // StructRet param must be first param return getParent()->paramHasAttr(1, ParamAttr::StructRet); } From resistor at mac.com Mon Feb 18 03:24:54 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 09:24:54 -0000 Subject: [llvm-commits] [llvm] r47265 - in /llvm/trunk: lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/sret.ll Message-ID: <200802180924.m1I9OtV9005657@zion.cs.uiuc.edu> Author: resistor Date: Mon Feb 18 03:24:53 2008 New Revision: 47265 URL: http://llvm.org/viewvc/llvm-project?rev=47265&view=rev Log: Add support to GVN for performing sret return slot optimization. This means that, if an sret function tail calls another sret function, it should pass its own sret parameter to the tail callee, allowing it to fill in the correct return value. llvm-gcc does not emit this by default. Instead, it allocates space in the caller for the sret of the tail call and then uses memcpy to copy the result into the caller's sret parameter. This optimization detects and optimizes that case. Added: llvm/trunk/test/Transforms/GVN/sret.ll Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=47265&r1=47264&r2=47265&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Feb 18 03:24:53 2008 @@ -21,6 +21,7 @@ #include "llvm/Function.h" #include "llvm/IntrinsicInst.h" #include "llvm/Instructions.h" +#include "llvm/ParameterAttributes.h" #include "llvm/Value.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" @@ -738,6 +739,8 @@ bool processNonLocalLoad(LoadInst* L, SmallVector& toErase); bool processMemCpy(MemCpyInst* M, SmallVector& toErase); + bool performReturnSlotOptzn(MemCpyInst* cpy, CallInst* C, + SmallVector& toErase); Value *GetValueForBlock(BasicBlock *BB, LoadInst* orig, DenseMap &Phis, bool top_level = false); @@ -1048,6 +1051,62 @@ return deletedLoad; } +/// performReturnSlotOptzn - takes a memcpy and a call that it depends on, +/// and checks for the possibility of a return slot optimization by having +/// the call write its result directly into the callees return parameter +/// rather than using memcpy +bool GVN::performReturnSlotOptzn(MemCpyInst* cpy, CallInst* C, + SmallVector& toErase) { + // Check that we're copying to an argument... + Value* cpyDest = cpy->getDest(); + if (!isa(cpyDest)) + return false; + + // And that the argument is the return slot + Argument* sretArg = cast(cpyDest); + if (!sretArg->hasStructRetAttr()) + return false; + + // Make sure the return slot is otherwise dead + std::set useList(sretArg->use_begin(), sretArg->use_end()); + while (!useList.empty()) { + User* UI = *useList.begin(); + + if (isa(UI) || isa(UI)) { + useList.insert(UI->use_begin(), UI->use_end()); + useList.erase(UI); + } else if (UI == cpy) + useList.erase(UI); + else + return false; + } + + // Make sure the call cannot modify the return slot in some unpredicted way + AliasAnalysis& AA = getAnalysis(); + if (AA.getModRefInfo(C, cpy->getRawDest(), ~0UL) != AliasAnalysis::NoModRef) + return false; + + // If all checks passed, then we can perform the transformation + CallSite CS = CallSite::get(C); + for (unsigned i = 0; i < CS.arg_size(); ++i) { + if (CS.paramHasAttr(i+1, ParamAttr::StructRet)) { + if (CS.getArgument(i)->getType() != cpyDest->getType()) + return false; + + CS.setArgument(i, cpyDest); + break; + } + } + + MemoryDependenceAnalysis& MD = getAnalysis(); + MD.dropInstruction(C); + + // Remove the memcpy + toErase.push_back(cpy); + + return true; +} + /// processMemCpy - perform simplication of memcpy's. If we have memcpy A which /// copies X to Y, and memcpy B which copies Y to Z, then we can rewrite B to be /// a memcpy from X to Z (or potentially a memmove, depending on circumstances). @@ -1059,9 +1118,14 @@ // First, we have to check that the dependency is another memcpy Instruction* dep = MD.getDependency(M); if (dep == MemoryDependenceAnalysis::None || - dep == MemoryDependenceAnalysis::NonLocal || - !isa(dep)) + dep == MemoryDependenceAnalysis::NonLocal) return false; + else if (!isa(dep)) { + if (CallInst* C = dyn_cast(dep)) + return performReturnSlotOptzn(M, C, toErase); + else + return false; + } // We can only transforms memcpy's where the dest of one is the source of the // other Added: llvm/trunk/test/Transforms/GVN/sret.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/sret.ll?rev=47265&view=auto ============================================================================== --- llvm/trunk/test/Transforms/GVN/sret.ll (added) +++ llvm/trunk/test/Transforms/GVN/sret.ll Mon Feb 18 03:24:53 2008 @@ -0,0 +1,28 @@ +; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep memcpy | count 1 + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin9" + +define void @ccosl({ x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* byval %z) nounwind { +entry: + %iz = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=3] + %memtmp = alloca { x86_fp80, x86_fp80 }, align 16 ; <{ x86_fp80, x86_fp80 }*> [#uses=2] + %tmp1 = getelementptr { x86_fp80, x86_fp80 }* %z, i32 0, i32 1 ; [#uses=1] + %tmp2 = load x86_fp80* %tmp1, align 16 ; [#uses=1] + %tmp3 = sub x86_fp80 0xK80000000000000000000, %tmp2 ; [#uses=1] + %tmp4 = getelementptr { x86_fp80, x86_fp80 }* %iz, i32 0, i32 1 ; [#uses=1] + %real = getelementptr { x86_fp80, x86_fp80 }* %iz, i32 0, i32 0 ; [#uses=1] + %tmp7 = getelementptr { x86_fp80, x86_fp80 }* %z, i32 0, i32 0 ; [#uses=1] + %tmp8 = load x86_fp80* %tmp7, align 16 ; [#uses=1] + store x86_fp80 %tmp3, x86_fp80* %real, align 16 + store x86_fp80 %tmp8, x86_fp80* %tmp4, align 16 + call void @ccoshl( { x86_fp80, x86_fp80 }* noalias sret %memtmp, { x86_fp80, x86_fp80 }* byval %iz ) nounwind + %memtmp14 = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* ; [#uses=1] + %agg.result15 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* ; [#uses=1] + call void @llvm.memcpy.i32( i8* %agg.result15, i8* %memtmp14, i32 32, i32 16 ) + ret void +} + +declare void @ccoshl({ x86_fp80, x86_fp80 }* noalias sret , { x86_fp80, x86_fp80 }* byval ) nounwind + +declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind From resistor at mac.com Mon Feb 18 03:32:36 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 09:32:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r47266 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200802180932.m1I9WbEj006004@zion.cs.uiuc.edu> Author: resistor Date: Mon Feb 18 03:32:29 2008 New Revision: 47266 URL: http://llvm.org/viewvc/llvm-project?rev=47266&view=rev Log: llvm-gcc ensures (by inserting extra alloca's and memcpy's) that all sret parameters are noalias as well. By properly marking this as such, we can enable sret return slot optimization in GVN. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=47266&r1=47265&r2=47266&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Feb 18 03:32:29 2008 @@ -1054,10 +1054,11 @@ Attrs.push_back(ParamAttrsWithIndex::get(0, RAttributes)); // If this is a struct-return function, the dest loc is passed in as a - // pointer. Mark that pointer as structret. + // pointer. Mark that pointer as structret and noalias. if (ABIConverter.isStructReturn()) Attrs.push_back(ParamAttrsWithIndex::get(ArgTys.size(), - ParamAttr::StructRet)); + ParamAttr::StructRet | ParamAttr::NoAlias)); + if (static_chain) { // Pass the static chain as the first parameter. ABIConverter.HandleArgument(TREE_TYPE(static_chain)); @@ -1152,10 +1153,10 @@ Attrs.push_back(ParamAttrsWithIndex::get(0, RAttributes)); // If this is a struct-return function, the dest loc is passed in as a - // pointer. Mark that pointer as structret. + // pointer. Mark that pointer as structret, and noalias. if (ABIConverter.isStructReturn()) Attrs.push_back(ParamAttrsWithIndex::get(ArgTypes.size(), - ParamAttr::StructRet)); + ParamAttr::StructRet | ParamAttr::NoAlias)); if (static_chain) { // Pass the static chain as the first parameter. From resistor at mac.com Mon Feb 18 03:33:49 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 03:33:49 -0600 Subject: [llvm-commits] [llvm] r47264 - /llvm/trunk/lib/VMCore/Function.cpp In-Reply-To: <200802180922.m1I9MMKi005574@zion.cs.uiuc.edu> References: <200802180922.m1I9MMKi005574@zion.cs.uiuc.edu> Message-ID: <7F83CA05-D36F-418B-9D55-A029CBA7159C@mac.com> On Feb 18, 2008, at 3:22 AM, Owen Anderson wrote: > Author: resistor > Date: Mon Feb 18 03:22:21 2008 > New Revision: 47264 > > URL: http://llvm.org/viewvc/llvm-project?rev=47264&view=rev > Log: > I got the predicate backwards in my last patch. The comment is > correct, the code was not. > Oops. This comment was based on an older diff. That actual change is: Use a constant time check rather than a linear time one. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2555 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080218/92bd1352/attachment.bin From resistor at mac.com Mon Feb 18 04:11:09 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 10:11:09 -0000 Subject: [llvm-commits] [llvm] r47268 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200802181011.m1IABAg9007638@zion.cs.uiuc.edu> Author: resistor Date: Mon Feb 18 04:11:00 2008 New Revision: 47268 URL: http://llvm.org/viewvc/llvm-project?rev=47268&view=rev Log: Since we're not checking for the more general AllocationInst first, we need to explicitly check that Object is an Argument before casting it to one. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=47268&r1=47267&r2=47268&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Feb 18 04:11:00 2008 @@ -272,7 +272,7 @@ // If this is a tail call and P points to a stack location, we know that // the tail call cannot access or modify the local stack. if (isa(Object) || - cast(Object)->hasByValAttr()) + (isa(Object) && cast(Object)->hasByValAttr())) if (CallInst *CI = dyn_cast(CS.getInstruction())) if (CI->isTailCall()) return NoModRef; From baldrick at free.fr Mon Feb 18 06:20:38 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 18 Feb 2008 13:20:38 +0100 Subject: [llvm-commits] [llvm-gcc-4.2] r47180 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h llvm-types.cpp In-Reply-To: <0B0EFC00-430F-45FC-8B9A-58D8FD6763F8@apple.com> References: <200802152202.m1FM2OcB011631@zion.cs.uiuc.edu> <200802160919.14041.baldrick@free.fr> <0B0EFC00-430F-45FC-8B9A-58D8FD6763F8@apple.com> Message-ID: <200802181320.45334.baldrick@free.fr> > > if this means that ConvertUNION doesn't have to > > muck around with fixing up padding elements anymore, > > can you please remove that code. > > I don't know why that code is there (it goes back to the first svn > checkin) but I don't think anything I did would make it unnecessary. I guess it is there because what is padding for one union field may not be padding for another. If there is now a map from the gcc type to the padding info, then this should, I suppose, be tweaked so it doesn't change the padding info for the type of the field, but for the type of the union. Ciao, Duncan. From gohman at apple.com Mon Feb 18 11:15:45 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 18 Feb 2008 17:15:45 -0000 Subject: [llvm-commits] [llvm] r47271 - /llvm/trunk/tools/bugpoint/bugpoint.cpp Message-ID: <200802181715.m1IHFjoD024436@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 18 11:15:45 2008 New Revision: 47271 URL: http://llvm.org/viewvc/llvm-project?rev=47271&view=rev Log: Fix a missing space in the description of the find-bugs option. Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=47271&r1=47270&r2=47271&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original) +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Mon Feb 18 11:15:45 2008 @@ -34,7 +34,7 @@ cl::ReallyHidden); static cl::opt -FindBugs("find-bugs", cl::desc("Run many different optimization sequences" +FindBugs("find-bugs", cl::desc("Run many different optimization sequences " "on program to find bugs"), cl::init(false)); static cl::list From sabre at nondot.org Mon Feb 18 11:28:23 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 17:28:23 -0000 Subject: [llvm-commits] [llvm] r47272 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200802181728.m1IHSNkM024898@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 11:28:21 2008 New Revision: 47272 URL: http://llvm.org/viewvc/llvm-project?rev=47272&view=rev Log: don't bother calling getUnderlyingObject for non-pointers. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=47272&r1=47271&r2=47272&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Feb 18 11:28:21 2008 @@ -262,7 +262,8 @@ bool passedAsArg = false; for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); CI != CE; ++CI) - if (getUnderlyingObject(CI->get()) == P) + if (isa((*CI)->getType()) && + getUnderlyingObject(*CI) == P) passedAsArg = true; if (!passedAsArg) From baldrick at free.fr Mon Feb 18 11:32:13 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 18 Feb 2008 17:32:13 -0000 Subject: [llvm-commits] [llvm] r47273 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/Transforms/IPO/GlobalOpt.cpp lib/VMCore/Instructions.cpp Message-ID: <200802181732.m1IHWEQQ025047@zion.cs.uiuc.edu> Author: baldrick Date: Mon Feb 18 11:32:13 2008 New Revision: 47273 URL: http://llvm.org/viewvc/llvm-project?rev=47273&view=rev Log: Simplify caller updating using a CallSite, as requested by Chris. While there, do the same for an existing function committed by someone called "lattner" :) Modified: llvm/trunk/include/llvm/Support/CallSite.h llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/include/llvm/Support/CallSite.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=47273&r1=47272&r2=47273&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CallSite.h (original) +++ llvm/trunk/include/llvm/Support/CallSite.h Mon Feb 18 11:32:13 2008 @@ -35,6 +35,7 @@ CallSite() : I(0) {} CallSite(CallInst *CI) : I(reinterpret_cast(CI)) {} CallSite(InvokeInst *II) : I(reinterpret_cast(II)) {} + CallSite(Instruction *C); CallSite(const CallSite &CS) : I(CS.I) {} CallSite &operator=(const CallSite &CS) { I = CS.I; return *this; } Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=47273&r1=47272&r2=47273&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Feb 18 11:32:13 2008 @@ -25,6 +25,7 @@ #include "llvm/Pass.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Target/TargetData.h" +#include "llvm/Support/CallSite.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/GetElementPtrTypeIterator.h" @@ -1584,25 +1585,23 @@ /// function, changing them to FastCC. static void ChangeCalleesToFastCall(Function *F) { for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); UI != E;++UI){ - Instruction *User = cast(*UI); - if (CallInst *CI = dyn_cast(User)) - CI->setCallingConv(CallingConv::Fast); - else - cast(User)->setCallingConv(CallingConv::Fast); + CallSite User(cast(*UI)); + User.setCallingConv(CallingConv::Fast); } } static const ParamAttrsList *StripNest(const ParamAttrsList *Attrs) { - if (Attrs) { - for (unsigned i = 0, e = Attrs->size(); i != e; ++i) { - uint16_t A = Attrs->getParamAttrsAtIndex(i); - if (A & ParamAttr::Nest) { - Attrs = ParamAttrsList::excludeAttrs(Attrs, Attrs->getParamIndex(i), - ParamAttr::Nest); - // There can be only one. - break; - } - } + if (!Attrs) + return NULL; + + for (unsigned i = 0, e = Attrs->size(); i != e; ++i) { + if ((Attrs->getParamAttrsAtIndex(i) & ParamAttr::Nest) == 0) + continue; + + Attrs = ParamAttrsList::excludeAttrs(Attrs, Attrs->getParamIndex(i), + ParamAttr::Nest); + // There can be only one. + break; } return Attrs; @@ -1611,13 +1610,8 @@ static void RemoveNestAttribute(Function *F) { F->setParamAttrs(StripNest(F->getParamAttrs())); for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); UI != E;++UI){ - Instruction *User = cast(*UI); - if (CallInst *CI = dyn_cast(User)) { - CI->setParamAttrs(StripNest(CI->getParamAttrs())); - } else { - InvokeInst *II = cast(User); - II->setParamAttrs(StripNest(II->getParamAttrs())); - } + CallSite User(cast(*UI)); + User.setParamAttrs(StripNest(User.getParamAttrs())); } } Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=47273&r1=47272&r2=47273&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Feb 18 11:32:13 2008 @@ -27,6 +27,10 @@ // CallSite Class //===----------------------------------------------------------------------===// +CallSite::CallSite(Instruction *C) { + assert((isa(C) || isa(C)) && "Not a call!"); + I = C; +} unsigned CallSite::getCallingConv() const { if (CallInst *CI = dyn_cast(I)) return CI->getCallingConv(); From sabre at nondot.org Mon Feb 18 11:33:10 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 17:33:10 -0000 Subject: [llvm-commits] [llvm] r47274 - /llvm/trunk/test/Transforms/GVN/sret.ll Message-ID: <200802181733.m1IHXAsM025079@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 11:33:10 2008 New Revision: 47274 URL: http://llvm.org/viewvc/llvm-project?rev=47274&view=rev Log: make this just a bit more strict. Modified: llvm/trunk/test/Transforms/GVN/sret.ll Modified: llvm/trunk/test/Transforms/GVN/sret.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/sret.ll?rev=47274&r1=47273&r2=47274&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GVN/sret.ll (original) +++ llvm/trunk/test/Transforms/GVN/sret.ll Mon Feb 18 11:33:10 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep memcpy | count 1 +; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {call.*memcpy} target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin9" From clattner at apple.com Mon Feb 18 11:33:51 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Feb 2008 09:33:51 -0800 Subject: [llvm-commits] [llvm] r47273 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/Transforms/IPO/GlobalOpt.cpp lib/VMCore/Instructions.cpp In-Reply-To: <200802181732.m1IHWEQQ025047@zion.cs.uiuc.edu> References: <200802181732.m1IHWEQQ025047@zion.cs.uiuc.edu> Message-ID: <089EE375-EE60-4262-B49D-EC80A99D03A5@apple.com> On Feb 18, 2008, at 9:32 AM, Duncan Sands wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=47273&view=rev > Log: > Simplify caller updating using a CallSite, as > requested by Chris. While there, do the same > for an existing function committed by someone > called "lattner" :) Very nice :) -Chris From baldrick at free.fr Mon Feb 18 11:35:37 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 18 Feb 2008 18:35:37 +0100 Subject: [llvm-commits] [llvm] r47220 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll In-Reply-To: <98B2FBC7-B1F3-4A8F-AA4B-177F96C212D5@apple.com> References: <200802162056.m1GKu5cE029424@zion.cs.uiuc.edu> <200802170341.21614.baldrick@free.fr> <98B2FBC7-B1F3-4A8F-AA4B-177F96C212D5@apple.com> Message-ID: <200802181835.37610.baldrick@free.fr> Hi Chris, > >> Nice. Out of curiousity, how does nest do to codegen? > > > > 'nest' causes a specific register to be grabbed for the > > parameter in calls. So removing it doesn't do much :) > > Ok. if you want me to remove the transform, just ask :) I mostly did it because seeing all those useless "nest" attributes floating around annoys me when rummaging about in Ada produced .ll's. > You can just do: > CallSite User(cast(*UI)); > > and then handle user generically. Actually you couldn't, but you can now (see the CallSite changes just committed). Thanks for the review! Duncan. From romix.llvm at googlemail.com Mon Feb 18 03:35:33 2008 From: romix.llvm at googlemail.com (Roman Levenstein) Date: Mon, 18 Feb 2008 09:35:33 -0000 Subject: [llvm-commits] [llvm] r47267 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200802180935.m1I9ZXTX006118@zion.cs.uiuc.edu> Author: romix Date: Mon Feb 18 03:35:30 2008 New Revision: 47267 URL: http://llvm.org/viewvc/llvm-project?rev=47267&view=rev Log: New helper function getMBBFromIndex() that given an index in any instruction of an MBB returns a pointer the MBB. Reviewed by Evan. 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=47267&r1=47266&r2=47267&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Feb 18 03:35:30 2008 @@ -40,6 +40,20 @@ class VirtRegMap; typedef std::pair IdxMBBPair; + inline bool operator<(unsigned V, const IdxMBBPair &IM) { + return V < IM.first; + } + + inline bool operator<(const IdxMBBPair &IM, unsigned V) { + return IM.first < V; + } + + struct Idx2MBBCompare { + bool operator()(const IdxMBBPair &LHS, const IdxMBBPair &RHS) const { + return LHS.first < RHS.first; + } + }; + class LiveIntervals : public MachineFunctionPass { MachineFunction* mf_; const TargetMachine* tm_; @@ -153,6 +167,22 @@ return MBB2IdxMap[MBBNo].second; } + /// getMBBFromIndex - given an index in any instruction of an + /// MBB return a pointer the MBB + MachineBasicBlock* getMBBFromIndex(unsigned index) const { + std::vector::const_iterator I = + std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), index); + // Take the pair containing the index + std::vector::const_iterator J = + ((I != Idx2MBBMap.end() && I->first > index) || + (I == Idx2MBBMap.end() && Idx2MBBMap.size()>0)) ? (I-1): I; + + assert(J != Idx2MBBMap.end() && J->first < index+1 && + index <= getMBBEndIdx(J->second) && + "index does not correspond to an MBB"); + return J->second; + } + /// getInstructionIndex - returns the base index of instr unsigned getInstructionIndex(MachineInstr* instr) const { Mi2IndexMap::const_iterator it = mi2iMap_.find(instr); Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=47267&r1=47266&r2=47267&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Feb 18 03:35:30 2008 @@ -79,22 +79,6 @@ delete ClonedMIs[i]; } -namespace llvm { - inline bool operator<(unsigned V, const IdxMBBPair &IM) { - return V < IM.first; - } - - inline bool operator<(const IdxMBBPair &IM, unsigned V) { - return IM.first < V; - } - - struct Idx2MBBCompare { - bool operator()(const IdxMBBPair &LHS, const IdxMBBPair &RHS) const { - return LHS.first < RHS.first; - } - }; -} - /// runOnMachineFunction - Register allocate the whole function /// bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) { From dalej at apple.com Mon Feb 18 11:44:00 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 18 Feb 2008 09:44:00 -0800 Subject: [llvm-commits] [llvm] r47244 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/addnegneg.ll In-Reply-To: <200802172103.m1HL3aIc007777@zion.cs.uiuc.edu> References: <200802172103.m1HL3aIc007777@zion.cs.uiuc.edu> Message-ID: On Feb 17, 2008, at 1:03 PM, Chris Lattner wrote: > Author: lattner > Date: Sun Feb 17 15:03:36 2008 > New Revision: 47244 > > URL: http://llvm.org/viewvc/llvm-project?rev=47244&view=rev > Log: > Fold (-x + -y) -> -(x+y) which promotes better association, fixing > the second half of PR2047 This is unsafe for IEEE floating point. Try x=0, y= -0. From clattner at apple.com Mon Feb 18 11:44:59 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Feb 2008 09:44:59 -0800 Subject: [llvm-commits] [llvm] r47220 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll In-Reply-To: <200802181835.37610.baldrick@free.fr> References: <200802162056.m1GKu5cE029424@zion.cs.uiuc.edu> <200802170341.21614.baldrick@free.fr> <98B2FBC7-B1F3-4A8F-AA4B-177F96C212D5@apple.com> <200802181835.37610.baldrick@free.fr> Message-ID: <4C5DE2E5-5DDF-4CA5-BEF1-71AC3C03C687@apple.com> On Feb 18, 2008, at 9:35 AM, Duncan Sands wrote: > Hi Chris, > >>>> Nice. Out of curiousity, how does nest do to codegen? >>> >>> 'nest' causes a specific register to be grabbed for the >>> parameter in calls. So removing it doesn't do much :) >> >> Ok. > > if you want me to remove the transform, just ask :) I mostly did it > because seeing all those useless "nest" attributes floating around > annoys me when rummaging about in Ada produced .ll's. I have no problem with it. It makes sense to me. >> You can just do: >> CallSite User(cast(*UI)); >> >> and then handle user generically. > > Actually you couldn't, but you can now (see the CallSite changes just > committed). Ah, strange, I thought that was allowed :) -Chris From sabre at nondot.org Mon Feb 18 11:47:30 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 17:47:30 -0000 Subject: [llvm-commits] [llvm] r47275 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200802181747.m1IHlVwY025583@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 11:47:29 2008 New Revision: 47275 URL: http://llvm.org/viewvc/llvm-project?rev=47275&view=rev Log: minor code simplification, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=47275&r1=47274&r2=47275&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Feb 18 11:47:29 2008 @@ -1117,15 +1117,13 @@ // First, we have to check that the dependency is another memcpy Instruction* dep = MD.getDependency(M); - if (dep == MemoryDependenceAnalysis::None || - dep == MemoryDependenceAnalysis::NonLocal) + if (dep == MemoryDependenceAnalysis::None || + dep == MemoryDependenceAnalysis::NonLocal) + return false; + else if (CallInst* C = dyn_cast(dep)) + return performReturnSlotOptzn(M, C, toErase); + else if (!isa(dep)) return false; - else if (!isa(dep)) { - if (CallInst* C = dyn_cast(dep)) - return performReturnSlotOptzn(M, C, toErase); - else - return false; - } // We can only transforms memcpy's where the dest of one is the source of the // other From sabre at nondot.org Mon Feb 18 11:50:16 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 17:50:16 -0000 Subject: [llvm-commits] [llvm] r47276 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200802181750.m1IHoHYY025688@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 11:50:16 2008 New Revision: 47276 URL: http://llvm.org/viewvc/llvm-project?rev=47276&view=rev Log: Transforming -A + -B --> -(A + B) isn't safe for FP, thanks to Dale for noticing this! Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47276&r1=47275&r2=47276&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 18 11:50:16 2008 @@ -2092,10 +2092,12 @@ // -A + B --> B - A // -A + -B --> -(A + B) if (Value *LHSV = dyn_castNegVal(LHS)) { - if (Value *RHSV = dyn_castNegVal(RHS)) { - Instruction *NewAdd = BinaryOperator::createAdd(LHSV, RHSV, "sum"); - InsertNewInstBefore(NewAdd, I); - return BinaryOperator::createNeg(NewAdd); + if (LHS->getType()->isIntOrIntVector()) { + if (Value *RHSV = dyn_castNegVal(RHS)) { + Instruction *NewAdd = BinaryOperator::createAdd(LHSV, RHSV, "sum"); + InsertNewInstBefore(NewAdd, I); + return BinaryOperator::createNeg(NewAdd); + } } return BinaryOperator::createSub(RHS, LHSV); From baldrick at free.fr Mon Feb 18 11:54:46 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 18 Feb 2008 18:54:46 +0100 Subject: [llvm-commits] [llvm] r47265 - in /llvm/trunk: lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/sret.ll In-Reply-To: <200802180924.m1I9OtV9005657@zion.cs.uiuc.edu> References: <200802180924.m1I9OtV9005657@zion.cs.uiuc.edu> Message-ID: <200802181854.46975.baldrick@free.fr> Hi Owen, nice transform! > + // Check that we're copying to an argument... > + Value* cpyDest = cpy->getDest(); > + if (!isa(cpyDest)) > + return false; > + > + // And that the argument is the return slot > + Argument* sretArg = cast(cpyDest); > + if (!sretArg->hasStructRetAttr()) > + return false; why is it relevant that the memcpy is to an sret argument? The transform would be equally valid if it was to a temporary I think. The essential condition seems to be: the memcpy destination should not be accessable (for read or write) by the function called. Knowing that the destination is a noalias parameter is simply helpful in determining that (I don't see what sret has to do with it...). On the other hand, it matters that the memcpy source is passed to an sret parameter, because this means that the called function does not read any existing values in it (i.e. it is undefined what the callee gets if it tries to read existing values via the sret parameter). OK, I know this is not explicitly part of the sret definition, but it could reasonably be. The patch doesn't seem to check whether the memcpy source is being passed as an sret parameter. Finally, it matters that the size of the memcpy is the whole size of the memcpy source. Imagine that you pass a 10 byte memtmp to the call, then memcpy 5 bytes of it to a 5 byte object. It is clearly wrong to pass the 5 byte object directly to the call. Ciao, Duncan. PS: The other conditions like no other uses also seem way too strict. From gohman at apple.com Mon Feb 18 11:55:27 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 18 Feb 2008 17:55:27 -0000 Subject: [llvm-commits] [llvm] r47277 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/mul-remat.ll Message-ID: <200802181755.m1IHtRj6025855@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 18 11:55:26 2008 New Revision: 47277 URL: http://llvm.org/viewvc/llvm-project?rev=47277&view=rev Log: Don't mark scalar integer multiplication as Expand on x86, since x86 has plain one-result scalar integer multiplication instructions. This avoids expanding such instructions into MUL_LOHI sequences that must be special-cased at isel time, and avoids the problem with that code that provented memory operands from being folded. This fixes PR1874, addressesing the most common case. The uncommon cases of optimizing multiply-high operations will require work in DAGCombiner. Added: llvm/trunk/test/CodeGen/X86/mul-remat.ll 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=47277&r1=47276&r2=47277&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 18 11:55:26 2008 @@ -169,35 +169,31 @@ setOperationAction(ISD::BIT_CONVERT , MVT::i32 , Expand); } - // Scalar integer multiply, multiply-high, divide, and remainder are + // Scalar integer multiply-high, divide, and remainder are // lowered to use operations that produce two results, to match the // available instructions. This exposes the two-result form to trivial // CSE, which is able to combine x/y and x%y into a single instruction, // for example. The single-result multiply instructions are introduced // in X86ISelDAGToDAG.cpp, after CSE, for uses where the the high part // is not needed. - setOperationAction(ISD::MUL , MVT::i8 , Expand); setOperationAction(ISD::MULHS , MVT::i8 , Expand); setOperationAction(ISD::MULHU , MVT::i8 , Expand); setOperationAction(ISD::SDIV , MVT::i8 , Expand); setOperationAction(ISD::UDIV , MVT::i8 , Expand); setOperationAction(ISD::SREM , MVT::i8 , Expand); setOperationAction(ISD::UREM , MVT::i8 , Expand); - setOperationAction(ISD::MUL , MVT::i16 , Expand); setOperationAction(ISD::MULHS , MVT::i16 , Expand); setOperationAction(ISD::MULHU , MVT::i16 , Expand); setOperationAction(ISD::SDIV , MVT::i16 , Expand); setOperationAction(ISD::UDIV , MVT::i16 , Expand); setOperationAction(ISD::SREM , MVT::i16 , Expand); setOperationAction(ISD::UREM , MVT::i16 , Expand); - setOperationAction(ISD::MUL , MVT::i32 , Expand); setOperationAction(ISD::MULHS , MVT::i32 , Expand); setOperationAction(ISD::MULHU , MVT::i32 , Expand); setOperationAction(ISD::SDIV , MVT::i32 , Expand); setOperationAction(ISD::UDIV , MVT::i32 , Expand); setOperationAction(ISD::SREM , MVT::i32 , Expand); setOperationAction(ISD::UREM , MVT::i32 , Expand); - setOperationAction(ISD::MUL , MVT::i64 , Expand); setOperationAction(ISD::MULHS , MVT::i64 , Expand); setOperationAction(ISD::MULHU , MVT::i64 , Expand); setOperationAction(ISD::SDIV , MVT::i64 , Expand); @@ -205,6 +201,11 @@ setOperationAction(ISD::SREM , MVT::i64 , Expand); setOperationAction(ISD::UREM , MVT::i64 , Expand); + // 8, 16, and 32-bit plain multiply are legal. And 64-bit multiply + // is also legal on x86-64. + if (!Subtarget->is64Bit()) + setOperationAction(ISD::MUL , MVT::i64 , Expand); + setOperationAction(ISD::BR_JT , MVT::Other, Expand); setOperationAction(ISD::BRCOND , MVT::Other, Custom); setOperationAction(ISD::BR_CC , MVT::Other, Expand); Added: llvm/trunk/test/CodeGen/X86/mul-remat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mul-remat.ll?rev=47277&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/mul-remat.ll (added) +++ llvm/trunk/test/CodeGen/X86/mul-remat.ll Mon Feb 18 11:55:26 2008 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep mov | count 1 +; PR1874 + +define i32 @test(i32 %a, i32 %b) { +entry: + %tmp3 = mul i32 %b, %a + ret i32 %tmp3 +} From sabre at nondot.org Mon Feb 18 12:30:14 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 18:30:14 -0000 Subject: [llvm-commits] [llvm] r47278 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200802181830.m1IIUEfE027066@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 12:30:13 2008 New Revision: 47278 URL: http://llvm.org/viewvc/llvm-project?rev=47278&view=rev Log: Add a note about sext from i1 plus flags use. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=47278&r1=47277&r2=47278&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Feb 18 12:30:13 2008 @@ -1528,3 +1528,55 @@ See PR2053 for more details. //===---------------------------------------------------------------------===// + +Consider: +int test(unsigned long a, unsigned long b) { return -(a < b); } + +We currently compile this to: + +define i32 @test(i32 %a, i32 %b) nounwind { + %tmp3 = icmp ult i32 %a, %b ; [#uses=1] + %tmp34 = zext i1 %tmp3 to i32 ; [#uses=1] + %tmp5 = sub i32 0, %tmp34 ; [#uses=1] + ret i32 %tmp5 +} + +and + +_test: + movl 8(%esp), %eax + cmpl %eax, 4(%esp) + setb %al + movzbl %al, %eax + negl %eax + ret + +Several deficiencies here. First, we should instcombine zext+neg into sext: + +define i32 @test2(i32 %a, i32 %b) nounwind { + %tmp3 = icmp ult i32 %a, %b ; [#uses=1] + %tmp34 = sext i1 %tmp3 to i32 ; [#uses=1] + ret i32 %tmp34 +} + +However, before we can do that, we have to fix the bad codegen that we get for +sext from bool: + +_test2: + movl 8(%esp), %eax + cmpl %eax, 4(%esp) + setb %al + movzbl %al, %eax + shll $31, %eax + sarl $31, %eax + ret + +This code should be at least as good as the code above. Once this is fixed, we +can optimize this specific case even more to: + + movl 8(%esp), %eax + xorl %ecx, %ecx + cmpl %eax, 4(%esp) + sbbl %ecx, %ecx + +//===---------------------------------------------------------------------===// From clattner at apple.com Mon Feb 18 12:31:58 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Feb 2008 10:31:58 -0800 Subject: [llvm-commits] [llvm] r47277 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/mul-remat.ll In-Reply-To: <200802181755.m1IHtRj6025855@zion.cs.uiuc.edu> References: <200802181755.m1IHtRj6025855@zion.cs.uiuc.edu> Message-ID: <95A47101-0BC5-4725-8F2F-D13E324B593F@apple.com> On Feb 18, 2008, at 9:55 AM, Dan Gohman wrote: > Don't mark scalar integer multiplication as Expand on x86, since x86 > has plain one-result scalar integer multiplication instructions. > This avoids expanding such instructions into MUL_LOHI sequences that > must be special-cased at isel time, and avoids the problem with that > code that provented memory operands from being folded. > > This fixes PR1874, addressesing the most common case. The uncommon > cases of optimizing multiply-high operations will require work > in DAGCombiner. Very nice! > + // 8, 16, and 32-bit plain multiply are legal. And 64-bit multiply > + // is also legal on x86-64. > + if (!Subtarget->is64Bit()) > + setOperationAction(ISD::MUL , MVT::i64 , Expand); Are you sure you need this? if !is64Bit(), i64 won't be legal, so the multiply will be expanded unconditionally. -Chris From natebegeman at mac.com Mon Feb 18 12:39:23 2008 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 18 Feb 2008 18:39:23 -0000 Subject: [llvm-commits] [llvm] r47279 - /llvm/trunk/lib/Target/README.txt Message-ID: <200802181839.m1IIdNrS027349@zion.cs.uiuc.edu> Author: sampo Date: Mon Feb 18 12:39:23 2008 New Revision: 47279 URL: http://llvm.org/viewvc/llvm-project?rev=47279&view=rev Log: Add a note Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=47279&r1=47278&r2=47279&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Mon Feb 18 12:39:23 2008 @@ -621,3 +621,6 @@ to know that it doesn't modify G either. This is very tricky. //===---------------------------------------------------------------------===// + +We should add an FRINT node to the DAG to model targets that have legal +implementations of ceil/floor/rint. From sabre at nondot.org Mon Feb 18 12:46:39 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 18:46:39 -0000 Subject: [llvm-commits] [llvm] r47280 - /llvm/trunk/lib/Target/README.txt Message-ID: <200802181846.m1IIkdI1027674@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 18 12:46:39 2008 New Revision: 47280 URL: http://llvm.org/viewvc/llvm-project?rev=47280&view=rev Log: upgrade some tests. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=47280&r1=47279&r2=47280&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Mon Feb 18 12:46:39 2008 @@ -397,32 +397,32 @@ ; This testcase is due to tail-duplication not wanting to copy the return ; instruction into the terminating blocks because there was other code ; optimized out of the function after the taildup happened. -;RUN: llvm-upgrade < %s | llvm-as | opt -tailcallelim | llvm-dis | not grep call +; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | not grep call -int %t4(int %a) { +define i32 @t4(i32 %a) { entry: - %tmp.1 = and int %a, 1 - %tmp.2 = cast int %tmp.1 to bool - br bool %tmp.2, label %then.0, label %else.0 - -then.0: - %tmp.5 = add int %a, -1 - %tmp.3 = call int %t4( int %tmp.5 ) - br label %return - -else.0: - %tmp.7 = setne int %a, 0 - br bool %tmp.7, label %then.1, label %return - -then.1: - %tmp.11 = add int %a, -2 - %tmp.9 = call int %t4( int %tmp.11 ) - br label %return + %tmp.1 = and i32 %a, 1 ; [#uses=1] + %tmp.2 = icmp ne i32 %tmp.1, 0 ; [#uses=1] + br i1 %tmp.2, label %then.0, label %else.0 + +then.0: ; preds = %entry + %tmp.5 = add i32 %a, -1 ; [#uses=1] + %tmp.3 = call i32 @t4( i32 %tmp.5 ) ; [#uses=1] + br label %return + +else.0: ; preds = %entry + %tmp.7 = icmp ne i32 %a, 0 ; [#uses=1] + br i1 %tmp.7, label %then.1, label %return + +then.1: ; preds = %else.0 + %tmp.11 = add i32 %a, -2 ; [#uses=1] + %tmp.9 = call i32 @t4( i32 %tmp.11 ) ; [#uses=1] + br label %return -return: - %result.0 = phi int [ 0, %else.0 ], [ %tmp.3, %then.0 ], +return: ; preds = %then.1, %else.0, %then.0 + %result.0 = phi i32 [ 0, %else.0 ], [ %tmp.3, %then.0 ], [ %tmp.9, %then.1 ] - ret int %result.0 + ret i32 %result.0 } //===---------------------------------------------------------------------===// @@ -446,21 +446,19 @@ Argument promotion should promote arguments for recursive functions, like this: -; RUN: llvm-upgrade < %s | llvm-as | opt -argpromotion | llvm-dis | grep x.val +; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep x.val -implementation ; Functions: - -internal int %foo(int* %x) { +define internal i32 @foo(i32* %x) { entry: - %tmp = load int* %x - %tmp.foo = call int %foo(int *%x) - ret int %tmp.foo + %tmp = load i32* %x ; [#uses=0] + %tmp.foo = call i32 @foo( i32* %x ) ; [#uses=1] + ret i32 %tmp.foo } -int %bar(int* %x) { +define i32 @bar(i32* %x) { entry: - %tmp3 = call int %foo( int* %x) ; [#uses=1] - ret int %tmp3 + %tmp3 = call i32 @foo( i32* %x ) ; [#uses=1] + ret i32 %tmp3 } //===---------------------------------------------------------------------===// @@ -529,16 +527,22 @@ corresponding integer operations. On a yonah, this loop: double a[256]; - for (b = 0; b < 10000000; b++) - for (i = 0; i < 256; i++) - a[i] = -a[i]; +void foo() { + int i, b; + for (b = 0; b < 10000000; b++) + for (i = 0; i < 256; i++) + a[i] = -a[i]; +} is twice as slow as this loop: long long a[256]; - for (b = 0; b < 10000000; b++) - for (i = 0; i < 256; i++) - a[i] ^= (1ULL << 63); +void foo() { + int i, b; + for (b = 0; b < 10000000; b++) + for (i = 0; i < 256; i++) + a[i] ^= (1ULL << 63); +} and I suspect other processors are similar. On X86 in particular this is a big win because doing this with integers allows the use of read/modify/write From evan.cheng at apple.com Mon Feb 18 12:56:31 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Feb 2008 18:56:31 -0000 Subject: [llvm-commits] [llvm] r47281 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200802181856.m1IIuVnW028002@zion.cs.uiuc.edu> Author: evancheng Date: Mon Feb 18 12:56:31 2008 New Revision: 47281 URL: http://llvm.org/viewvc/llvm-project?rev=47281&view=rev Log: - Remove the previous check which broke coalescer-commute3.ll - For now, conservatively ignore copy MI whose source is a physical register. Commuting its def MI can cause a physical register live interval to be live through a loop (since we know it's live coming into the def MI). 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=47281&r1=47280&r2=47281&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Feb 18 12:56:31 2008 @@ -247,11 +247,11 @@ unsigned CopyIdx = li_->getDefIndex(li_->getInstructionIndex(CopyMI)); - // FIXME: For now, only eliminate the copy by commuting its def is the source - // does not live pass the move. Coalescing those copies may end up may simply - // end up swapping a live interval for another. That and because usually only - // the non-two address operand can be folded can end up pessimizing the code. - if (CopyMI->findRegisterUseOperandIdx(IntA.reg, true) != -1) + // FIXME: For now, only eliminate the copy by commuting its def when the + // source register is a virtual register. We want to guard against cases + // where the copy is a back edge copy and commuting the def lengthen the + // live interval of the source register to the entire loop. + if (TargetRegisterInfo::isPhysicalRegister(IntA.reg)) return false; // BValNo is a value number in B that is defined by a copy from A. 'B3' in From gohman at apple.com Mon Feb 18 13:34:55 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 18 Feb 2008 19:34:55 -0000 Subject: [llvm-commits] [llvm] r47282 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200802181934.m1IJYtr4029621@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 18 13:34:53 2008 New Revision: 47282 URL: http://llvm.org/viewvc/llvm-project?rev=47282&view=rev Log: Chris pointed out that it's not necessary to set i64 MUL to Expand on x86-32 since i64 itself is not a Legal type. And, update some comments. 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=47282&r1=47281&r2=47282&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 18 13:34:53 2008 @@ -169,13 +169,16 @@ setOperationAction(ISD::BIT_CONVERT , MVT::i32 , Expand); } - // Scalar integer multiply-high, divide, and remainder are - // lowered to use operations that produce two results, to match the - // available instructions. This exposes the two-result form to trivial - // CSE, which is able to combine x/y and x%y into a single instruction, - // for example. The single-result multiply instructions are introduced - // in X86ISelDAGToDAG.cpp, after CSE, for uses where the the high part - // is not needed. + // Scalar integer divide and remainder are lowered to use operations that + // produce two results, to match the available instructions. This exposes + // the two-result form to trivial CSE, which is able to combine x/y and x%y + // into a single instruction. + // + // Scalar integer multiply-high is also lowered to use two-result + // operations, to match the available instructions. However, plain multiply + // (low) operations are left as Legal, as there are single-result + // instructions for this in x86. Using the two-result multiply instructions + // when both high and low results are needed must be arranged by dagcombine. setOperationAction(ISD::MULHS , MVT::i8 , Expand); setOperationAction(ISD::MULHU , MVT::i8 , Expand); setOperationAction(ISD::SDIV , MVT::i8 , Expand); @@ -201,11 +204,6 @@ setOperationAction(ISD::SREM , MVT::i64 , Expand); setOperationAction(ISD::UREM , MVT::i64 , Expand); - // 8, 16, and 32-bit plain multiply are legal. And 64-bit multiply - // is also legal on x86-64. - if (!Subtarget->is64Bit()) - setOperationAction(ISD::MUL , MVT::i64 , Expand); - setOperationAction(ISD::BR_JT , MVT::Other, Expand); setOperationAction(ISD::BRCOND , MVT::Other, Custom); setOperationAction(ISD::BR_CC , MVT::Other, Expand); From evan.cheng at apple.com Mon Feb 18 13:43:30 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Feb 2008 11:43:30 -0800 Subject: [llvm-commits] [llvm] r47247 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp In-Reply-To: <200802172129.m1HLT8JL008466@zion.cs.uiuc.edu> References: <200802172129.m1HLT8JL008466@zion.cs.uiuc.edu> Message-ID: <35BDC015-C9F5-487A-A0AF-490BE201DE9C@apple.com> Hi Resistor, This breaks MultiSource/Benchmarks/Prolangs-C++/city under x86-64. Please take a look. Thanks, Evan On Feb 17, 2008, at 1:29 PM, Owen Anderson wrote: > Author: resistor > Date: Sun Feb 17 15:29:08 2008 > New Revision: 47247 > > URL: http://llvm.org/viewvc/llvm-project?rev=47247&view=rev > Log: > Teach getModRefInfo that memcpy, memmove, and memset don't "capture" > memory addresses. > Also, noalias arguments are be considered "like" stack allocated > ones for this purpose, because > the only way they can be modref'ed is if they escape somewhere in > the current function. > > Modified: > llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp > > Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=47247&r1=47246&r2=47247&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) > +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 > 15:29:08 2008 > @@ -21,7 +21,7 @@ > #include "llvm/ParameterAttributes.h" > #include "llvm/GlobalVariable.h" > #include "llvm/Instructions.h" > -#include "llvm/Intrinsics.h" > +#include "llvm/IntrinsicInst.h" > #include "llvm/Pass.h" > #include "llvm/Target/TargetData.h" > #include "llvm/ADT/SmallVector.h" > @@ -228,6 +228,13 @@ > // If returned, the address will escape to calling functions, > but no > // callees could modify it. > break; // next use > + case Instruction::Call: > + // If the call is to a few known safe intrinsics, we know > that it does > + // not escape > + if (isa(I)) > + return false; > + else > + return true; > default: > return true; > } > @@ -247,8 +254,11 @@ > // Allocations and byval arguments are "new" objects. > if (Object && > (isa(Object) || > - (isa(Object) && cast(Object)- > >hasByValAttr()))) { > - // Okay, the pointer is to a stack allocated object. If we > can prove that > + (isa(Object) && > + (cast(Object)- > >hasByValAttr() || > + cast(Object)- > >hasNoAliasAttr())))) { > + // Okay, the pointer is to a stack allocated (or effectively > so, for > + // for noalias parameters) object. If we can prove that > // the pointer never "escapes", then we know the call cannot > clobber it, > // because it simply can't get its address. > if (!AddressMightEscape(Object)) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From criswell at uiuc.edu Mon Feb 18 13:49:35 2008 From: criswell at uiuc.edu (John Criswell) Date: Mon, 18 Feb 2008 19:49:35 -0000 Subject: [llvm-commits] [poolalloc] r47283 - /poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200802181949.m1IJnZlF030269@zion.cs.uiuc.edu> Author: criswell Date: Mon Feb 18 13:49:35 2008 New Revision: 47283 URL: http://llvm.org/viewvc/llvm-project?rev=47283&view=rev Log: Fixed line wrapping of comments. No functionality changes. Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=47283&r1=47282&r2=47283&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Mon Feb 18 13:49:35 2008 @@ -135,10 +135,10 @@ std::map FuncMap; - // Now clone a function using the pool arg list obtained in the previous pass - // over the modules. Loop over only the function initially in the program, - // don't traverse newly added ones. If the function needs new arguments, make - // its clone. + // Now clone a function using the pool arg list obtained in the previous + // pass over the modules. Loop over only the function initially in the + // program, don't traverse newly added ones. If the function needs new + // arguments, make its clone. std::set ClonedFunctions; {TIME_REGION(X, "MakeFunctionClone"); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) @@ -379,7 +379,8 @@ ++NumCloned; - // Figure out what the arguments are to be for the new version of the function + // Figure out what the arguments are to be for the new version of the + // function const FunctionType *OldFuncTy = F.getFunctionType(); std::vector ArgTys(FI.ArgNodes.size(), PoolDescPtrTy); ArgTys.reserve(OldFuncTy->getNumParams() + FI.ArgNodes.size()); From sabre at nondot.org Mon Feb 18 16:44:07 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Feb 2008 16:44:07 -0600 Subject: [llvm-commits] CVS: llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.pdf Message-ID: <200802182244.m1IMi7CT006393@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2008-02-23-TRANSACT-TangerObjBased.pdf updated: 1.1 -> 1.2 --- Log message: updated paper. --- Diffs of the changes: (+0 -0) 2008-02-23-TRANSACT-TangerObjBased.pdf | 0 1 files changed Index: llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.pdf From nicholas at mxc.ca Mon Feb 18 16:48:05 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Feb 2008 22:48:05 -0000 Subject: [llvm-commits] [llvm] r47287 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll Message-ID: <200802182248.m1IMm5Ru006557@zion.cs.uiuc.edu> Author: nicholas Date: Mon Feb 18 16:48:05 2008 New Revision: 47287 URL: http://llvm.org/viewvc/llvm-project?rev=47287&view=rev Log: Correctly fold divide-by-constant, even when faced with overflow. Added: llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47287&r1=47286&r2=47287&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 18 16:48:05 2008 @@ -605,6 +605,28 @@ static ConstantInt *Multiply(ConstantInt *C1, ConstantInt *C2) { return ConstantInt::get(C1->getValue() * C2->getValue()); } +/// MultiplyOverflows - True if the multiply can not be expressed in an int +/// this size. +static bool MultiplyOverflows(ConstantInt *C1, ConstantInt *C2, bool sign) { + uint32_t W = C1->getBitWidth(); + APInt LHSExt = C1->getValue(), RHSExt = C2->getValue(); + if (sign) { + LHSExt.sext(W * 2); + RHSExt.sext(W * 2); + } else { + LHSExt.zext(W * 2); + RHSExt.zext(W * 2); + } + + APInt MulExt = LHSExt * RHSExt; + + if (sign) { + APInt Min = APInt::getSignedMinValue(W).sext(W * 2); + APInt Max = APInt::getSignedMaxValue(W).sext(W * 2); + return MulExt.slt(Min) || MulExt.sgt(Max); + } else + return MulExt.ugt(APInt::getLowBitsSet(W * 2, W)); +} /// ComputeMaskedBits - Determine which of the bits specified in Mask are /// known to be either zero or one and return them in the KnownZero/KnownOne @@ -2632,8 +2654,11 @@ if (Instruction *LHS = dyn_cast(Op0)) if (Instruction::BinaryOps(LHS->getOpcode()) == I.getOpcode()) if (ConstantInt *LHSRHS = dyn_cast(LHS->getOperand(1))) { - return BinaryOperator::create(I.getOpcode(), LHS->getOperand(0), - Multiply(RHS, LHSRHS)); + if (MultiplyOverflows(RHS, LHSRHS, I.getOpcode()==Instruction::SDiv)) + return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); + else + return BinaryOperator::create(I.getOpcode(), LHS->getOperand(0), + Multiply(RHS, LHSRHS)); } if (!RHS->isZero()) { // avoid X udiv 0 Added: llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll?rev=47287&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll Mon Feb 18 16:48:05 2008 @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i.* 0} | count 2 +; PR2048 + +define i32 @i(i32 %a) { + %tmp1 = sdiv i32 %a, -1431655765 + %tmp2 = sdiv i32 %tmp1, 3 + ret i32 %tmp2 +} + +define i8 @j(i8 %a) { + %tmp1 = sdiv i8 %a, 64 + %tmp2 = sdiv i8 %tmp1, 3 + ret i8 %tmp2 +} Added: llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll?rev=47287&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll Mon Feb 18 16:48:05 2008 @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {sdiv i8 \%a, 9} +; PR2048 + +define i8 @i(i8 %a) { + %tmp1 = sdiv i8 %a, -3 + %tmp2 = sdiv i8 %tmp1, -3 + ret i8 %tmp2 +} + From evan.cheng at apple.com Mon Feb 18 17:04:33 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Feb 2008 23:04:33 -0000 Subject: [llvm-commits] [llvm] r47290 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp 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/vec_shift2.ll Message-ID: <200802182304.m1IN4XL0007154@zion.cs.uiuc.edu> Author: evancheng Date: Mon Feb 18 17:04:32 2008 New Revision: 47290 URL: http://llvm.org/viewvc/llvm-project?rev=47290&view=rev Log: - When DAG combiner is folding a bit convert into a BUILD_VECTOR, it should check if it's essentially a SCALAR_TO_VECTOR. Avoid turning (v8i16) <10, u, u, u> to <10, 0, u, u, u, u, u, u>. Instead, simply convert it to a SCALAR_TO_VECTOR of the proper type. - X86 now normalize SCALAR_TO_VECTOR to (BIT_CONVERT (v4i32 SCALAR_TO_VECTOR)). Get rid of X86ISD::S2VEC. Added: llvm/trunk/test/CodeGen/X86/vec_shift2.ll Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 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 Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=47290&r1=47289&r2=47290&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Feb 18 17:04:32 2008 @@ -611,6 +611,11 @@ /// BUILD_VECTOR where all of the elements are 0 or undef. bool isBuildVectorAllZeros(const SDNode *N); + /// isScalarToVector - Return true if the specified node is a + /// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low + /// element is not an undef. + bool isScalarToVector(const SDNode *N); + /// isDebugLabel - Return true if the specified node represents a debug /// label (i.e. ISD::LABEL or TargetInstrInfo::LABEL node and third operand /// is 0). Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=47290&r1=47289&r2=47290&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Feb 18 17:04:32 2008 @@ -3450,14 +3450,16 @@ Ops.push_back(DAG.getConstant(NewBits, DstEltVT)); } - MVT::ValueType VT = MVT::getVectorType(DstEltVT, - Ops.size()); + MVT::ValueType VT = MVT::getVectorType(DstEltVT, Ops.size()); return DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0], Ops.size()); } // Finally, this must be the case where we are shrinking elements: each input // turns into multiple outputs. + bool isS2V = ISD::isScalarToVector(BV); unsigned NumOutputsPerInput = SrcBitSize/DstBitSize; + MVT::ValueType VT = MVT::getVectorType(DstEltVT, + NumOutputsPerInput * BV->getNumOperands()); SmallVector Ops; for (unsigned i = 0, e = BV->getNumOperands(); i != e; ++i) { if (BV->getOperand(i).getOpcode() == ISD::UNDEF) { @@ -3466,18 +3468,19 @@ continue; } uint64_t OpVal = cast(BV->getOperand(i))->getValue(); - for (unsigned j = 0; j != NumOutputsPerInput; ++j) { unsigned ThisVal = OpVal & ((1ULL << DstBitSize)-1); - OpVal >>= DstBitSize; Ops.push_back(DAG.getConstant(ThisVal, DstEltVT)); + if (isS2V && i == 0 && j == 0 && ThisVal == OpVal) + // Simply turn this into a SCALAR_TO_VECTOR of the new type. + return DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, Ops[0]); + OpVal >>= DstBitSize; } // For big endian targets, swap the order of the pieces of each element. if (TLI.isBigEndian()) std::reverse(Ops.end()-NumOutputsPerInput, Ops.end()); } - MVT::ValueType VT = MVT::getVectorType(DstEltVT, Ops.size()); return DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0], Ops.size()); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=47290&r1=47289&r2=47290&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Feb 18 17:04:32 2008 @@ -176,6 +176,27 @@ return true; } +/// isScalarToVector - Return true if the specified node is a +/// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low +/// element is not an undef. +bool ISD::isScalarToVector(const SDNode *N) { + if (N->getOpcode() == ISD::SCALAR_TO_VECTOR) + return true; + + if (N->getOpcode() != ISD::BUILD_VECTOR) + return false; + if (N->getOperand(0).getOpcode() == ISD::UNDEF) + return false; + unsigned NumElems = N->getNumOperands(); + for (unsigned i = 1; i < NumElems; ++i) { + SDOperand V = N->getOperand(i); + if (V.getOpcode() != ISD::UNDEF) + return false; + } + return true; +} + + /// isDebugLabel - Return true if the specified node represents a debug /// label (i.e. ISD::LABEL or TargetInstrInfo::LABEL node and third operand /// is 0). Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=47290&r1=47289&r2=47290&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 18 17:04:32 2008 @@ -583,7 +583,6 @@ setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v8i8, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v4i16, Custom); - setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v2i32, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v1i64, Custom); } @@ -3834,7 +3833,16 @@ SDOperand X86TargetLowering::LowerSCALAR_TO_VECTOR(SDOperand Op, SelectionDAG &DAG) { SDOperand AnyExt = DAG.getNode(ISD::ANY_EXTEND, MVT::i32, Op.getOperand(0)); - return DAG.getNode(X86ISD::S2VEC, Op.getValueType(), AnyExt); + MVT::ValueType VT = MVT::v2i32; + switch (Op.getValueType()) { + default: break; + case MVT::v16i8: + case MVT::v8i16: + VT = MVT::v4i32; + break; + } + return DAG.getNode(ISD::BIT_CONVERT, Op.getValueType(), + DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, AnyExt)); } // ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as @@ -5357,7 +5365,6 @@ case X86ISD::REP_MOVS: return "X86ISD::REP_MOVS"; case X86ISD::GlobalBaseReg: return "X86ISD::GlobalBaseReg"; case X86ISD::Wrapper: return "X86ISD::Wrapper"; - case X86ISD::S2VEC: return "X86ISD::S2VEC"; case X86ISD::PEXTRB: return "X86ISD::PEXTRB"; case X86ISD::PEXTRW: return "X86ISD::PEXTRW"; case X86ISD::INSERTPS: return "X86ISD::INSERTPS"; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=47290&r1=47289&r2=47290&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Feb 18 17:04:32 2008 @@ -166,10 +166,6 @@ /// relative displacements. WrapperRIP, - /// S2VEC - X86 version of SCALAR_TO_VECTOR. The destination base does not - /// have to match the operand type. - S2VEC, - /// PEXTRB - Extract an 8-bit value from a vector and zero extend it to /// i32, corresponds to X86::PEXTRB. PEXTRB, Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=47290&r1=47289&r2=47290&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Mon Feb 18 17:04:32 2008 @@ -156,12 +156,13 @@ //===----------------------------------------------------------------------===// // Data Transfer Instructions -let neverHasSideEffects = 1 in def MMX_MOVD64rr : MMXI<0x6E, MRMSrcReg, (outs VR64:$dst), (ins GR32:$src), - "movd\t{$src, $dst|$dst, $src}", []>; -let isSimpleLoad = 1, mayLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in + "movd\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (v2i32 (scalar_to_vector GR32:$src)))]>; +let isSimpleLoad = 1, isReMaterializable = 1 in def MMX_MOVD64rm : MMXI<0x6E, MRMSrcMem, (outs VR64:$dst), (ins i32mem:$src), - "movd\t{$src, $dst|$dst, $src}", []>; + "movd\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (v2i32 (scalar_to_vector (loadi32 addr:$src))))]>; let mayStore = 1 in def MMX_MOVD64mr : MMXI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, VR64:$src), "movd\t{$src, $dst|$dst, $src}", []>; @@ -547,27 +548,25 @@ def : Pat<(v8i8 (bitconvert (i64 GR64:$src))), (MMX_MOVD64to64rr GR64:$src)>; -def MMX_X86s2vec : SDNode<"X86ISD::S2VEC", SDTypeProfile<1, 1, []>, []>; - // Move scalar to XMM zero-extended // movd to XMM register zero-extends let AddedComplexity = 15 in { def : Pat<(v8i8 (vector_shuffle immAllZerosV_bc, - (v8i8 (MMX_X86s2vec GR32:$src)), MMX_MOVL_shuffle_mask)), + (bc_v8i8 (v2i32 (scalar_to_vector GR32:$src))), + MMX_MOVL_shuffle_mask)), (MMX_MOVZDI2PDIrr GR32:$src)>; def : Pat<(v4i16 (vector_shuffle immAllZerosV_bc, - (v4i16 (MMX_X86s2vec GR32:$src)), MMX_MOVL_shuffle_mask)), - (MMX_MOVZDI2PDIrr GR32:$src)>; - def : Pat<(v2i32 (vector_shuffle immAllZerosV, - (v2i32 (MMX_X86s2vec GR32:$src)), MMX_MOVL_shuffle_mask)), + (bc_v4i16 (v2i32 (scalar_to_vector GR32:$src))), + MMX_MOVL_shuffle_mask)), (MMX_MOVZDI2PDIrr GR32:$src)>; } -// Scalar to v2i32 / v4i16 / v8i8. The source may be a GR32, but only the lower +// Scalar to v4i16 / v8i8. The source may be a GR32, but only the lower // 8 or 16-bits matter. -def : Pat<(v8i8 (MMX_X86s2vec GR32:$src)), (MMX_MOVD64rr GR32:$src)>; -def : Pat<(v4i16 (MMX_X86s2vec GR32:$src)), (MMX_MOVD64rr GR32:$src)>; -def : Pat<(v2i32 (MMX_X86s2vec GR32:$src)), (MMX_MOVD64rr GR32:$src)>; +def : Pat<(bc_v8i8 (v2i32 (scalar_to_vector GR32:$src))), + (MMX_MOVD64rr GR32:$src)>; +def : Pat<(bc_v4i16 (v2i32 (scalar_to_vector GR32:$src))), + (MMX_MOVD64rr GR32:$src)>; // Patterns to perform canonical versions of vector shuffling. let AddedComplexity = 10 in { Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=47290&r1=47289&r2=47290&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Feb 18 17:04:32 2008 @@ -34,7 +34,6 @@ def X86fsrl : SDNode<"X86ISD::FSRL", SDTX86FPShiftOp>; def X86comi : SDNode<"X86ISD::COMI", SDTX86CmpTest>; def X86ucomi : SDNode<"X86ISD::UCOMI", SDTX86CmpTest>; -def X86s2vec : SDNode<"X86ISD::S2VEC", SDTypeProfile<1, 1, []>, []>; def X86pextrb : SDNode<"X86ISD::PEXTRB", SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>; def X86pextrw : SDNode<"X86ISD::PEXTRW", @@ -1781,22 +1780,6 @@ (bitconvert (memopv2i64 addr:$src2))))]>; } -multiclass PDI_binop_rmi_int opc, bits<8> opc2, Format ImmForm, - string OpcodeStr, Intrinsic IntId> { - def rr : PDI; - def rm : PDI; - def ri : PDIi8; -} - - /// PDI_binop_rm - Simple SSE2 binary operator. multiclass PDI_binop_rm opc, string OpcodeStr, SDNode OpNode, ValueType OpVT, bit Commutable = 0> { @@ -1871,16 +1854,61 @@ defm PSADBW : PDI_binop_rm_int<0xE0, "psadbw", int_x86_sse2_psad_bw, 1>; -defm PSLLW : PDI_binop_rmi_int<0xF1, 0x71, MRM6r, "psllw", int_x86_sse2_psll_w>; -defm PSLLD : PDI_binop_rmi_int<0xF2, 0x72, MRM6r, "pslld", int_x86_sse2_psll_d>; -defm PSLLQ : PDI_binop_rmi_int<0xF3, 0x73, MRM6r, "psllq", int_x86_sse2_psll_q>; - -defm PSRLW : PDI_binop_rmi_int<0xD1, 0x71, MRM2r, "psrlw", int_x86_sse2_psrl_w>; -defm PSRLD : PDI_binop_rmi_int<0xD2, 0x72, MRM2r, "psrld", int_x86_sse2_psrl_d>; -defm PSRLQ : PDI_binop_rmi_int<0xD3, 0x73, MRM2r, "psrlq", int_x86_sse2_psrl_q>; +defm PSLLW : PDI_binop_rm_int<0xF1, "psllw", int_x86_sse2_psll_w>; +defm PSLLD : PDI_binop_rm_int<0xF2, "pslld", int_x86_sse2_psll_d>; +defm PSLLQ : PDI_binop_rm_int<0xF3, "psllq", int_x86_sse2_psll_q>; + +defm PSRLW : PDI_binop_rm_int<0xD1, "psrlw", int_x86_sse2_psrl_w>; +defm PSRLD : PDI_binop_rm_int<0xD2, "psrld", int_x86_sse2_psrl_d>; +defm PSRLQ : PDI_binop_rm_int<0xD3, "psrlq", int_x86_sse2_psrl_q>; + +defm PSRAW : PDI_binop_rm_int<0xE1, "psraw", int_x86_sse2_psra_w>; +defm PSRAD : PDI_binop_rm_int<0xE2, "psrad", int_x86_sse2_psra_d>; + +// Some immediate variants need to match a bit_convert. +def PSLLWri : PDIi8<0x71, MRM6r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "psllw\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psll_w VR128:$src1, + (bc_v8i16 (v4i32 (scalar_to_vector (i32 imm:$src2))))))]>; +def PSLLDri : PDIi8<0x72, MRM6r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "pslld\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psll_d VR128:$src1, + (scalar_to_vector (i32 imm:$src2))))]>; +def PSLLQri : PDIi8<0x73, MRM6r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "psllq\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psll_q VR128:$src1, + (bc_v2i64 (v4i32 (scalar_to_vector (i32 imm:$src2))))))]>; + +def PSRLWri : PDIi8<0x71, MRM2r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "psrlw\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psrl_w VR128:$src1, + (bc_v8i16 (v4i32 (scalar_to_vector (i32 imm:$src2))))))]>; +def PSRLDri : PDIi8<0x72, MRM2r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "psrld\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psrl_d VR128:$src1, + (scalar_to_vector (i32 imm:$src2))))]>; +def PSRLQri : PDIi8<0x73, MRM2r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "psrlq\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psrl_q VR128:$src1, + (bc_v2i64 (v4i32 (scalar_to_vector (i32 imm:$src2))))))]>; + +def PSRAWri : PDIi8<0x71, MRM4r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "psraw\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psra_w VR128:$src1, + (bc_v8i16 (v4i32 (scalar_to_vector (i32 imm:$src2))))))]>; +def PSRADri : PDIi8<0x72, MRM4r, (outs VR128:$dst), + (ins VR128:$src1, i32i8imm:$src2), + "psrad\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_psra_d VR128:$src1, + (scalar_to_vector (i32 imm:$src2))))]>; -defm PSRAW : PDI_binop_rmi_int<0xE1, 0x71, MRM4r, "psraw", int_x86_sse2_psra_w>; -defm PSRAD : PDI_binop_rmi_int<0xE2, 0x72, MRM4r, "psrad", int_x86_sse2_psra_d>; // PSRAQ doesn't exist in SSE[1-3]. // 128-bit logical shifts. @@ -2729,13 +2757,6 @@ def : Pat<(fextend (loadf32 addr:$src)), (CVTSS2SDrm addr:$src)>; -// Scalar to v8i16 / v16i8. The source may be a GR32, but only the lower 8 or -// 16-bits matter. -def : Pat<(v8i16 (X86s2vec GR32:$src)), (MOVDI2PDIrr GR32:$src)>, - Requires<[HasSSE2]>; -def : Pat<(v16i8 (X86s2vec GR32:$src)), (MOVDI2PDIrr GR32:$src)>, - Requires<[HasSSE2]>; - // bit_convert let Predicates = [HasSSE2] in { def : Pat<(v2i64 (bitconvert (v4i32 VR128:$src))), (v2i64 VR128:$src)>; Added: llvm/trunk/test/CodeGen/X86/vec_shift2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shift2.ll?rev=47290&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shift2.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shift2.ll Mon Feb 18 17:04:32 2008 @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep CPI + +define <2 x i64> @t1(<2 x i64> %b1, <2 x i64> %c) nounwind { + %tmp1 = bitcast <2 x i64> %b1 to <8 x i16> + %tmp2 = tail call <8 x i16> @llvm.x86.sse2.psrl.w( <8 x i16> %tmp1, <8 x i16> bitcast (<4 x i32> < i32 14, i32 undef, i32 undef, i32 undef > to <8 x i16>) ) nounwind readnone + %tmp3 = bitcast <8 x i16> %tmp2 to <2 x i64> + ret <2 x i64> %tmp3 +} + +define <4 x i32> @t2(<2 x i64> %b1, <2 x i64> %c) nounwind { + %tmp1 = bitcast <2 x i64> %b1 to <4 x i32> + %tmp2 = tail call <4 x i32> @llvm.x86.sse2.psll.d( <4 x i32> %tmp1, <4 x i32> < i32 14, i32 undef, i32 undef, i32 undef > ) nounwind readnone + ret <4 x i32> %tmp2 +} + +declare <8 x i16> @llvm.x86.sse2.psrl.w(<8 x i16>, <8 x i16>) nounwind readnone +declare <4 x i32> @llvm.x86.sse2.psll.d(<4 x i32>, <4 x i32>) nounwind readnone From criswell at uiuc.edu Mon Feb 18 17:06:24 2008 From: criswell at uiuc.edu (John Criswell) Date: Mon, 18 Feb 2008 23:06:24 -0000 Subject: [llvm-commits] [poolalloc] r47291 - /poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200802182306.m1IN6OJB007222@zion.cs.uiuc.edu> Author: criswell Date: Mon Feb 18 17:06:24 2008 New Revision: 47291 URL: http://llvm.org/viewvc/llvm-project?rev=47291&view=rev Log: Taught pool allocation how to deal with the new function attributes. Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=47291&r1=47290&r2=47291&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Mon Feb 18 17:06:24 2008 @@ -24,6 +24,7 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Constants.h" +#include "llvm/ParameterAttributes.h" #include "llvm/Support/CFG.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" @@ -424,6 +425,29 @@ {TIME_REGION(X, "CloneFunctionInto"); CloneFunctionInto(New, &F, ValueMap, Returns); } + + // + // The CloneFunctionInto() function will copy the parameter attributes + // verbatim. This is incorrect; each attribute should be shifted one so + // that the pool descriptor has no attributes. + // + const ParamAttrsList * OldAttrs = New->getParamAttrs(); + ParamAttrsVector NewAttrsVector; + for (unsigned index = 0; index < OldAttrs->size(); ++index) { + // Find the argument index + unsigned argIndex = OldAttrs->getParamIndex (index); + + // If it's not the return value, move the attribute to the next + // parameter. + if (argIndex) ++argIndex; + + // Add the parameter to the new list. + NewAttrsVector.push_back(ParamAttrsWithIndex::get(argIndex,OldAttrs->getParamAttrsAtIndex(index))); + } + + // Assign the new attributes to the function clone + New->setParamAttrs (ParamAttrsList::get (NewAttrsVector)); + // Invert the ValueMap into the NewToOldValueMap std::map &NewToOldValueMap = FI.NewToOldValueMap; From resistor at mac.com Mon Feb 18 17:31:15 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 18 Feb 2008 17:31:15 -0600 Subject: [llvm-commits] [llvm] r47247 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp In-Reply-To: <35BDC015-C9F5-487A-A0AF-490BE201DE9C@apple.com> References: <200802172129.m1HLT8JL008466@zion.cs.uiuc.edu> <35BDC015-C9F5-487A-A0AF-490BE201DE9C@apple.com> Message-ID: <29DAC190-37EC-4EB9-AD84-F4664C28F2BC@mac.com> I can't reproduce on my Mac Pro. Can you file a bug report with a reduce testcase? --Owen On Feb 18, 2008, at 1:43 PM, Evan Cheng wrote: > Hi Resistor, > > This breaks MultiSource/Benchmarks/Prolangs-C++/city under x86-64. > Please take a look. > > Thanks, > > Evan > > On Feb 17, 2008, at 1:29 PM, Owen Anderson wrote: > >> Author: resistor >> Date: Sun Feb 17 15:29:08 2008 >> New Revision: 47247 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=47247&view=rev >> Log: >> Teach getModRefInfo that memcpy, memmove, and memset don't >> "capture" memory addresses. >> Also, noalias arguments are be considered "like" stack allocated >> ones for this purpose, because >> the only way they can be modref'ed is if they escape somewhere in >> the current function. >> >> Modified: >> llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp >> >> Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=47247&r1=47246&r2=47247&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) >> +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 >> 15:29:08 2008 >> @@ -21,7 +21,7 @@ >> #include "llvm/ParameterAttributes.h" >> #include "llvm/GlobalVariable.h" >> #include "llvm/Instructions.h" >> -#include "llvm/Intrinsics.h" >> +#include "llvm/IntrinsicInst.h" >> #include "llvm/Pass.h" >> #include "llvm/Target/TargetData.h" >> #include "llvm/ADT/SmallVector.h" >> @@ -228,6 +228,13 @@ >> // If returned, the address will escape to calling functions, >> but no >> // callees could modify it. >> break; // next use >> + case Instruction::Call: >> + // If the call is to a few known safe intrinsics, we know >> that it does >> + // not escape >> + if (isa(I)) >> + return false; >> + else >> + return true; >> default: >> return true; >> } >> @@ -247,8 +254,11 @@ >> // Allocations and byval arguments are "new" objects. >> if (Object && >> (isa(Object) || >> - (isa(Object) && cast(Object)- >> >hasByValAttr()))) { >> - // Okay, the pointer is to a stack allocated object. If we >> can prove that >> + (isa(Object) && >> + (cast(Object)- >> >hasByValAttr() || >> + cast(Object)- >> >hasNoAliasAttr())))) { >> + // Okay, the pointer is to a stack allocated (or effectively >> so, for >> + // for noalias parameters) object. If we can prove that >> // the pointer never "escapes", then we know the call cannot >> clobber it, >> // because it simply can't get its address. >> if (!AddressMightEscape(Object)) >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2555 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080218/58ae39f1/attachment.bin From clattner at apple.com Mon Feb 18 17:34:10 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Feb 2008 15:34:10 -0800 Subject: [llvm-commits] [llvm] r47247 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp In-Reply-To: <29DAC190-37EC-4EB9-AD84-F4664C28F2BC@mac.com> References: <200802172129.m1HLT8JL008466@zion.cs.uiuc.edu> <35BDC015-C9F5-487A-A0AF-490BE201DE9C@apple.com> <29DAC190-37EC-4EB9-AD84-F4664C28F2BC@mac.com> Message-ID: <25513CF2-2701-4A80-9840-DD068257DF10@apple.com> On Feb 18, 2008, at 3:31 PM, Owen Anderson wrote: > I can't reproduce on my Mac Pro. Can you file a bug report with a > reduce testcase? Did you try building the testcase with -m64? It doesn't happen at -m32. -Chris From tonic at nondot.org Mon Feb 18 19:41:05 2008 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 19 Feb 2008 01:41:05 -0000 Subject: [llvm-commits] [llvm] r47296 - in /llvm/trunk/test/CodeGen: Alpha/ CBackend/ Generic/ IA64/ SPARC/ Message-ID: <200802190141.m1J1f97U012487@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Feb 18 19:41:04 2008 New Revision: 47296 URL: http://llvm.org/viewvc/llvm-project?rev=47296&view=rev Log: Remove llvm-upgrade and update tests. Modified: llvm/trunk/test/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll llvm/trunk/test/CodeGen/Alpha/2005-12-12-MissingFCMov.ll llvm/trunk/test/CodeGen/Alpha/2006-01-18-MissedGlobal.ll llvm/trunk/test/CodeGen/Alpha/2006-01-26-VaargBreak.ll llvm/trunk/test/CodeGen/Alpha/2006-04-04-zextload.ll llvm/trunk/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll llvm/trunk/test/CodeGen/Alpha/2006-11-01-vastart.ll llvm/trunk/test/CodeGen/Alpha/bic.ll llvm/trunk/test/CodeGen/Alpha/bsr.ll llvm/trunk/test/CodeGen/Alpha/call_adj.ll llvm/trunk/test/CodeGen/Alpha/cmov.ll llvm/trunk/test/CodeGen/Alpha/cmpbge.ll llvm/trunk/test/CodeGen/Alpha/ctlz_e.ll llvm/trunk/test/CodeGen/Alpha/ctpop.ll llvm/trunk/test/CodeGen/Alpha/eqv.ll llvm/trunk/test/CodeGen/Alpha/jmp_table.ll llvm/trunk/test/CodeGen/Alpha/mul5.ll llvm/trunk/test/CodeGen/Alpha/neg1.ll llvm/trunk/test/CodeGen/Alpha/not.ll llvm/trunk/test/CodeGen/Alpha/ornot.ll llvm/trunk/test/CodeGen/Alpha/rpcc.ll llvm/trunk/test/CodeGen/Alpha/srl_and.ll llvm/trunk/test/CodeGen/Alpha/weak.ll llvm/trunk/test/CodeGen/Alpha/zapnot2.ll llvm/trunk/test/CodeGen/Alpha/zapnot3.ll llvm/trunk/test/CodeGen/Alpha/zapnot4.ll llvm/trunk/test/CodeGen/CBackend/2002-05-16-NameCollide.ll llvm/trunk/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll llvm/trunk/test/CodeGen/CBackend/2002-08-19-DataPointer.ll llvm/trunk/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll llvm/trunk/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll llvm/trunk/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll llvm/trunk/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll llvm/trunk/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll llvm/trunk/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll llvm/trunk/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll llvm/trunk/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll llvm/trunk/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll llvm/trunk/test/CodeGen/CBackend/2002-10-16-External.ll llvm/trunk/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll llvm/trunk/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll llvm/trunk/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll llvm/trunk/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll llvm/trunk/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll llvm/trunk/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll llvm/trunk/test/CodeGen/CBackend/2003-06-11-HexConstant.ll llvm/trunk/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll llvm/trunk/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx llvm/trunk/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll llvm/trunk/test/CodeGen/CBackend/2003-06-28-LinkOnceGlobalVars.llx llvm/trunk/test/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll llvm/trunk/test/CodeGen/CBackend/2003-10-23-UnusedType.ll llvm/trunk/test/CodeGen/CBackend/2003-10-28-CastToPtrToStruct.ll llvm/trunk/test/CodeGen/CBackend/2003-11-21-ConstantShiftExpr.ll llvm/trunk/test/CodeGen/CBackend/2004-02-13-FrameReturnAddress.llx llvm/trunk/test/CodeGen/CBackend/2004-02-15-PreexistingExternals.llx llvm/trunk/test/CodeGen/CBackend/2004-02-26-FPNotPrintableConstants.llx llvm/trunk/test/CodeGen/CBackend/2004-02-26-LinkOnceFunctions.llx llvm/trunk/test/CodeGen/CBackend/2004-08-09-va-end-null.ll llvm/trunk/test/CodeGen/CBackend/2004-11-13-FunctionPointerCast.llx llvm/trunk/test/CodeGen/CBackend/2004-12-03-ExternStatics.ll llvm/trunk/test/CodeGen/CBackend/2004-12-28-LogicalConstantExprs.ll llvm/trunk/test/CodeGen/CBackend/2005-02-14-VolatileOperations.ll llvm/trunk/test/CodeGen/CBackend/2005-03-08-RecursiveTypeCrash.ll llvm/trunk/test/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll llvm/trunk/test/CodeGen/CBackend/2005-08-23-Fmod.ll llvm/trunk/test/CodeGen/CBackend/2005-09-27-VolatileFuncPtr.ll llvm/trunk/test/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll llvm/trunk/test/CodeGen/Generic/2002-04-14-UnexpectedUnsignedType.ll llvm/trunk/test/CodeGen/Generic/2002-04-16-StackFrameSizeAlignment.ll llvm/trunk/test/CodeGen/Generic/2003-05-27-phifcmpd.ll llvm/trunk/test/CodeGen/Generic/2003-05-27-useboolinotherbb.ll llvm/trunk/test/CodeGen/Generic/2003-05-27-usefsubasbool.ll llvm/trunk/test/CodeGen/Generic/2003-05-28-ManyArgs.ll llvm/trunk/test/CodeGen/Generic/2003-05-30-BadFoldGEP.ll llvm/trunk/test/CodeGen/Generic/2003-05-30-BadPreselectPhi.ll llvm/trunk/test/CodeGen/Generic/2003-07-06-BadIntCmp.ll llvm/trunk/test/CodeGen/Generic/2003-07-07-BadLongConst.ll llvm/trunk/test/CodeGen/Generic/2003-07-08-BadCastToBool.ll llvm/trunk/test/CodeGen/Generic/2003-07-29-BadConstSbyte.ll llvm/trunk/test/CodeGen/Generic/2004-02-08-UnwindSupport.llx llvm/trunk/test/CodeGen/Generic/2004-05-09-LiveVarPartialRegister.llx llvm/trunk/test/CodeGen/Generic/2005-01-18-SetUO-InfLoop.ll llvm/trunk/test/CodeGen/Generic/2005-04-09-GlobalInPHI.ll llvm/trunk/test/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll llvm/trunk/test/CodeGen/Generic/2005-10-18-ZeroSizeStackObject.ll llvm/trunk/test/CodeGen/Generic/2005-10-21-longlonggtu.ll llvm/trunk/test/CodeGen/Generic/2005-12-01-Crash.ll llvm/trunk/test/CodeGen/Generic/2005-12-12-ExpandSextInreg.ll llvm/trunk/test/CodeGen/Generic/2006-01-12-BadSetCCFold.ll llvm/trunk/test/CodeGen/Generic/2006-01-18-InvalidBranchOpcodeAssert.ll llvm/trunk/test/CodeGen/Generic/2006-02-12-InsertLibcall.ll llvm/trunk/test/CodeGen/Generic/2006-03-01-dagcombineinfloop.ll llvm/trunk/test/CodeGen/Generic/2006-03-27-DebugInfoNULLDeclare.ll llvm/trunk/test/CodeGen/Generic/2006-04-11-vecload.ll llvm/trunk/test/CodeGen/Generic/2006-04-26-SetCCAnd.ll llvm/trunk/test/CodeGen/Generic/2006-04-28-Sign-extend-bool.ll llvm/trunk/test/CodeGen/Generic/2006-05-06-GEP-Cast-Sink-Crash.ll llvm/trunk/test/CodeGen/Generic/2006-06-12-LowerSwitchCrash.ll llvm/trunk/test/CodeGen/Generic/2006-06-13-ComputeMaskedBitsCrash.ll llvm/trunk/test/CodeGen/Generic/2006-06-28-SimplifySetCCCrash.ll llvm/trunk/test/CodeGen/Generic/2006-07-03-schedulers.ll llvm/trunk/test/CodeGen/Generic/2006-08-30-CoallescerCrash.ll llvm/trunk/test/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll llvm/trunk/test/CodeGen/Generic/2006-09-06-SwitchLowering.ll llvm/trunk/test/CodeGen/Generic/2006-10-27-CondFolding.ll llvm/trunk/test/CodeGen/Generic/2006-10-29-Crash.ll llvm/trunk/test/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll llvm/trunk/test/CodeGen/Generic/2006-11-20-DAGCombineCrash.ll llvm/trunk/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll llvm/trunk/test/CodeGen/Generic/BasicInstrs.llx llvm/trunk/test/CodeGen/Generic/BurgBadRegAlloc.ll llvm/trunk/test/CodeGen/Generic/ConstantExprLowering.llx llvm/trunk/test/CodeGen/Generic/SwitchLowering.ll llvm/trunk/test/CodeGen/Generic/badCallArgLRLLVM.ll llvm/trunk/test/CodeGen/Generic/badFoldGEP.ll llvm/trunk/test/CodeGen/Generic/badarg6.ll llvm/trunk/test/CodeGen/Generic/badlive.ll llvm/trunk/test/CodeGen/Generic/bool-to-double.ll llvm/trunk/test/CodeGen/Generic/call-ret0.ll llvm/trunk/test/CodeGen/Generic/call-ret42.ll llvm/trunk/test/CodeGen/Generic/call-void.ll llvm/trunk/test/CodeGen/Generic/call2-ret0.ll llvm/trunk/test/CodeGen/Generic/cast-fp.ll llvm/trunk/test/CodeGen/Generic/constindices.ll llvm/trunk/test/CodeGen/Generic/debug-info.ll llvm/trunk/test/CodeGen/Generic/div-neg-power-2.ll llvm/trunk/test/CodeGen/Generic/fneg-fabs.ll llvm/trunk/test/CodeGen/Generic/fwdtwice.ll llvm/trunk/test/CodeGen/Generic/global-ret0.ll llvm/trunk/test/CodeGen/Generic/hello.ll llvm/trunk/test/CodeGen/Generic/intrinsics.ll llvm/trunk/test/CodeGen/Generic/isunord.ll llvm/trunk/test/CodeGen/Generic/llvm-ct-intrinsics.ll llvm/trunk/test/CodeGen/Generic/negintconst.ll llvm/trunk/test/CodeGen/Generic/nested-select.ll llvm/trunk/test/CodeGen/Generic/print-add.ll llvm/trunk/test/CodeGen/Generic/print-arith-fp.ll llvm/trunk/test/CodeGen/Generic/print-arith-int.ll llvm/trunk/test/CodeGen/Generic/print-int.ll llvm/trunk/test/CodeGen/Generic/print-mul-exp.ll llvm/trunk/test/CodeGen/Generic/print-mul.ll llvm/trunk/test/CodeGen/Generic/print-shift.ll llvm/trunk/test/CodeGen/Generic/ret0.ll llvm/trunk/test/CodeGen/Generic/ret42.ll llvm/trunk/test/CodeGen/Generic/sched.ll llvm/trunk/test/CodeGen/Generic/select.ll llvm/trunk/test/CodeGen/Generic/shift-int64.ll llvm/trunk/test/CodeGen/Generic/spillccr.ll llvm/trunk/test/CodeGen/Generic/stacksave-restore.ll llvm/trunk/test/CodeGen/Generic/switch-crit-edge-constant.ll llvm/trunk/test/CodeGen/Generic/vector-constantexpr.ll llvm/trunk/test/CodeGen/Generic/vector-identity-shuffle.ll llvm/trunk/test/CodeGen/Generic/vector.ll llvm/trunk/test/CodeGen/IA64/2005-08-22-LegalizerCrash.ll llvm/trunk/test/CodeGen/IA64/2005-10-29-shladd.ll llvm/trunk/test/CodeGen/IA64/ret-0.ll llvm/trunk/test/CodeGen/SPARC/2006-01-22-BitConvertLegalize.ll llvm/trunk/test/CodeGen/SPARC/ctpop.ll llvm/trunk/test/CodeGen/SPARC/xnor.ll Modified: llvm/trunk/test/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll Mon Feb 18 19:41:04 2008 @@ -1,19 +1,17 @@ ; There should be exactly two calls here (memset and malloc), no more. -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep jsr | count 2 +; RUN: llvm-as < %s | llc -march=alpha | grep jsr | count 2 %typedef.bc_struct = type opaque +declare void @llvm.memset.i64(i8*, i8, i64, i32) -implementation ; Functions: - -declare void %llvm.memset.i64(sbyte*, ubyte, ulong, uint) - -bool %l12_l94_bc_divide_endif_2E_3_2E_ce(int* %tmp.71.reload, uint %scale2.1.3, uint %extra.0, %typedef.bc_struct* %n1, %typedef.bc_struct* %n2, int* %tmp.92.reload, uint %tmp.94.reload, int* %tmp.98.reload, uint %tmp.100.reload, sbyte** %tmp.112.out, uint* %tmp.157.out, sbyte** %tmp.158.out) { +define i1 @l12_l94_bc_divide_endif_2E_3_2E_ce(i32* %tmp.71.reload, i32 %scale2.1.3, i32 %extra.0, %typedef.bc_struct* %n1, %typedef.bc_struct* %n2, i32* %tmp.92.reload, i32 %tmp.94.reload, i32* %tmp.98.reload, i32 %tmp.100.reload, i8** %tmp.112.out, i32* %tmp.157.out, i8** %tmp.158.out) { newFuncRoot: - %tmp.120 = add uint %extra.0, 2 ; [#uses=1] - %tmp.122 = add uint %tmp.120, %tmp.94.reload ; [#uses=1] - %tmp.123 = add uint %tmp.122, %tmp.100.reload ; [#uses=2] - %tmp.112 = malloc sbyte, uint %tmp.123 ; [#uses=3] - %tmp.137 = cast uint %tmp.123 to ulong ; [#uses=1] - tail call void %llvm.memset.i64( sbyte* %tmp.112, ubyte 0, ulong %tmp.137, uint 0 ) - ret bool true + %tmp.120 = add i32 %extra.0, 2 ; [#uses=1] + %tmp.122 = add i32 %tmp.120, %tmp.94.reload ; [#uses=1] + %tmp.123 = add i32 %tmp.122, %tmp.100.reload ; [#uses=2] + %tmp.112 = malloc i8, i32 %tmp.123 ; [#uses=1] + %tmp.137 = zext i32 %tmp.123 to i64 ; [#uses=1] + tail call void @llvm.memset.i64( i8* %tmp.112, i8 0, i64 %tmp.137, i32 0 ) + ret i1 true } + Modified: llvm/trunk/test/CodeGen/Alpha/2005-12-12-MissingFCMov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/2005-12-12-MissingFCMov.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/2005-12-12-MissingFCMov.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/2005-12-12-MissingFCMov.ll Mon Feb 18 19:41:04 2008 @@ -1,44 +1,40 @@ ; This shouldn't crash -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha +; RUN: llvm-as < %s | llc -march=alpha -; ModuleID = 'bugpoint-reduced-simplified.bc' -target endian = little -target pointersize = 64 -%.str_4 = external global [44 x sbyte] ; <[44 x sbyte]*> [#uses=0] + at .str_4 = external global [44 x i8] ; <[44 x i8]*> [#uses=0] -implementation ; Functions: +declare void @printf(i32, ...) -declare void %printf(int, ...) - -void %main() { +define void @main() { entry: - %tmp.11861 = setlt long 0, 1 ; [#uses=1] - %tmp.19466 = setlt long 0, 1 ; [#uses=1] - %tmp.21571 = setlt long 0, 1 ; [#uses=1] - %tmp.36796 = setlt long 0, 1 ; [#uses=1] - br bool %tmp.11861, label %loopexit.2, label %no_exit.2 - -no_exit.2: ; preds = %entry - ret void - -loopexit.2: ; preds = %entry - br bool %tmp.19466, label %loopexit.3, label %no_exit.3.preheader - -no_exit.3.preheader: ; preds = %loopexit.2 - ret void - -loopexit.3: ; preds = %loopexit.2 - br bool %tmp.21571, label %no_exit.6, label %no_exit.4 - -no_exit.4: ; preds = %loopexit.3 - ret void - -no_exit.6: ; preds = %no_exit.6, %loopexit.3 - %tmp.30793 = setgt long 0, 0 ; [#uses=1] - br bool %tmp.30793, label %loopexit.6, label %no_exit.6 - -loopexit.6: ; preds = %no_exit.6 - %Z.1 = select bool %tmp.36796, double 1.000000e+00, double 0x3FEFFF7CEDE74EAE ; [#uses=2] - tail call void (int, ...)* %printf( int 0, long 0, long 0, long 0, double 1.000000e+00, double 1.000000e+00, double %Z.1, double %Z.1 ) - ret void + %tmp.11861 = icmp slt i64 0, 1 ; [#uses=1] + %tmp.19466 = icmp slt i64 0, 1 ; [#uses=1] + %tmp.21571 = icmp slt i64 0, 1 ; [#uses=1] + %tmp.36796 = icmp slt i64 0, 1 ; [#uses=1] + br i1 %tmp.11861, label %loopexit.2, label %no_exit.2 + +no_exit.2: ; preds = %entry + ret void + +loopexit.2: ; preds = %entry + br i1 %tmp.19466, label %loopexit.3, label %no_exit.3.preheader + +no_exit.3.preheader: ; preds = %loopexit.2 + ret void + +loopexit.3: ; preds = %loopexit.2 + br i1 %tmp.21571, label %no_exit.6, label %no_exit.4 + +no_exit.4: ; preds = %loopexit.3 + ret void + +no_exit.6: ; preds = %no_exit.6, %loopexit.3 + %tmp.30793 = icmp sgt i64 0, 0 ; [#uses=1] + br i1 %tmp.30793, label %loopexit.6, label %no_exit.6 + +loopexit.6: ; preds = %no_exit.6 + %Z.1 = select i1 %tmp.36796, double 1.000000e+00, double 0x3FEFFF7CEDE74EAE; [#uses=2] + tail call void (i32, ...)* @printf( i32 0, i64 0, i64 0, i64 0, double 1.000000e+00, double 1.000000e+00, double %Z.1, double %Z.1 ) + ret void } + Modified: llvm/trunk/test/CodeGen/Alpha/2006-01-18-MissedGlobal.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/2006-01-18-MissedGlobal.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/2006-01-18-MissedGlobal.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/2006-01-18-MissedGlobal.ll Mon Feb 18 19:41:04 2008 @@ -1,30 +1,27 @@ ; The global symbol should be legalized -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha +; RUN: llvm-as < %s | llc -march=alpha -target endian = little -target pointersize = 64 - %struct.LIST_HELP = type { %struct.LIST_HELP*, sbyte* } - %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct._IO_FILE*, int, int, long, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [44 x sbyte] } - %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int } -%clause_SORT = external global [21 x %struct.LIST_HELP*] ; <[21 x %struct.LIST_HELP*]*> [#uses=1] -%ia_in = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1] -%multvec_j = external global [100 x uint] ; <[100 x uint]*> [#uses=1] +target datalayout = "e-p:64:64" + %struct.LIST_HELP = type { %struct.LIST_HELP*, i8* } + %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [44 x i8] } + %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } + at clause_SORT = external global [21 x %struct.LIST_HELP*] ; <[21 x %struct.LIST_HELP*]*> [#uses=0] + at ia_in = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1] + at multvec_j = external global [100 x i32] ; <[100 x i32]*> [#uses=0] -implementation ; Functions: - -void %main(int %argc) { +define void @main(i32 %argc) { clock_Init.exit: - %tmp.5.i575 = load int* null ; [#uses=1] - %tmp.309 = seteq int %tmp.5.i575, 0 ; [#uses=1] - br bool %tmp.309, label %UnifiedReturnBlock, label %then.17 - -then.17: ; preds = %clock_Init.exit - store %struct._IO_FILE* null, %struct._IO_FILE** %ia_in - %savedstack = call sbyte* %llvm.stacksave( ) ; [#uses=0] - ret void + %tmp.5.i575 = load i32* null ; [#uses=1] + %tmp.309 = icmp eq i32 %tmp.5.i575, 0 ; [#uses=1] + br i1 %tmp.309, label %UnifiedReturnBlock, label %then.17 + +then.17: ; preds = %clock_Init.exit + store %struct._IO_FILE* null, %struct._IO_FILE** @ia_in + %savedstack = call i8* @llvm.stacksave( ) ; [#uses=0] + ret void -UnifiedReturnBlock: ; preds = %clock_Init.exit - ret void +UnifiedReturnBlock: ; preds = %clock_Init.exit + ret void } -declare sbyte* %llvm.stacksave() +declare i8* @llvm.stacksave() Modified: llvm/trunk/test/CodeGen/Alpha/2006-01-26-VaargBreak.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/2006-01-26-VaargBreak.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/2006-01-26-VaargBreak.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/2006-01-26-VaargBreak.ll Mon Feb 18 19:41:04 2008 @@ -1,17 +1,14 @@ ; This shouldn't crash -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha +; RUN: llvm-as < %s | llc -march=alpha -; ModuleID = 'simp.bc' -target endian = little -target pointersize = 64 +target datalayout = "e-p:64:64" target triple = "alphaev6-unknown-linux-gnu" deplibs = [ "c", "crtend", "stdc++" ] - %struct.__va_list_tag = type { sbyte*, int } + %struct.__va_list_tag = type { i8*, i32 } -implementation ; Functions: - -uint %emit_library_call_value(int %nargs, ...) { +define i32 @emit_library_call_value(i32 %nargs, ...) { entry: - %tmp.223 = va_arg %struct.__va_list_tag* null, uint ; [#uses=0] - ret uint %tmp.223 + %tmp.223 = va_arg %struct.__va_list_tag* null, i32 ; [#uses=1] + ret i32 %tmp.223 } + Modified: llvm/trunk/test/CodeGen/Alpha/2006-04-04-zextload.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/2006-04-04-zextload.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/2006-04-04-zextload.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/2006-04-04-zextload.ll Mon Feb 18 19:41:04 2008 @@ -1,36 +1,34 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha +; RUN: llvm-as < %s | llc -march=alpha -target endian = little -target pointersize = 64 +target datalayout = "e-p:64:64" target triple = "alphaev67-unknown-linux-gnu" - %llvm.dbg.compile_unit.type = type { uint, { }*, uint, uint, sbyte*, sbyte*, sbyte* } - %struct._Callback_list = type { %struct._Callback_list*, void (uint, %struct.ios_base*, int)*, int, int } - %struct._Impl = type { int, %struct.facet**, ulong, %struct.facet**, sbyte** } - %struct._Words = type { sbyte*, long } - "struct.__codecvt_abstract_base" = type { %struct.facet } - "struct.basic_streambuf >" = type { int (...)**, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct.locale } - %struct.facet = type { int (...)**, int } - %struct.ios_base = type { int (...)**, long, long, uint, uint, uint, %struct._Callback_list*, %struct._Words, [8 x %struct._Words], int, %struct._Words*, %struct.locale } - %struct.locale = type { %struct._Impl* } - "struct.ostreambuf_iterator >" = type { "struct.basic_streambuf >"*, bool } -%llvm.dbg.compile_unit1047 = external global %llvm.dbg.compile_unit.type ; <%llvm.dbg.compile_unit.type*> [#uses=1] + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i32, i8*, i8*, i8* } + %struct._Callback_list = type { %struct._Callback_list*, void (i32, %struct.ios_base*, i32)*, i32, i32 } + %struct._Impl = type { i32, %struct.facet**, i64, %struct.facet**, i8** } + %struct._Words = type { i8*, i64 } + %"struct.__codecvt_abstract_base" = type { %struct.facet } + %"struct.basic_streambuf >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %struct.locale } + %struct.facet = type { i32 (...)**, i32 } + %struct.ios_base = type { i32 (...)**, i64, i64, i32, i32, i32, %struct._Callback_list*, %struct._Words, [8 x %struct._Words], i32, %struct._Words*, %struct.locale } + %struct.locale = type { %struct._Impl* } + %"struct.ostreambuf_iterator >" = type { %"struct.basic_streambuf >"*, i1 } + at llvm.dbg.compile_unit1047 = external global %llvm.dbg.compile_unit.type ; <%llvm.dbg.compile_unit.type*> [#uses=1] -implementation ; Functions: - -void %_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_() { +define void @_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_() { entry: - %tmp234 = seteq sbyte 0, 0 ; [#uses=1] - br bool %tmp234, label %cond_next243, label %cond_true235 + %tmp234 = icmp eq i8 0, 0 ; [#uses=1] + br i1 %tmp234, label %cond_next243, label %cond_true235 -cond_true235: ; preds = %entry - ret void +cond_true235: ; preds = %entry + ret void -cond_next243: ; preds = %entry - %tmp428 = load long* null ; [#uses=1] - %tmp428 = cast long %tmp428 to uint ; [#uses=1] - %tmp429 = alloca sbyte, uint %tmp428 ; [#uses=0] - call void %llvm.dbg.stoppoint( uint 1146, uint 0, { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit1047 to { }*) ) - unreachable +cond_next243: ; preds = %entry + %tmp428 = load i64* null ; [#uses=1] + %tmp428.upgrd.1 = trunc i64 %tmp428 to i32 ; [#uses=1] + %tmp429 = alloca i8, i32 %tmp428.upgrd.1 ; [#uses=0] + call void @llvm.dbg.stoppoint( i32 1146, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1047 to { }*) ) + unreachable } -declare void %llvm.dbg.stoppoint(uint, uint, { }*) +declare void @llvm.dbg.stoppoint(i32, i32, { }*) + Modified: llvm/trunk/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll Mon Feb 18 19:41:04 2008 @@ -1,20 +1,18 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha +; RUN: llvm-as < %s | llc -march=alpha -target endian = little -target pointersize = 64 +target datalayout = "e-p:64:64" target triple = "alphaev67-unknown-linux-gnu" -implementation ; Functions: - -int %_ZN9__gnu_cxx18__exchange_and_addEPVii(int* %__mem, int %__val) { +define i32 @_ZN9__gnu_cxx18__exchange_and_addEPVii(i32* %__mem, i32 %__val) { entry: - %__tmp = alloca int, align 4 ; [#uses=1] - %tmp3 = call int asm sideeffect "\0A$$Lxadd_0:\0A\09ldl_l $0,$3\0A\09addl $0,$4,$1\0A\09stl_c $1,$2\0A\09beq $1,$$Lxadd_0\0A\09mb", "=&r,=*&r,=*m,m,r"( int* %__tmp, int* %__mem, int* %__mem, int %__val ) ; [#uses=1] - ret int %tmp3 + %__tmp = alloca i32, align 4 ; [#uses=1] + %tmp3 = call i32 asm sideeffect "\0A$$Lxadd_0:\0A\09ldl_l $0,$3\0A\09addl $0,$4,$1\0A\09stl_c $1,$2\0A\09beq $1,$$Lxadd_0\0A\09mb", "=&r,=*&r,=*m,m,r"( i32* %__tmp, i32* %__mem, i32* %__mem, i32 %__val ) ; [#uses=1] + ret i32 %tmp3 } -void %_ZN9__gnu_cxx12__atomic_addEPVii(int* %__mem, int %__val) { +define void @_ZN9__gnu_cxx12__atomic_addEPVii(i32* %__mem, i32 %__val) { entry: - %tmp2 = call int asm sideeffect "\0A$$Ladd_1:\0A\09ldl_l $0,$2\0A\09addl $0,$3,$0\0A\09stl_c $0,$1\0A\09beq $0,$$Ladd_1\0A\09mb", "=&r,=*m,m,r"( int* %__mem, int* %__mem, int %__val ) ; [#uses=0] + %tmp2 = call i32 asm sideeffect "\0A$$Ladd_1:\0A\09ldl_l $0,$2\0A\09addl $0,$3,$0\0A\09stl_c $0,$1\0A\09beq $0,$$Ladd_1\0A\09mb", "=&r,=*m,m,r"( i32* %__mem, i32* %__mem, i32 %__val ) ; [#uses=0] ret void } + Modified: llvm/trunk/test/CodeGen/Alpha/2006-11-01-vastart.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/2006-11-01-vastart.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/2006-11-01-vastart.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/2006-11-01-vastart.ll Mon Feb 18 19:41:04 2008 @@ -1,18 +1,15 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha +; RUN: llvm-as < %s | llc -march=alpha target datalayout = "e-p:64:64" -target endian = little -target pointersize = 64 target triple = "alphaev67-unknown-linux-gnu" - %struct.va_list = type { sbyte*, int, int } + %struct.va_list = type { i8*, i32, i32 } -implementation ; Functions: - -void %yyerror(int, ...) { +define void @yyerror(i32, ...) { entry: - call void %llvm.va_start( %struct.va_list* null ) + %va.upgrd.1 = bitcast %struct.va_list* null to i8* ; [#uses=1] + call void @llvm.va_start( i8* %va.upgrd.1 ) ret void } -declare void %llvm.va_start(%struct.va_list*) +declare void @llvm.va_start(i8*) Modified: llvm/trunk/test/CodeGen/Alpha/bic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/bic.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/bic.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/bic.ll Mon Feb 18 19:41:04 2008 @@ -1,11 +1,9 @@ ; Make sure this testcase codegens to the bic instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep {bic} +; RUN: llvm-as < %s | llc -march=alpha | grep {bic} -implementation ; Functions: - -long %bar(long %x, long %y) { +define i64 @bar(i64 %x, i64 %y) { entry: - %tmp.1 = xor long %x, -1 ; [#uses=1] - %tmp.2 = and long %y, %tmp.1 - ret long %tmp.2 + %tmp.1 = xor i64 %x, -1 ; [#uses=1] + %tmp.2 = and i64 %y, %tmp.1 ; [#uses=1] + ret i64 %tmp.2 } Modified: llvm/trunk/test/CodeGen/Alpha/bsr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/bsr.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/bsr.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/bsr.ll Mon Feb 18 19:41:04 2008 @@ -1,13 +1,12 @@ ; Make sure this testcase codegens the bsr instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep bsr +; RUN: llvm-as < %s | llc -march=alpha | grep bsr -implementation - -internal long %abc(int %x) { - %tmp.2 = add int %x, -1 ; [#uses=1] - %tmp.0 = call long %abc( int %tmp.2 ) ; [#uses=1] - %tmp.5 = add int %x, -2 ; [#uses=1] - %tmp.3 = call long %abc( int %tmp.5 ) ; [#uses=1] - %tmp.6 = add long %tmp.0, %tmp.3 ; [#uses=1] - ret long %tmp.6 +define internal i64 @abc(i32 %x) { + %tmp.2 = add i32 %x, -1 ; [#uses=1] + %tmp.0 = call i64 @abc( i32 %tmp.2 ) ; [#uses=1] + %tmp.5 = add i32 %x, -2 ; [#uses=1] + %tmp.3 = call i64 @abc( i32 %tmp.5 ) ; [#uses=1] + %tmp.6 = add i64 %tmp.0, %tmp.3 ; [#uses=1] + ret i64 %tmp.6 } + Modified: llvm/trunk/test/CodeGen/Alpha/call_adj.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/call_adj.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/call_adj.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/call_adj.ll Mon Feb 18 19:41:04 2008 @@ -1,15 +1,13 @@ ;All this should do is not crash -;RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha +;RUN: llvm-as < %s | llc -march=alpha -target endian = little -target pointersize = 64 +target datalayout = "e-p:64:64" target triple = "alphaev67-unknown-linux-gnu" -implementation ; Functions: - -void %_ZNSt13basic_filebufIcSt11char_traitsIcEE22_M_convert_to_externalEPcl(uint %f) { +define void @_ZNSt13basic_filebufIcSt11char_traitsIcEE22_M_convert_to_externalEPcl(i32 %f) { entry: - %tmp49 = alloca sbyte, uint %f ; [#uses=1] - %tmp = call uint null( sbyte* null, sbyte* null, sbyte* null, sbyte* null, sbyte* null, sbyte* null, sbyte* null) - ret void + %tmp49 = alloca i8, i32 %f ; [#uses=0] + %tmp = call i32 null( i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null ) ; [#uses=0] + ret void } + Modified: llvm/trunk/test/CodeGen/Alpha/cmov.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/cmov.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/cmov.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/cmov.ll Mon Feb 18 19:41:04 2008 @@ -1,24 +1,23 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | not grep cmovlt -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep cmoveq +; RUN: llvm-as < %s | llc -march=alpha | not grep cmovlt +; RUN: llvm-as < %s | llc -march=alpha | grep cmoveq - -long %cmov_lt(long %a, long %c) { +define i64 @cmov_lt(i64 %a, i64 %c) { entry: - %tmp.1 = setlt long %c, 0 - %retval = select bool %tmp.1, long %a, long 10 - ret long %retval + %tmp.1 = icmp slt i64 %c, 0 ; [#uses=1] + %retval = select i1 %tmp.1, i64 %a, i64 10 ; [#uses=1] + ret i64 %retval } -long %cmov_const(long %a, long %b, long %c) { +define i64 @cmov_const(i64 %a, i64 %b, i64 %c) { entry: - %tmp.1 = setlt long %a, %b - %retval = select bool %tmp.1, long %c, long 10 - ret long %retval + %tmp.1 = icmp slt i64 %a, %b ; [#uses=1] + %retval = select i1 %tmp.1, i64 %c, i64 10 ; [#uses=1] + ret i64 %retval } -long %cmov_lt2(long %a, long %c) { +define i64 @cmov_lt2(i64 %a, i64 %c) { entry: - %tmp.1 = setgt long %c, 0 - %retval = select bool %tmp.1, long 10, long %a - ret long %retval + %tmp.1 = icmp sgt i64 %c, 0 ; [#uses=1] + %retval = select i1 %tmp.1, i64 10, i64 %a ; [#uses=1] + ret i64 %retval } Modified: llvm/trunk/test/CodeGen/Alpha/cmpbge.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/cmpbge.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/cmpbge.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/cmpbge.ll Mon Feb 18 19:41:04 2008 @@ -1,16 +1,16 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep cmpbge | count 2 +; RUN: llvm-as < %s | llc -march=alpha | grep cmpbge | count 2 -bool %test1(ulong %A, ulong %B) { - %C = and ulong %A, 255 - %D = and ulong %B, 255 - %E = setge ulong %C, %D - ret bool %E +define i1 @test1(i64 %A, i64 %B) { + %C = and i64 %A, 255 ; [#uses=1] + %D = and i64 %B, 255 ; [#uses=1] + %E = icmp uge i64 %C, %D ; [#uses=1] + ret i1 %E } -bool %test2(ulong %a, ulong %B) { - %A = shl ulong %a, ubyte 1 - %C = and ulong %A, 254 - %D = and ulong %B, 255 - %E = setge ulong %C, %D - ret bool %E +define i1 @test2(i64 %a, i64 %B) { + %A = shl i64 %a, 1 ; [#uses=1] + %C = and i64 %A, 254 ; [#uses=1] + %D = and i64 %B, 255 ; [#uses=1] + %E = icmp uge i64 %C, %D ; [#uses=1] + ret i1 %E } Modified: llvm/trunk/test/CodeGen/Alpha/ctlz_e.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/ctlz_e.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/ctlz_e.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/ctlz_e.ll Mon Feb 18 19:41:04 2008 @@ -1,12 +1,11 @@ ; Make sure this testcase does not use ctpop -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | not grep -i ctpop +; RUN: llvm-as < %s | llc -march=alpha | not grep -i ctpop -declare ulong %llvm.ctlz.i64(ulong) +declare i64 @llvm.ctlz.i64(i64) -implementation ; Functions: - -ulong %bar(ulong %x) { +define i64 @bar(i64 %x) { entry: - %tmp.1 = call ulong %llvm.ctlz.i64( ulong %x ) - ret ulong %tmp.1 + %tmp.1 = call i64 @llvm.ctlz.i64( i64 %x ) ; [#uses=1] + ret i64 %tmp.1 } + Modified: llvm/trunk/test/CodeGen/Alpha/ctpop.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/ctpop.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/ctpop.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/ctpop.ll Mon Feb 18 19:41:04 2008 @@ -1,20 +1,19 @@ ; Make sure this testcase codegens to the ctpop instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha -mcpu=ev67 | grep -i ctpop -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha -mattr=+CIX | \ +; RUN: llvm-as < %s | llc -march=alpha -mcpu=ev67 | grep -i ctpop +; RUN: llvm-as < %s | llc -march=alpha -mattr=+CIX | \ ; RUN: grep -i ctpop -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha -mcpu=ev6 | \ +; RUN: llvm-as < %s | llc -march=alpha -mcpu=ev6 | \ ; RUN: not grep -i ctpop -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha -mcpu=ev56 | \ +; RUN: llvm-as < %s | llc -march=alpha -mcpu=ev56 | \ ; RUN: not grep -i ctpop -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha -mattr=-CIX | \ +; RUN: llvm-as < %s | llc -march=alpha -mattr=-CIX | \ ; RUN: not grep -i ctpop -declare long %llvm.ctpop.i64(long) +declare i64 @llvm.ctpop.i64(i64) -implementation ; Functions: - -long %bar(long %x) { +define i64 @bar(i64 %x) { entry: - %tmp.1 = call long %llvm.ctpop.i64( long %x ) - ret long %tmp.1 + %tmp.1 = call i64 @llvm.ctpop.i64( i64 %x ) ; [#uses=1] + ret i64 %tmp.1 } + Modified: llvm/trunk/test/CodeGen/Alpha/eqv.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/eqv.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/eqv.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/eqv.ll Mon Feb 18 19:41:04 2008 @@ -1,11 +1,10 @@ ; Make sure this testcase codegens to the eqv instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep eqv +; RUN: llvm-as < %s | llc -march=alpha | grep eqv -implementation ; Functions: - -long %bar(long %x, long %y) { +define i64 @bar(i64 %x, i64 %y) { entry: - %tmp.1 = xor long %x, -1 ; [#uses=1] - %tmp.2 = xor long %y, %tmp.1 - ret long %tmp.2 + %tmp.1 = xor i64 %x, -1 ; [#uses=1] + %tmp.2 = xor i64 %y, %tmp.1 ; [#uses=1] + ret i64 %tmp.2 } + Modified: llvm/trunk/test/CodeGen/Alpha/jmp_table.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/jmp_table.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/jmp_table.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/jmp_table.ll Mon Feb 18 19:41:04 2008 @@ -1,101 +1,98 @@ ; try to check that we have the most important instructions, which shouldn't ; appear otherwise -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep jmp -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep gprel32 -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep ldl -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep rodata -; END. +; RUN: llvm-as < %s | llc -march=alpha | grep jmp +; RUN: llvm-as < %s | llc -march=alpha | grep gprel32 +; RUN: llvm-as < %s | llc -march=alpha | grep ldl +; RUN: llvm-as < %s | llc -march=alpha | grep rodata -target endian = little -target pointersize = 64 +target datalayout = "e-p:64:64" target triple = "alphaev67-unknown-linux-gnu" -%str = internal constant [2 x sbyte] c"1\00" ; <[2 x sbyte]*> [#uses=1] -%str1 = internal constant [2 x sbyte] c"2\00" ; <[2 x sbyte]*> [#uses=1] -%str2 = internal constant [2 x sbyte] c"3\00" ; <[2 x sbyte]*> [#uses=1] -%str3 = internal constant [2 x sbyte] c"4\00" ; <[2 x sbyte]*> [#uses=1] -%str4 = internal constant [2 x sbyte] c"5\00" ; <[2 x sbyte]*> [#uses=1] -%str5 = internal constant [2 x sbyte] c"6\00" ; <[2 x sbyte]*> [#uses=1] -%str6 = internal constant [2 x sbyte] c"7\00" ; <[2 x sbyte]*> [#uses=1] -%str7 = internal constant [2 x sbyte] c"8\00" ; <[2 x sbyte]*> [#uses=1] + at str = internal constant [2 x i8] c"1\00" ; <[2 x i8]*> [#uses=1] + at str1 = internal constant [2 x i8] c"2\00" ; <[2 x i8]*> [#uses=1] + at str2 = internal constant [2 x i8] c"3\00" ; <[2 x i8]*> [#uses=1] + at str3 = internal constant [2 x i8] c"4\00" ; <[2 x i8]*> [#uses=1] + at str4 = internal constant [2 x i8] c"5\00" ; <[2 x i8]*> [#uses=1] + at str5 = internal constant [2 x i8] c"6\00" ; <[2 x i8]*> [#uses=1] + at str6 = internal constant [2 x i8] c"7\00" ; <[2 x i8]*> [#uses=1] + at str7 = internal constant [2 x i8] c"8\00" ; <[2 x i8]*> [#uses=1] -implementation ; Functions: - -int %main(int %x, sbyte** %y) { +define i32 @main(i32 %x, i8** %y) { entry: - %x_addr = alloca int ; [#uses=2] - %y_addr = alloca sbyte** ; [#uses=1] - %retval = alloca int, align 4 ; [#uses=2] - %tmp = alloca int, align 4 ; [#uses=2] - %foo = alloca sbyte*, align 8 ; [#uses=9] - "alloca point" = cast int 0 to int ; [#uses=0] - store int %x, int* %x_addr - store sbyte** %y, sbyte*** %y_addr - %tmp = load int* %x_addr ; [#uses=1] - switch int %tmp, label %bb15 [ - int 1, label %bb - int 2, label %bb1 - int 3, label %bb3 - int 4, label %bb5 - int 5, label %bb7 - int 6, label %bb9 - int 7, label %bb11 - int 8, label %bb13 - ] - -bb: ; preds = %entry - %tmp = getelementptr [2 x sbyte]* %str, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp, sbyte** %foo - br label %bb16 - -bb1: ; preds = %entry - %tmp2 = getelementptr [2 x sbyte]* %str1, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp2, sbyte** %foo - br label %bb16 - -bb3: ; preds = %entry - %tmp4 = getelementptr [2 x sbyte]* %str2, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp4, sbyte** %foo - br label %bb16 - -bb5: ; preds = %entry - %tmp6 = getelementptr [2 x sbyte]* %str3, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp6, sbyte** %foo - br label %bb16 - -bb7: ; preds = %entry - %tmp8 = getelementptr [2 x sbyte]* %str4, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp8, sbyte** %foo - br label %bb16 - -bb9: ; preds = %entry - %tmp10 = getelementptr [2 x sbyte]* %str5, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp10, sbyte** %foo - br label %bb16 - -bb11: ; preds = %entry - %tmp12 = getelementptr [2 x sbyte]* %str6, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp12, sbyte** %foo - br label %bb16 - -bb13: ; preds = %entry - %tmp14 = getelementptr [2 x sbyte]* %str7, int 0, ulong 0 ; [#uses=1] - store sbyte* %tmp14, sbyte** %foo - br label %bb16 - -bb15: ; preds = %entry - br label %bb16 - -bb16: ; preds = %bb15, %bb13, %bb11, %bb9, %bb7, %bb5, %bb3, %bb1, %bb - %tmp17 = load sbyte** %foo ; [#uses=1] - %tmp18 = call int (...)* %print( sbyte* %tmp17 ) ; [#uses=0] - store int 0, int* %tmp - %tmp19 = load int* %tmp ; [#uses=1] - store int %tmp19, int* %retval - br label %return - -return: ; preds = %bb16 - %retval = load int* %retval ; [#uses=1] - ret int %retval + %x_addr = alloca i32 ; [#uses=2] + %y_addr = alloca i8** ; [#uses=1] + %retval = alloca i32, align 4 ; [#uses=2] + %tmp = alloca i32, align 4 ; [#uses=2] + %foo = alloca i8*, align 8 ; [#uses=9] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i32 %x, i32* %x_addr + store i8** %y, i8*** %y_addr + %tmp.upgrd.1 = load i32* %x_addr ; [#uses=1] + switch i32 %tmp.upgrd.1, label %bb15 [ + i32 1, label %bb + i32 2, label %bb1 + i32 3, label %bb3 + i32 4, label %bb5 + i32 5, label %bb7 + i32 6, label %bb9 + i32 7, label %bb11 + i32 8, label %bb13 + ] + +bb: ; preds = %entry + %tmp.upgrd.2 = getelementptr [2 x i8]* @str, i32 0, i64 0 ; [#uses=1] + store i8* %tmp.upgrd.2, i8** %foo + br label %bb16 + +bb1: ; preds = %entry + %tmp2 = getelementptr [2 x i8]* @str1, i32 0, i64 0 ; [#uses=1] + store i8* %tmp2, i8** %foo + br label %bb16 + +bb3: ; preds = %entry + %tmp4 = getelementptr [2 x i8]* @str2, i32 0, i64 0 ; [#uses=1] + store i8* %tmp4, i8** %foo + br label %bb16 + +bb5: ; preds = %entry + %tmp6 = getelementptr [2 x i8]* @str3, i32 0, i64 0 ; [#uses=1] + store i8* %tmp6, i8** %foo + br label %bb16 + +bb7: ; preds = %entry + %tmp8 = getelementptr [2 x i8]* @str4, i32 0, i64 0 ; [#uses=1] + store i8* %tmp8, i8** %foo + br label %bb16 + +bb9: ; preds = %entry + %tmp10 = getelementptr [2 x i8]* @str5, i32 0, i64 0 ; [#uses=1] + store i8* %tmp10, i8** %foo + br label %bb16 + +bb11: ; preds = %entry + %tmp12 = getelementptr [2 x i8]* @str6, i32 0, i64 0 ; [#uses=1] + store i8* %tmp12, i8** %foo + br label %bb16 + +bb13: ; preds = %entry + %tmp14 = getelementptr [2 x i8]* @str7, i32 0, i64 0 ; [#uses=1] + store i8* %tmp14, i8** %foo + br label %bb16 + +bb15: ; preds = %entry + br label %bb16 + +bb16: ; preds = %bb15, %bb13, %bb11, %bb9, %bb7, %bb5, %bb3, %bb1, %bb + %tmp17 = load i8** %foo ; [#uses=1] + %tmp18 = call i32 (...)* @print( i8* %tmp17 ) ; [#uses=0] + store i32 0, i32* %tmp + %tmp19 = load i32* %tmp ; [#uses=1] + store i32 %tmp19, i32* %retval + br label %return + +return: ; preds = %bb16 + %retval.upgrd.3 = load i32* %retval ; [#uses=1] + ret i32 %retval.upgrd.3 } -declare int %print(...) +declare i32 @print(...) + Modified: llvm/trunk/test/CodeGen/Alpha/mul5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/mul5.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/mul5.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/mul5.ll Mon Feb 18 19:41:04 2008 @@ -1,52 +1,53 @@ ; Make sure this testcase does not use mulq -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | \ +; RUN: llvm-as < %s | llvm-as | llc -march=alpha | \ ; RUN: not grep -i mul ; XFAIL: * -implementation ; Functions: - -ulong %foo1(ulong %x) { +define i64 @foo1(i64 %x) { entry: - %tmp.1 = mul ulong %x, 9 ; [#uses=1] - ret ulong %tmp.1 + %tmp.1 = mul i64 %x, 9 ; [#uses=1] + ret i64 %tmp.1 } -ulong %foo3(ulong %x) { + +define i64 @foo3(i64 %x) { entry: - %tmp.1 = mul ulong %x, 259 - ret ulong %tmp.1 + %tmp.1 = mul i64 %x, 259 ; [#uses=1] + ret i64 %tmp.1 } -ulong %foo4l(ulong %x) { +define i64 @foo4l(i64 %x) { entry: - %tmp.1 = mul ulong %x, 260 - ret ulong %tmp.1 + %tmp.1 = mul i64 %x, 260 ; [#uses=1] + ret i64 %tmp.1 } -ulong %foo4ln(ulong %x) { +define i64 @foo4ln(i64 %x) { entry: - %tmp.1 = mul ulong %x, 508 - ret ulong %tmp.1 + %tmp.1 = mul i64 %x, 508 ; [#uses=1] + ret i64 %tmp.1 } -ulong %foo4ln_more(ulong %x) { + +define i64 @foo4ln_more(i64 %x) { entry: - %tmp.1 = mul ulong %x, 252 - ret ulong %tmp.1 + %tmp.1 = mul i64 %x, 252 ; [#uses=1] + ret i64 %tmp.1 } -ulong %foo1n(ulong %x) { +define i64 @foo1n(i64 %x) { entry: - %tmp.1 = mul ulong %x, 511 - ret ulong %tmp.1 + %tmp.1 = mul i64 %x, 511 ; [#uses=1] + ret i64 %tmp.1 } -ulong %foo8l(ulong %x) { +define i64 @foo8l(i64 %x) { entry: - %tmp.1 = mul ulong %x, 768 - ret ulong %tmp.1 + %tmp.1 = mul i64 %x, 768 ; [#uses=1] + ret i64 %tmp.1 } -long %bar(long %x) { +define i64 @bar(i64 %x) { entry: - %tmp.1 = mul long %x, 5 ; [#uses=1] - ret long %tmp.1 + %tmp.1 = mul i64 %x, 5 ; [#uses=1] + ret i64 %tmp.1 } + Modified: llvm/trunk/test/CodeGen/Alpha/neg1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/neg1.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/neg1.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/neg1.ll Mon Feb 18 19:41:04 2008 @@ -1,9 +1,7 @@ ; Make sure this testcase codegens to the lda -1 instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep {\\-1} +; RUN: llvm-as < %s | llc -march=alpha | grep {\\-1} -implementation ; Functions: - -long %bar() { +define i64 @bar() { entry: - ret long -1 + ret i64 -1 } Modified: llvm/trunk/test/CodeGen/Alpha/not.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/not.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/not.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/not.ll Mon Feb 18 19:41:04 2008 @@ -1,10 +1,8 @@ ; Make sure this testcase codegens to the ornot instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep eqv +; RUN: llvm-as < %s | llc -march=alpha | grep eqv -implementation ; Functions: - -long %bar(long %x) { +define i64 @bar(i64 %x) { entry: - %tmp.1 = xor long %x, -1 ; [#uses=1] - ret long %tmp.1 + %tmp.1 = xor i64 %x, -1 ; [#uses=1] + ret i64 %tmp.1 } Modified: llvm/trunk/test/CodeGen/Alpha/ornot.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/ornot.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/ornot.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/ornot.ll Mon Feb 18 19:41:04 2008 @@ -1,11 +1,10 @@ ; Make sure this testcase codegens to the ornot instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep ornot +; RUN: llvm-as < %s | llc -march=alpha | grep ornot -implementation ; Functions: - -long %bar(long %x, long %y) { +define i64 @bar(i64 %x, i64 %y) { entry: - %tmp.1 = xor long %x, -1 ; [#uses=1] - %tmp.2 = or long %y, %tmp.1 - ret long %tmp.2 + %tmp.1 = xor i64 %x, -1 ; [#uses=1] + %tmp.2 = or i64 %y, %tmp.1 ; [#uses=1] + ret i64 %tmp.2 } + Modified: llvm/trunk/test/CodeGen/Alpha/rpcc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/rpcc.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/rpcc.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/rpcc.ll Mon Feb 18 19:41:04 2008 @@ -1,10 +1,9 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep rpcc +; RUN: llvm-as < %s | llc -march=alpha | grep rpcc -declare ulong %llvm.readcyclecounter() +declare i64 @llvm.readcyclecounter() -ulong %foo() { +define i64 @foo() { entry: -%tmp.1 = call ulong %llvm.readcyclecounter () -ret ulong %tmp.1 + %tmp.1 = call i64 @llvm.readcyclecounter( ) ; [#uses=1] + ret i64 %tmp.1 } - Modified: llvm/trunk/test/CodeGen/Alpha/srl_and.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/srl_and.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/srl_and.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/srl_and.ll Mon Feb 18 19:41:04 2008 @@ -1,10 +1,10 @@ ; Make sure this testcase codegens to the zapnot instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep zapnot +; RUN: llvm-as < %s | llc -march=alpha | grep zapnot -ulong %foo(ulong %y) { +define i64 @foo(i64 %y) { entry: - %tmp = shr ulong %y, ubyte 3 ; [#uses=1] - %tmp2 = and ulong %tmp, 8191 ; [#uses=1] - ret ulong %tmp2 + %tmp = lshr i64 %y, 3 ; [#uses=1] + %tmp2 = and i64 %tmp, 8191 ; [#uses=1] + ret i64 %tmp2 } Modified: llvm/trunk/test/CodeGen/Alpha/weak.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/weak.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/weak.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/weak.ll Mon Feb 18 19:41:04 2008 @@ -1,17 +1,16 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep .weak.*f -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep .weak.*h +; RUN: llvm-as < %s | llc -march=alpha | grep .weak.*f +; RUN: llvm-as < %s | llc -march=alpha | grep .weak.*h -implementation ; Functions: - -weak uint %f() { +define weak i32 @f() { entry: - unreachable + unreachable } -void %g() { +define void @g() { entry: - tail call void %h( ) + tail call void @h( ) ret void } -declare extern_weak void %h() +declare extern_weak void @h() + Modified: llvm/trunk/test/CodeGen/Alpha/zapnot2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/zapnot2.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/zapnot2.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/zapnot2.ll Mon Feb 18 19:41:04 2008 @@ -1,10 +1,9 @@ ; Make sure this testcase codegens to the zapnot instruction -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep zapnot +; RUN: llvm-as < %s | llc -march=alpha | grep zapnot -implementation ; Functions: - -long %bar(long %x) { +define i64 @bar(i64 %x) { entry: - %tmp.1 = and long %x, 16711935 ; [#uses=1] - ret long %tmp.1 + %tmp.1 = and i64 %x, 16711935 ; [#uses=1] + ret i64 %tmp.1 } + Modified: llvm/trunk/test/CodeGen/Alpha/zapnot3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/zapnot3.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/zapnot3.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/zapnot3.ll Mon Feb 18 19:41:04 2008 @@ -1,15 +1,15 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep zapnot +; RUN: llvm-as < %s | llc -march=alpha | grep zapnot ;demanded bits mess up this mask in a hard to fix way -;ulong %foo(ulong %y) { -; %tmp = and ulong %y, 65535 -; %tmp2 = shr ulong %tmp, ubyte 3 -; ret ulong %tmp2 +;define i64 @foo(i64 %y) { +; %tmp = and i64 %y, 65535 +; %tmp2 = shr i64 %tmp, i8 3 +; ret i64 %tmp2 ;} -ulong %foo2(ulong %y) { - %tmp = shr ulong %y, ubyte 3 ; [#uses=1] - %tmp2 = and ulong %tmp, 8191 ; [#uses=1] - ret ulong %tmp2 +define i64 @foo2(i64 %y) { + %tmp = lshr i64 %y, 3 ; [#uses=1] + %tmp2 = and i64 %tmp, 8191 ; [#uses=1] + ret i64 %tmp2 } Modified: llvm/trunk/test/CodeGen/Alpha/zapnot4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/zapnot4.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Alpha/zapnot4.ll (original) +++ llvm/trunk/test/CodeGen/Alpha/zapnot4.ll Mon Feb 18 19:41:04 2008 @@ -1,8 +1,7 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=alpha | grep zapnot +; RUN: llvm-as < %s | llc -march=alpha | grep zapnot -ulong %foo(ulong %y) { - %tmp = shl ulong %y, ubyte 3 ; [#uses=1] - %tmp2 = and ulong %tmp, 65535 ; [#uses=1] - ret ulong %tmp2 +define i64 @foo(i64 %y) { + %tmp = shl i64 %y, 3 ; [#uses=1] + %tmp2 = and i64 %tmp, 65535 ; [#uses=1] + ret i64 %tmp2 } - Modified: llvm/trunk/test/CodeGen/CBackend/2002-05-16-NameCollide.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-05-16-NameCollide.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-05-16-NameCollide.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-05-16-NameCollide.ll Mon Feb 18 19:41:04 2008 @@ -1,7 +1,8 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; Make sure that global variables do not collide if they have the same name, ; but different types. -%X = global int 5 -%X = global long 7 + at X = global i32 5 ; [#uses=0] + at X.upgrd.1 = global i64 7 ; [#uses=0] + Modified: llvm/trunk/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-05-21-MissingReturn.ll Mon Feb 18 19:41:04 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; This case was emitting code that looked like this: ; ... @@ -8,10 +8,13 @@ ; Which the Sun C compiler rejected, so now we are sure to put a return ; instruction in there if the basic block is otherwise empty. ; -void "test"() { - br label %BB1 -BB2: - br label %BB2 -BB1: - ret void +define void @test() { + br label %BB1 + +BB2: ; preds = %BB2 + br label %BB2 + +BB1: ; preds = %0 + ret void } + Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstPointerRef.ll Mon Feb 18 19:41:04 2008 @@ -1,7 +1,7 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; Test const pointer refs & forward references -%t3 = global int * %t1 ;; Forward reference -%t1 = global int 4 + at t3 = global i32* @t1 ; [#uses=0] + at t1 = global i32 4 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-19-ConstantExpr.ll Mon Feb 18 19:41:04 2008 @@ -1,9 +1,8 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c -global int* cast (float* %0 to int*) ;; Forward numeric reference -global float* %0 ;; Duplicate forward numeric reference +global i32* bitcast (float* @2 to i32*) ;; Forward numeric reference +global float* @2 ;; Duplicate forward numeric reference global float 0.0 -%array = constant [2 x int] [ int 12, int 52 ] -%arrayPtr = global int* getelementptr ([2 x int]* %array, long 0, long 0) ;; int* &%array[0][0] - + at array = constant [2 x i32] [ i32 12, i32 52 ] + at arrayPtr = global i32* getelementptr ([2 x i32]* @array, i64 0, i64 0) Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-19-DataPointer.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-19-DataPointer.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-19-DataPointer.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-19-DataPointer.ll Mon Feb 18 19:41:04 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c - -%sptr1 = global [11x sbyte]* %somestr ;; Forward ref to a constant -%somestr = constant [11x sbyte] c"hello world" +; RUN: llvm-as < %s | llc -march=c + at sptr1 = global [11 x i8]* @somestr ;; Forward ref to a constant + at somestr = constant [11 x i8] c"hello world" Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-19-FunctionPointer.ll Mon Feb 18 19:41:04 2008 @@ -1,5 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c -%fptr = global void() * %f ;; Forward ref method defn -declare void "f"() ;; External method + at fptr = global void ()* @f ;; Forward ref method defn +declare void @f() ;; External method Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-19-HardConstantExpr.ll Mon Feb 18 19:41:04 2008 @@ -1,5 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c -%array = constant [2 x int] [ int 12, int 52 ] ; <[2 x int]*> [#uses=1] -%arrayPtr = global int* getelementptr ([2 x int]* %array, long 0, long 0) ; [#uses=1] + at array = constant [2 x i32] [ i32 12, i32 52 ] ; <[2 x i32]*> [#uses=1] + at arrayPtr = global i32* getelementptr ([2 x i32]* @array, i64 0, i64 0) ; [#uses=0] Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-20-RecursiveTypes.ll Mon Feb 18 19:41:04 2008 @@ -1,4 +1,3 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c - -%MyIntList = uninitialized global { \2 *, int } +; RUN: llvm-as < %s | llc -march=c + at MyIntList = external global { \2*, i32 } Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-20-UnnamedArgument.ll Mon Feb 18 19:41:04 2008 @@ -1,11 +1,10 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; The C Writer bombs on this testcase because it tries the print the prototype ; for the test function, which tries to print the argument name. The function ; has not been incorporated into the slot calculator, so after it does the name ; lookup, it tries a slot calculator lookup, which fails. -int %test(int) { - ret int 0 +define i32 @test(i32) { + ret i32 0 } - Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-26-IndirectCallTest.ll Mon Feb 18 19:41:04 2008 @@ -1,16 +1,17 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; Indirect function call test... found by Joel & Brian ; -%taskArray = uninitialized global int* + at taskArray = external global i32* ; [#uses=1] -void %test(int %X) { - %Y = add int %X, -1 ; :1 [#uses=3] - %cast100 = cast int %Y to long ; [#uses=1] - %gep100 = getelementptr int** %taskArray, long %cast100 ; [#uses=1] - %fooPtr = load int** %gep100 ; [#uses=1] - %cast101 = cast int* %fooPtr to void (int)* ; [#uses=1] - call void %cast101( int 1000 ) - ret void +define void @test(i32 %X) { + %Y = add i32 %X, -1 ; [#uses=1] + %cast100 = sext i32 %Y to i64 ; [#uses=1] + %gep100 = getelementptr i32** @taskArray, i64 %cast100 ; [#uses=1] + %fooPtr = load i32** %gep100 ; [#uses=1] + %cast101 = bitcast i32* %fooPtr to void (i32)* ; [#uses=1] + call void %cast101( i32 1000 ) + ret void } + Modified: llvm/trunk/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-08-30-StructureOrderingTest.ll Mon Feb 18 19:41:04 2008 @@ -1,7 +1,8 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; This testcase fails because the C backend does not arrange to output the ; contents of a structure type before it outputs the structure type itself. -%Y = uninitialized global { {int } } -%X = uninitialized global { float } + at Y = external global { { i32 } } ; <{ { i32 } }*> [#uses=0] + at X = external global { float } ; <{ float }*> [#uses=0] + Modified: llvm/trunk/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-09-20-ArrayTypeFailure.ll Mon Feb 18 19:41:04 2008 @@ -1,10 +1,7 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c - - -implementation - -void %test() { - %X = alloca [4xint] - ret void +define void @test() { + %X = alloca [4 x i32] ; <[4 x i32]*> [#uses=0] + ret void } + Modified: llvm/trunk/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-09-20-VarArgPrototypes.ll Mon Feb 18 19:41:04 2008 @@ -1,6 +1,6 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c -declare void %foo(...) +declare void @foo(...) Modified: llvm/trunk/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-10-15-OpaqueTypeProblem.ll Mon Feb 18 19:41:04 2008 @@ -1,7 +1,6 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c - %MPI_Comm = type %struct.Comm* - %struct.Comm = type opaque -%thing = global %MPI_Comm* null ; <%MPI_Comm**> [#uses=0] +%MPI_Comm = type %struct.Comm* +%struct.Comm = type opaque + at thing = global %MPI_Comm* null ; <%MPI_Comm**> [#uses=0] -implementation ; Functions: Modified: llvm/trunk/test/CodeGen/CBackend/2002-10-16-External.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-10-16-External.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-10-16-External.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-10-16-External.ll Mon Feb 18 19:41:04 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c -%bob = external global int ; [#uses=2] + at bob = external global i32 ; [#uses=0] Modified: llvm/trunk/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-10-30-FunctionPointerAlloca.ll Mon Feb 18 19:41:04 2008 @@ -1,12 +1,10 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c + %BitField = type i32 + %tokenptr = type i32* - %BitField = type int - %tokenptr = type %BitField* - -implementation - -void %test() { - %pmf1 = alloca %tokenptr (%tokenptr, sbyte*)* - ret void +define void @test() { + %pmf1 = alloca %tokenptr (%tokenptr, i8*)* ; <%tokenptr (%tokenptr, i8*)**> [#uses=0] + ret void } + Modified: llvm/trunk/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2002-11-06-PrintEscaped.ll Mon Feb 18 19:41:04 2008 @@ -1,12 +1,11 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c -%testString = internal constant [18 x sbyte] c "Escaped newline\n\00" + at testString = internal constant [18 x i8] c"Escaped newline\5Cn\00" ; <[18 x i8]*> [#uses=1] -implementation +declare i32 @printf(i8*, ...) -declare int %printf(sbyte*, ...) - -int %main() { - call int (sbyte*, ...)* %printf( sbyte* getelementptr ([18 x sbyte]* %testString, long 0, long 0)) - ret int 0 +define i32 @main() { + call i32 (i8*, ...)* @printf( i8* getelementptr ([18 x i8]* @testString, i64 0, i64 0) ) ; :1 [#uses=0] + ret i32 0 } + Modified: llvm/trunk/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-05-12-IntegerSizeWarning.ll Mon Feb 18 19:41:04 2008 @@ -1,7 +1,8 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; Apparently this constant was unsigned in ISO C 90, but not in C 99. -int %foo() { - ret int -2147483648 +define i32 @foo() { + ret i32 -2147483648 } + Modified: llvm/trunk/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-05-13-VarArgFunction.ll Mon Feb 18 19:41:04 2008 @@ -1,10 +1,11 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; This testcase breaks the C backend, because gcc doesn't like (...) functions ; with no arguments at all. -void %test(long %Ptr) { - %P = cast long %Ptr to void(...) * - call void(...)* %P(long %Ptr) - ret void +define void @test(i64 %Ptr) { + %P = inttoptr i64 %Ptr to void (...)* ; [#uses=1] + call void (...)* %P( i64 %Ptr ) + ret void } + Modified: llvm/trunk/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-05-31-MissingStructName.ll Mon Feb 18 19:41:04 2008 @@ -1,6 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; The C backend was dying when there was no typename for a struct type! -declare int %test(int,{ [32 x int] }*) - +declare i32 @test(i32, { [32 x i32] }*) Modified: llvm/trunk/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-06-01-NullPointerType.ll Mon Feb 18 19:41:04 2008 @@ -1,9 +1,9 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c +%X = type { i32, float } -%X = type { int, float } - -void %test() { - getelementptr %X* null, long 0, uint 1 - ret void +define void @test() { + getelementptr %X* null, i64 0, i32 1 ; :1 [#uses=0] + ret void } + Modified: llvm/trunk/test/CodeGen/CBackend/2003-06-11-HexConstant.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-06-11-HexConstant.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-06-11-HexConstant.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-06-11-HexConstant.ll Mon Feb 18 19:41:04 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c ; Make sure hex constant does not continue into a valid hexadecimal letter/number -%version = global [3 x sbyte] c"\001\00" - + at version = global [3 x i8] c"\001\00" Modified: llvm/trunk/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll Mon Feb 18 19:41:04 2008 @@ -1,5 +1,3 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c - - -%version = global [3 x sbyte] c"1\00\00" +; RUN: llvm-as < %s | llc -march=c + at version = global [3 x i8] c"1\00\00" Modified: llvm/trunk/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-06-23-PromotedExprs.llx Mon Feb 18 19:41:04 2008 @@ -1,16 +1,17 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c > %t1.cbe.c +; RUN: llvm-as < %s | llc -march=c > %t1.cbe.c ; RUN: gcc -B/usr/bin/ %t1.cbe.c -o %t1.cbe ; RUN: ./%t1.cbe -bool %doTest(ubyte %x) { - %dec.0 = add ubyte %x, 255 - %tmp.1001 = trunc ubyte %dec.0 to bool - ret bool %tmp.1001 +define i1 @doTest(i8 %x) { + %dec.0 = add i8 %x, -1 ; [#uses=1] + %tmp.1001 = trunc i8 %dec.0 to i1 ; [#uses=1] + ret i1 %tmp.1001 } -int %main () { - %result = call bool %doTest(ubyte 1) - %p = cast bool %result to int - ret int %p +define i32 @main() { + %result = call i1 @doTest( i8 1 ) ; [#uses=1] + %p = zext i1 %result to i32 ; [#uses=1] + ret i32 %p } + Modified: llvm/trunk/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll?rev=47296&r1=47295&r2=47296&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll (original) +++ llvm/trunk/test/CodeGen/CBackend/2003-06-28-InvokeSupport.ll Mon Feb 18 19:41:04 2008 @@ -1,14 +1,17 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c +; RUN: llvm-as < %s | llc -march=c +declare i32 @callee(i32, i32) -declare int %callee(int, int) +define i32 @test(i32 %X) { +;