From atrick at apple.com Mon Aug 8 00:47:02 2011
From: atrick at apple.com (Andrew Trick)
Date: Sun, 07 Aug 2011 22:47:02 -0700
Subject: [llvm-commits] [llvm] r137013 - in /llvm/trunk:
lib/Analysis/ScalarEvolution.cpp lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/iv-fold.ll
In-Reply-To: <4E3DADAF.5060109@mxc.ca>
References: <20110806070037.4DEC02A6C12C@llvm.org> <4E3DADAF.5060109@mxc.ca>
Message-ID: <738FE80B-9C4B-4577-83F5-B7160E175D7A@apple.com>
On Aug 6, 2011, at 2:10 PM, Nick Lewycky wrote:
> Andrew Trick wrote:
>> Author: atrick
>> Date: Sat Aug 6 02:00:37 2011
>> New Revision: 137013
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=137013&view=rev
>> Log:
>> Made SCEV's UDiv expressions more canonical. When dividing a
>> recurrence, the initial values low bits can sometimes be ignored.
>>
>> To take advantage of this, added FoldIVUser to IndVarSimplify to fold
>> an IV operand into a udiv/lshr if the operator doesn't affect the
>> result.
>>
>> -indvars -disable-iv-rewrite now transforms
>>
>> i = phi i4
>> i1 = i0 + 1
>> idx = i1>> (2 or more)
>> i4 = i + 4
>>
>> into
>>
>> i = phi i4
>> idx = i0>> ...
>> i4 = i + 4
>
> Clever! Is this something that instcombine or something else would not have gotten anyways?
ValueTracking can match simple loop phis. That allows InstCombine to handle obvious cases. But InstCombine no longer runs immediately after loop opts, which can expose these redundancies. I think Chris would like loop opts to clean up after themselves. And I think it makes sense to apply induction variable simplification after any loop opt that effectively creates a new loop. I'll try to land a patch tomorrow that does it after partial unroll.
Also, more generally I think that optimizations that need to know about loop recurrence should make use of ScalarEvolution. Fix problems, make improvements in one place.
> Is there any hope of applying the same trick to sdivs?
SCEV only understands udiv. Though I'm not sure off hand why it couldn't be done.
Andy
>>
>> Added:
>> llvm/trunk/test/Transforms/IndVarSimplify/iv-fold.ll
>> Modified:
>> llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>> llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
>>
>> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=137013&r1=137012&r2=137013&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
>> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Aug 6 02:00:37 2011
>> @@ -2051,12 +2051,13 @@
>> ++MaxShiftAmt;
>> IntegerType *ExtTy =
>> IntegerType::get(getContext(), getTypeSizeInBits(Ty) + MaxShiftAmt);
>> - // {X,+,N}/C --> {X/C,+,N/C} if safe and N/C can be folded.
>> if (const SCEVAddRecExpr *AR = dyn_cast(LHS))
>> if (const SCEVConstant *Step =
>> - dyn_cast(AR->getStepRecurrence(*this)))
>> - if (!Step->getValue()->getValue()
>> - .urem(RHSC->getValue()->getValue())&&
>> + dyn_cast(AR->getStepRecurrence(*this))) {
>> + // {X,+,N}/C --> {X/C,+,N/C} if safe and N/C can be folded.
>> + const APInt&StepInt = Step->getValue()->getValue();
>> + const APInt&DivInt = RHSC->getValue()->getValue();
>> + if (!StepInt.urem(DivInt)&&
>> getZeroExtendExpr(AR, ExtTy) ==
>> getAddRecExpr(getZeroExtendExpr(AR->getStart(), ExtTy),
>> getZeroExtendExpr(Step, ExtTy),
>> @@ -2067,6 +2068,22 @@
>> return getAddRecExpr(Operands, AR->getLoop(),
>> SCEV::FlagNW);
>> }
>> + /// Get a canonical UDivExpr for a recurrence.
>> + /// {X,+,N}/C => {Y,+,N}/C where Y=X-(X%N). Safe when C%N=0.
>
> "//" not "///" so that this isn't a doxy-comment.
>
> Nick
>
>> + // We can currently only fold X%N if X is constant.
>> + const SCEVConstant *StartC = dyn_cast(AR->getStart());
>> + if (StartC&& !DivInt.urem(StepInt)&&
>> + getZeroExtendExpr(AR, ExtTy) ==
>> + getAddRecExpr(getZeroExtendExpr(AR->getStart(), ExtTy),
>> + getZeroExtendExpr(Step, ExtTy),
>> + AR->getLoop(), SCEV::FlagAnyWrap)) {
>> + const APInt&StartInt = StartC->getValue()->getValue();
>> + const APInt&StartRem = StartInt.urem(StepInt);
>> + if (StartRem != 0)
>> + LHS = getAddRecExpr(getConstant(StartInt - StartRem), Step,
>> + AR->getLoop(), SCEV::FlagNW);
>> + }
>> + }
>> // (A*B)/C --> A*(B/C) if safe and B/C can be folded.
>> if (const SCEVMulExpr *M = dyn_cast(LHS)) {
>> SmallVector Operands;
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=137013&r1=137012&r2=137013&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Sat Aug 6 02:00:37 2011
>> @@ -70,6 +70,7 @@
>> STATISTIC(NumReplaced , "Number of exit values replaced");
>> STATISTIC(NumLFTR , "Number of loop exit tests replaced");
>> STATISTIC(NumElimIdentity, "Number of IV identities eliminated");
>> +STATISTIC(NumElimOperand, "Number of IV operands folded into a use");
>> STATISTIC(NumElimExt , "Number of IV sign/zero extends eliminated");
>> STATISTIC(NumElimRem , "Number of IV remainder operations eliminated");
>> STATISTIC(NumElimCmp , "Number of IV comparisons eliminated");
>> @@ -142,6 +143,8 @@
>> Value *IVOperand,
>> bool IsSigned);
>>
>> + bool FoldIVUser(Instruction *UseInst, Instruction *IVOperand);
>> +
>> void SimplifyCongruentIVs(Loop *L);
>>
>> void RewriteIVExpressions(Loop *L, SCEVExpander&Rewriter);
>> @@ -1298,6 +1301,66 @@
>> return true;
>> }
>>
>> +/// FoldIVUser - Fold an IV operand into its use. This removes increments of an
>> +/// aligned IV when used by a instruction that ignores the low bits.
>> +bool IndVarSimplify::FoldIVUser(Instruction *UseInst, Instruction *IVOperand) {
>> + Value *IVSrc = 0;
>> + unsigned OperIdx = 0;
>> + const SCEV *FoldedExpr = 0;
>> + switch (UseInst->getOpcode()) {
>> + default:
>> + return false;
>> + case Instruction::UDiv:
>> + case Instruction::LShr:
>> + // We're only interested in the case where we know something about
>> + // the numerator and have a constant denominator.
>> + if (IVOperand != UseInst->getOperand(OperIdx) ||
>> + !isa(UseInst->getOperand(1)))
>> + return false;
>> +
>> + // Attempt to fold a binary operator with constant operand.
>> + // e.g. ((I + 1)>> 2) => I>> 2
>> + if (IVOperand->getNumOperands() != 2 ||
>> + !isa(IVOperand->getOperand(1)))
>> + return false;
>> +
>> + IVSrc = IVOperand->getOperand(0);
>> + // IVSrc must be the (SCEVable) IV, since the other operand is const.
>> + assert(SE->isSCEVable(IVSrc->getType())&& "Expect SCEVable IV operand");
>> +
>> + ConstantInt *D = cast(UseInst->getOperand(1));
>> + if (UseInst->getOpcode() == Instruction::LShr) {
>> + // Get a constant for the divisor. See createSCEV.
>> + uint32_t BitWidth = cast(UseInst->getType())->getBitWidth();
>> + if (D->getValue().uge(BitWidth))
>> + return false;
>> +
>> + D = ConstantInt::get(UseInst->getContext(),
>> + APInt(BitWidth, 1).shl(D->getZExtValue()));
>> + }
>> + FoldedExpr = SE->getUDivExpr(SE->getSCEV(IVSrc), SE->getSCEV(D));
>> + }
>> + // We have something that might fold it's operand. Compare SCEVs.
>> + if (!SE->isSCEVable(UseInst->getType()))
>> + return false;
>> +
>> + // Bypass the operand if SCEV can prove it has no effect.
>> + if (SE->getSCEV(UseInst) != FoldedExpr)
>> + return false;
>> +
>> + DEBUG(dbgs()<< "INDVARS: Eliminated IV operand: "<< *IVOperand
>> +<< " -> "<< *UseInst<< '\n');
>> +
>> + UseInst->setOperand(OperIdx, IVSrc);
>> + assert(SE->getSCEV(UseInst) == FoldedExpr&& "bad SCEV with folded oper");
>> +
>> + ++NumElimOperand;
>> + Changed = true;
>> + if (IVOperand->use_empty())
>> + DeadInsts.push_back(IVOperand);
>> + return true;
>> +}
>> +
>> /// pushIVUsers - Add all uses of Def to the current IV's worklist.
>> ///
>> static void pushIVUsers(
>> @@ -1394,6 +1457,8 @@
>> // Bypass back edges to avoid extra work.
>> if (UseOper.first == CurrIV) continue;
>>
>> + FoldIVUser(UseOper.first, UseOper.second);
>> +
>> if (EliminateIVUser(UseOper.first, UseOper.second)) {
>> pushIVUsers(UseOper.second, Simplified, SimpleIVUsers);
>> continue;
>>
>> Added: llvm/trunk/test/Transforms/IndVarSimplify/iv-fold.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/iv-fold.ll?rev=137013&view=auto
>> ==============================================================================
>> --- llvm/trunk/test/Transforms/IndVarSimplify/iv-fold.ll (added)
>> +++ llvm/trunk/test/Transforms/IndVarSimplify/iv-fold.ll Sat Aug 6 02:00:37 2011
>> @@ -0,0 +1,56 @@
>> +; RUN: opt< %s -indvars -disable-iv-rewrite -S | FileCheck %s
>> +
>> +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n:32:64"
>> +
>> +; Indvars should be able to fold IV increments into shr when low bits are zero.
>> +;
>> +; CHECK: @foldIncShr
>> +; CHECK: shr.1 = lshr i32 %0, 5
>> +define i32 @foldIncShr(i32* %bitmap, i32 %bit_addr, i32 %nbits) nounwind {
>> +entry:
>> + br label %while.body
>> +
>> +while.body:
>> + %0 = phi i32 [ 0, %entry ], [ %inc.2, %while.body ]
>> + %shr = lshr i32 %0, 5
>> + %arrayidx = getelementptr inbounds i32* %bitmap, i32 %shr
>> + %tmp6 = load i32* %arrayidx, align 4
>> + %inc.1 = add i32 %0, 1
>> + %shr.1 = lshr i32 %inc.1, 5
>> + %arrayidx.1 = getelementptr inbounds i32* %bitmap, i32 %shr.1
>> + %tmp6.1 = load i32* %arrayidx.1, align 4
>> + %inc.2 = add i32 %inc.1, 1
>> + %exitcond.3 = icmp eq i32 %inc.2, 128
>> + br i1 %exitcond.3, label %while.end, label %while.body
>> +
>> +while.end:
>> + %r = add i32 %tmp6, %tmp6.1
>> + ret i32 %r
>> +}
>> +
>> +; Invdars should not fold an increment into shr unless 2^shiftBits is
>> +; a multiple of the recurrence step.
>> +;
>> +; CHECK: @noFoldIncShr
>> +; CHECK: shr.1 = lshr i32 %inc.1, 5
>> +define i32 @noFoldIncShr(i32* %bitmap, i32 %bit_addr, i32 %nbits) nounwind {
>> +entry:
>> + br label %while.body
>> +
>> +while.body:
>> + %0 = phi i32 [ 0, %entry ], [ %inc.3, %while.body ]
>> + %shr = lshr i32 %0, 5
>> + %arrayidx = getelementptr inbounds i32* %bitmap, i32 %shr
>> + %tmp6 = load i32* %arrayidx, align 4
>> + %inc.1 = add i32 %0, 1
>> + %shr.1 = lshr i32 %inc.1, 5
>> + %arrayidx.1 = getelementptr inbounds i32* %bitmap, i32 %shr.1
>> + %tmp6.1 = load i32* %arrayidx.1, align 4
>> + %inc.3 = add i32 %inc.1, 2
>> + %exitcond.3 = icmp eq i32 %inc.3, 96
>> + br i1 %exitcond.3, label %while.end, label %while.body
>> +
>> +while.end:
>> + %r = add i32 %tmp6, %tmp6.1
>> + ret i32 %r
>> +}
>>
>>
>> _______________________________________________
>> 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 Aug 8 00:57:49 2011
From: clattner at apple.com (Chris Lattner)
Date: Sun, 07 Aug 2011 22:57:49 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To: <99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
Message-ID: <5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
On Aug 7, 2011, at 7:38 PM, Bill Wendling wrote:
> Ping?
Sorry for the delay. It looks like you haven't updated the patch to match LangRef to know that clauses can't have multiple values. This makes it very hard to usefully review the patch, but here are some thoughts that are independent of that:
+++ include/llvm/Instructions.h (working copy)
+class LandingPadInst : public Instruction {
+ /// IsCleanup - True if the landingpad instruction is also a cleanup.
+ bool IsCleanup;
This should be stored in "SubClassData" like the isVolatile bit on loads and stores are.
Please move the Create functions and constructors out of line.
LandingPadInst is overcomplicated (e.g. struct Index) by the grammar that you're implementing that isn't documented.
@@ -2617,6 +2736,10 @@
Op<-1>() = reinterpret_cast(B);
}
+ // getLandingPad - Get the landingpad instruction from the landing pad block
+ // (the unwind destination).
+ LandingPadInst *getLandingPad() const;
Please use /// comments so doxygen picks it up. Please rename this to getLandingPadInst
llvm::BasicBlock should probably get an "isLandingPad()" and getLandingPadInst() helper methods, which are isa<(getFirstNonPHI()) (and dyn_cast).
+++ include/llvm-c/Core.h (working copy)
+typedef enum {
+ LLVMCatch, /**< A catch clause */
+ LLVMFilter /**< A filter clause */
+} LLVMLandingPadClauseTy;
Like LLVMRealPredicate, you should mangle the enum name into the enumerators.
In Verifier:
@@ -1361,7 +1373,7 @@
Assert1(Ordering == Acquire || Ordering == Release ||
Ordering == AcquireRelease || Ordering == SequentiallyConsistent,
"fence instructions may only have "
- " acquire, release, acq_rel, or seq_cst ordering.", &FI);
+ "acquire, release, acq_rel, or seq_cst ordering.", &FI);
visitInstruction(FI);
}
Please commit this separately.
+ // The landingpad instruction must be the first non-PHI instruction in the
+ // block.
+ BasicBlock::iterator I = BB->begin(), E = BB->end();
+ while (I != E && isa(I))
+ ++I;
+ Assert1(I != E && isa(I) && I == LPI,
+ "LandingPadInst not the first non-PHI instruction in the block.",
+ &LPI);
Use "LPI->getParent()->getLandingPadInst() == &LPI)
Unrelated, but noticed while reviewing the patch, the grammar in LangRef.html is actually:
= landingpad personality +
= landingpad personality cleanup *
Please fix it.
Please resend with the grammar fix. I can't review most of this patch without that, and the ripples through the rest of the code, fixed.
Thanks Bill!
-Chris
From rjmccall at apple.com Mon Aug 8 01:34:40 2011
From: rjmccall at apple.com (John McCall)
Date: Sun, 07 Aug 2011 23:34:40 -0700
Subject: [llvm-commits] [llvm] r136790 - /llvm/trunk/docs/LangRef.html
In-Reply-To: <20110803171707.552712A6C12C@llvm.org>
References: <20110803171707.552712A6C12C@llvm.org>
Message-ID:
On Aug 3, 2011, at 10:17 AM, Bill Wendling wrote:
> Author: void
> Date: Wed Aug 3 12:17:06 2011
> New Revision: 136790
>
> URL: http://llvm.org/viewvc/llvm-project?rev=136790&view=rev
> Log:
> Explain how clauses are applied.
>
> Modified:
> llvm/trunk/docs/LangRef.html
>
> Modified: llvm/trunk/docs/LangRef.html
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=136790&r1=136789&r2=136790&view=diff
> ==============================================================================
> --- llvm/trunk/docs/LangRef.html (original)
> +++ llvm/trunk/docs/LangRef.html Wed Aug 3 12:17:06 2011
> @@ -6025,6 +6025,10 @@
> calling conventions, how the personality function results are represented in
> LLVM IR is target specific.
>
> +The clauses are applied in order from top to bottom. If two
> + landingpad instructions are merged together through inlining, the
> + clauses from the calling function are prepended to the list of clauses.
> +
Appended, surely.
John.
From rjmccall at apple.com Mon Aug 8 01:37:37 2011
From: rjmccall at apple.com (John McCall)
Date: Sun, 07 Aug 2011 23:37:37 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To: <5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
Message-ID:
On Aug 7, 2011, at 10:57 PM, Chris Lattner wrote:
> On Aug 7, 2011, at 7:38 PM, Bill Wendling wrote:
>
>> Ping?
>
> Sorry for the delay. It looks like you haven't updated the patch to match LangRef to know that clauses can't have multiple values.
Wait, I could've sworn I reviewed that. 'filter' has to take 0 to N values; there's really no way around it, because nesting is disjunctive and we need conjunction. The only way we can do it with exactly one value per clause is to require that value to be a ConstantArray ? although, come to think of it, that's doable, if ugly.
John.
From clattner at apple.com Mon Aug 8 01:58:10 2011
From: clattner at apple.com (Chris Lattner)
Date: Sun, 07 Aug 2011 23:58:10 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To:
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
Message-ID:
On Aug 7, 2011, at 11:37 PM, John McCall wrote:
> On Aug 7, 2011, at 10:57 PM, Chris Lattner wrote:
>> On Aug 7, 2011, at 7:38 PM, Bill Wendling wrote:
>>
>>> Ping?
>>
>> Sorry for the delay. It looks like you haven't updated the patch to match LangRef to know that clauses can't have multiple values.
>
> Wait, I could've sworn I reviewed that. 'filter' has to take 0 to N values; there's really no way around it, because nesting is disjunctive and we need conjunction. The only way we can do it with exactly one value per clause is to require that value to be a ConstantArray ? although, come to think of it, that's doable, if ugly.
You're saying that "filter a, b, c" is not the same as "filter a, filter b, filter c"?
-Chris
From rjmccall at apple.com Mon Aug 8 02:03:46 2011
From: rjmccall at apple.com (John McCall)
Date: Mon, 08 Aug 2011 00:03:46 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To:
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
Message-ID: <6FD46D53-5B96-4D3A-8BC0-A5C4EC8563B9@apple.com>
On Aug 7, 2011, at 11:58 PM, Chris Lattner wrote:
>
> On Aug 7, 2011, at 11:37 PM, John McCall wrote:
>
>> On Aug 7, 2011, at 10:57 PM, Chris Lattner wrote:
>>> On Aug 7, 2011, at 7:38 PM, Bill Wendling wrote:
>>>
>>>> Ping?
>>>
>>> Sorry for the delay. It looks like you haven't updated the patch to match LangRef to know that clauses can't have multiple values.
>>
>> Wait, I could've sworn I reviewed that. 'filter' has to take 0 to N values; there's really no way around it, because nesting is disjunctive and we need conjunction. The only way we can do it with exactly one value per clause is to require that value to be a ConstantArray ? although, come to think of it, that's doable, if ugly.
>
> You're saying that "filter a, b, c" is not the same as "filter a, filter b, filter c"?
Correct. The first filters out exceptions they aren't a and aren't b and aren't c, and the second trips on exceptions if they aren't a, or they aren't b, or they aren't c.
Combining filters is also impossible because of the semantics of std::unexpected, which is allowed to change the exception type to satisfy the filter.
John.
From isanbard at gmail.com Mon Aug 8 02:58:58 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 08 Aug 2011 07:58:58 -0000
Subject: [llvm-commits] [llvm] r137040 - /llvm/trunk/docs/LangRef.html
Message-ID: <20110808075859.418B72A6C12D@llvm.org>
Author: void
Date: Mon Aug 8 02:58:58 2011
New Revision: 137040
URL: http://llvm.org/viewvc/llvm-project?rev=137040&view=rev
Log:
Fix typo found by John.
Modified:
llvm/trunk/docs/LangRef.html
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=137040&r1=137039&r2=137040&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Aug 8 02:58:58 2011
@@ -6027,7 +6027,7 @@
The clauses are applied in order from top to bottom. If two
landingpad instructions are merged together through inlining, the
- clauses from the calling function are prepended to the list of clauses.
+ clauses from the calling function are appended to the list of clauses.
The landingpad instruction has several restrictions:
From wendling at apple.com Mon Aug 8 02:59:18 2011
From: wendling at apple.com (Bill Wendling)
Date: Mon, 08 Aug 2011 00:59:18 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To: <5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
Message-ID: <5964EA4C-F64F-4C8E-9124-2FEDAAAB43F1@apple.com>
On Aug 7, 2011, at 10:57 PM, Chris Lattner wrote:
>
> On Aug 7, 2011, at 7:38 PM, Bill Wendling wrote:
>
>> Ping?
>
> Sorry for the delay. It looks like you haven't updated the patch to match LangRef to know that clauses can't have multiple values. This makes it very hard to usefully review the patch, but here are some thoughts that are independent of that:
>
I did make those changes. As John pointed out, the 'filter' clause must allow for multiple filter types on one filter. The 'catch' clauses though should be single catch type only.
-bw
From isanbard at gmail.com Mon Aug 8 03:00:24 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 8 Aug 2011 01:00:24 -0700
Subject: [llvm-commits] [llvm] r136790 - /llvm/trunk/docs/LangRef.html
In-Reply-To:
References: <20110803171707.552712A6C12C@llvm.org>
Message-ID: <2F38450D-486B-4752-B581-3BA012E610F5@gmail.com>
Doh! Fixed.
-bw
On Aug 7, 2011, at 11:34 PM, John McCall wrote:
> On Aug 3, 2011, at 10:17 AM, Bill Wendling wrote:
>> Author: void
>> Date: Wed Aug 3 12:17:06 2011
>> New Revision: 136790
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=136790&view=rev
>> Log:
>> Explain how clauses are applied.
>>
>> Modified:
>> llvm/trunk/docs/LangRef.html
>>
>> Modified: llvm/trunk/docs/LangRef.html
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=136790&r1=136789&r2=136790&view=diff
>> ==============================================================================
>> --- llvm/trunk/docs/LangRef.html (original)
>> +++ llvm/trunk/docs/LangRef.html Wed Aug 3 12:17:06 2011
>> @@ -6025,6 +6025,10 @@
>> calling conventions, how the personality function results are represented in
>> LLVM IR is target specific.
>>
>> +The clauses are applied in order from top to bottom. If two
>> + landingpad instructions are merged together through inlining, the
>> + clauses from the calling function are prepended to the list of clauses.
>> +
>
> Appended, surely.
>
> John.
> _______________________________________________
> 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 Aug 8 03:02:48 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 08 Aug 2011 08:02:48 -0000
Subject: [llvm-commits] [llvm] r137041 - /llvm/trunk/lib/VMCore/Verifier.cpp
Message-ID: <20110808080248.A765D2A6C12D@llvm.org>
Author: void
Date: Mon Aug 8 03:02:48 2011
New Revision: 137041
URL: http://llvm.org/viewvc/llvm-project?rev=137041&view=rev
Log:
Remove unnecessary space.
Modified:
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=137041&r1=137040&r2=137041&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Mon Aug 8 03:02:48 2011
@@ -1361,7 +1361,7 @@
Assert1(Ordering == Acquire || Ordering == Release ||
Ordering == AcquireRelease || Ordering == SequentiallyConsistent,
"fence instructions may only have "
- " acquire, release, acq_rel, or seq_cst ordering.", &FI);
+ "acquire, release, acq_rel, or seq_cst ordering.", &FI);
visitInstruction(FI);
}
From isanbard at gmail.com Mon Aug 8 03:06:05 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 08 Aug 2011 08:06:05 -0000
Subject: [llvm-commits] [llvm] r137042 - /llvm/trunk/docs/LangRef.html
Message-ID: <20110808080605.C2B402A6C12D@llvm.org>
Author: void
Date: Mon Aug 8 03:06:05 2011
New Revision: 137042
URL: http://llvm.org/viewvc/llvm-project?rev=137042&view=rev
Log:
Clean up the grammar for the landingpad instruction.
Modified:
llvm/trunk/docs/LangRef.html
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=137042&r1=137041&r2=137042&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Aug 8 03:06:05 2011
@@ -5992,9 +5992,11 @@
Syntax:
- <resultval> = landingpad <somety> personality <type> <pers_fn> cleanup? <clause>+
+ <resultval> = landingpad <somety> personality <type> <pers_fn> <clause>+
+ <resultval> = landingpad <somety> personality <type> <pers_fn> cleanup <clause>*
+
<clause> := catch <type> <value>
- <clause> := filter <type> <value>
+ <clause> := filter <type> <value> {, <type> <value>}*
Overview:
From wendling at apple.com Mon Aug 8 03:13:03 2011
From: wendling at apple.com (Bill Wendling)
Date: Mon, 08 Aug 2011 01:13:03 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To: <6FD46D53-5B96-4D3A-8BC0-A5C4EC8563B9@apple.com>
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
<6FD46D53-5B96-4D3A-8BC0-A5C4EC8563B9@apple.com>
Message-ID: <4C521554-B45D-41FC-8A22-6A1EAFDC36C2@apple.com>
On Aug 8, 2011, at 12:03 AM, John McCall wrote:
> Correct. The first filters out exceptions they aren't a and aren't b and aren't c, and the second trips on exceptions if they aren't a, or they aren't b, or they aren't c.
>
> Combining filters is also impossible because of the semantics of std::unexpected, which is allowed to change the exception type to satisfy the filter.
>
Why does this prohibit combining filters? Or, I guess more to the point, what do you mean by combining the filters? Are you suggesting that we cannot inline a function with an exception specification into another function with a different exception specification?
-bw
From rjmccall at apple.com Mon Aug 8 03:25:53 2011
From: rjmccall at apple.com (John McCall)
Date: Mon, 08 Aug 2011 01:25:53 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To: <4C521554-B45D-41FC-8A22-6A1EAFDC36C2@apple.com>
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
<6FD46D53-5B96-4D3A-8BC0-A5C4EC8563B9@apple.com>
<4C521554-B45D-41FC-8A22-6A1EAFDC36C2@apple.com>
Message-ID: <7B4D9FCE-0960-4F0A-8513-8C71F567CC10@apple.com>
On Aug 8, 2011, at 1:13 AM, Bill Wendling wrote:
> On Aug 8, 2011, at 12:03 AM, John McCall wrote:
>> Correct. The first filters out exceptions they aren't a and aren't b and aren't c, and the second trips on exceptions if they aren't a, or they aren't b, or they aren't c.
>>
>> Combining filters is also impossible because of the semantics of std::unexpected, which is allowed to change the exception type to satisfy the filter.
>>
> Why does this prohibit combining filters? Or, I guess more to the point, what do you mean by combining the filters? Are you suggesting that we cannot inline a function with an exception specification into another function with a different exception specification?
No, that's not what I meant. What I mean is that, conceptually, filters always apply in the order that an exception would propagate through them, and there's a fallback mechanism for changing exception types, so while there are rules you can use to optimize filters, they're somewhat complex.
Basically, it is legal to turn this:
filter a, b
filter a, b
into this:
filter a, b
And it is legal to turn this:
filter a
filter a, b
into this:
filter a
But it is not legal to turn this:
filter a, b
filter a
into this:
filter a
Fortunately, you can just ignore all that for now. :) Just make sure that the representation is somehow capable of listing any number of exception types per filter, including zero.
John.
From rjmccall at apple.com Mon Aug 8 03:34:23 2011
From: rjmccall at apple.com (John McCall)
Date: Mon, 08 Aug 2011 01:34:23 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To: <6FD46D53-5B96-4D3A-8BC0-A5C4EC8563B9@apple.com>
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
<6FD46D53-5B96-4D3A-8BC0-A5C4EC8563B9@apple.com>
Message-ID:
On Aug 8, 2011, at 12:03 AM, John McCall wrote:
>
> On Aug 7, 2011, at 11:58 PM, Chris Lattner wrote:
>
>>
>> On Aug 7, 2011, at 11:37 PM, John McCall wrote:
>>
>>> On Aug 7, 2011, at 10:57 PM, Chris Lattner wrote:
>>>> On Aug 7, 2011, at 7:38 PM, Bill Wendling wrote:
>>>>
>>>>> Ping?
>>>>
>>>> Sorry for the delay. It looks like you haven't updated the patch to match LangRef to know that clauses can't have multiple values.
>>>
>>> Wait, I could've sworn I reviewed that. 'filter' has to take 0 to N values; there's really no way around it, because nesting is disjunctive and we need conjunction. The only way we can do it with exactly one value per clause is to require that value to be a ConstantArray ? although, come to think of it, that's doable, if ugly.
>>
>> You're saying that "filter a, b, c" is not the same as "filter a, filter b, filter c"?
>
> Correct. The first filters out exceptions they aren't a and aren't b and aren't c, and the second trips on exceptions if they aren't a, or they aren't b, or they aren't c.
Sorry, grammar fail.
An exception specificaiton which lists three types will result in a call to std::unexpected() if an exception is thrown which cannot be caught by any of those types. Three nested exception specifications listing one type each will result in a call to std::unexpected() if an exception is thrown which cannot be caught by each of those types individually. Additionally, std::unexpected() can substitute a new exception as long as it passes the tripped exception specification, so the semantics do require individually processing exception specifications unless the outer spec is at least as "forgiving" as the inner spec.
John.
From raghesh.a at gmail.com Mon Aug 8 03:34:16 2011
From: raghesh.a at gmail.com (Raghesh Aloor)
Date: Mon, 08 Aug 2011 08:34:16 -0000
Subject: [llvm-commits] [polly] r137043 - /polly/trunk/lib/CodeGeneration.cpp
Message-ID: <20110808083416.36FE42A6C12C@llvm.org>
Author: raghesh
Date: Mon Aug 8 03:34:16 2011
New Revision: 137043
URL: http://llvm.org/viewvc/llvm-project?rev=137043&view=rev
Log:
Memaccess: Some style changes
Modified:
polly/trunk/lib/CodeGeneration.cpp
Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=137043&r1=137042&r2=137043&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Mon Aug 8 03:34:16 2011
@@ -174,32 +174,32 @@
return Builder.CreateShuffleVector(vector, vector, splatVector);
}
- Value* getOperand(const Value *OldOperand, ValueMapT &BBMap,
+ Value* getOperand(const Value *oldOperand, ValueMapT &BBMap,
ValueMapT *VectorMap = 0) {
- const Instruction *OpInst = dyn_cast(OldOperand);
+ const Instruction *OpInst = dyn_cast(oldOperand);
if (!OpInst)
- return const_cast(OldOperand);
+ return const_cast(oldOperand);
- if (VectorMap && VectorMap->count(OldOperand))
- return (*VectorMap)[OldOperand];
+ if (VectorMap && VectorMap->count(oldOperand))
+ return (*VectorMap)[oldOperand];
// IVS and Parameters.
- if (VMap.count(OldOperand)) {
- Value *NewOperand = VMap[OldOperand];
+ if (VMap.count(oldOperand)) {
+ Value *NewOperand = VMap[oldOperand];
// Insert a cast if types are different
- if (OldOperand->getType()->getScalarSizeInBits()
+ if (oldOperand->getType()->getScalarSizeInBits()
< NewOperand->getType()->getScalarSizeInBits())
NewOperand = Builder.CreateTruncOrBitCast(NewOperand,
- OldOperand->getType());
+ oldOperand->getType());
return NewOperand;
}
// Instructions calculated in the current BB.
- if (BBMap.count(OldOperand)) {
- return BBMap[OldOperand];
+ if (BBMap.count(oldOperand)) {
+ return BBMap[oldOperand];
}
// Ignore instructions that are referencing ops in the old BB. These
@@ -208,7 +208,7 @@
if (getRegion().contains(OpInst->getParent()))
return NULL;
- return const_cast(OldOperand);
+ return const_cast(oldOperand);
}
Type *getVectorPtrTy(const Value *V, int vectorWidth) {
@@ -317,7 +317,7 @@
/// @brief Get the new operand address according to the changed access in
/// JSCOP file.
Value *getNewAccessOperand(isl_map *newAccessRelation, Value *baseAddr,
- const Value *OldOperand, ValueMapT &BBMap) {
+ const Value *oldOperand, ValueMapT &BBMap) {
unsigned accessIdx = 0;
Value *newOperand = Builder.CreateStructGEP(baseAddr,
accessIdx, "p_newarrayidx_");
@@ -327,14 +327,14 @@
/// @brief Generate the operand address
Value *generateLocationAccessed(const Instruction *Inst,
const Value *pointer, ValueMapT &BBMap ) {
- MemoryAccess &Access = statement.getAccessFor(Inst);
- isl_map *newAccessRelation = Access.getNewAccessFunction();
+ MemoryAccess &access = statement.getAccessFor(Inst);
+ isl_map *newAccessRelation = access.getNewAccessFunction();
if (!newAccessRelation) {
Value *newPointer = getOperand(pointer, BBMap);
return newPointer;
}
- Value *baseAddr = const_cast(Access.getBaseAddr());
+ Value *baseAddr = const_cast(access.getBaseAddr());
Value *newPointer = getNewAccessOperand(newAccessRelation, baseAddr,
pointer, BBMap);
return newPointer;
From baldrick at free.fr Mon Aug 8 03:44:48 2011
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 08 Aug 2011 08:44:48 -0000
Subject: [llvm-commits] [dragonegg] r137044 -
/dragonegg/trunk/src/Backend.cpp
Message-ID: <20110808084448.88CEA2A6C12C@llvm.org>
Author: baldrick
Date: Mon Aug 8 03:44:48 2011
New Revision: 137044
URL: http://llvm.org/viewvc/llvm-project?rev=137044&view=rev
Log:
Output file-scope assembler at the same time as global variables and
aliases. At this point the only remaining abuse of the LTO passes is
for outputting same-body aliases.
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=137044&r1=137043&r2=137044&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Mon Aug 8 03:44:48 2011
@@ -1539,17 +1539,6 @@
TREE_ASM_WRITTEN(alias->decl) = 1;
}
-/// emit_file_scope_asm - Emit the specified string as a file-scope inline
-/// asm block.
-static void emit_file_scope_asm(tree string) {
- if (errorcount || sorrycount)
- return; // Do not process broken code.
-
- if (TREE_CODE(string) == ADDR_EXPR)
- string = TREE_OPERAND(string, 0);
- TheModule->appendModuleInlineAsm(TREE_STRING_POINTER (string));
-}
-
/// emit_aliases - Convert same-body aliases and file-scope asm into LLVM IR.
static void emit_aliases(cgraph_node_set set
#if (GCC_MINOR > 5)
@@ -1577,13 +1566,6 @@
emit_same_body_alias(alias, node);
}
}
-
- // Emit any file-scope asms.
- for (struct cgraph_asm_node *can = cgraph_asm_nodes; can; can = can->next)
- emit_file_scope_asm(can->asm_str);
-
- // Remove the asms so gcc doesn't waste time outputting them.
- cgraph_asm_nodes = NULL;
}
/// pass_emit_aliases - IPA pass that converts same-body aliases and file-scope
@@ -1659,13 +1641,24 @@
};
-/// llvm_emit_globals - Output GCC global variables and aliases to the LLVM IR.
+/// llvm_emit_globals - Output GCC global variables, aliases and asm's to the
+/// LLVM IR.
static void llvm_emit_globals(void * /*gcc_data*/, void * /*user_data*/) {
if (errorcount || sorrycount)
return; // Do not process broken code.
InitializeBackend();
+ // Emit any file-scope asms.
+ for (struct cgraph_asm_node *can = cgraph_asm_nodes; can; can = can->next) {
+ tree string = can->asm_str;
+ if (TREE_CODE(string) == ADDR_EXPR)
+ string = TREE_OPERAND(string, 0);
+ TheModule->appendModuleInlineAsm(TREE_STRING_POINTER (string));
+ }
+ // Remove the asms so gcc doesn't waste time outputting them.
+ cgraph_asm_nodes = NULL;
+
// Output all externally visible global variables as well as any internal
// variables explicitly marked with the 'used' attribute. Other internal
// variables and aliases are output when their user is, or discarded if
@@ -2215,7 +2208,7 @@
register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
#endif
- // Output GCC global variables and aliases to the LLVM IR. This needs to be
+ // Output GCC global variables, aliases and asm's to the IR. This needs to be
// done before the compilation unit is finished, since aliases are no longer
// available then. On the other hand it seems wise to output them after the
// IPA passes have run, since these are the passes that modify globals.
From wendling at apple.com Mon Aug 8 03:52:27 2011
From: wendling at apple.com (Bill Wendling)
Date: Mon, 08 Aug 2011 01:52:27 -0700
Subject: [llvm-commits] [PATCH] Newest LandingPad Patch
In-Reply-To: <7B4D9FCE-0960-4F0A-8513-8C71F567CC10@apple.com>
References:
<99EBDC10-2197-4007-9850-4E2E65720C59@apple.com>
<5358F1C8-7FD5-420C-AFF6-C0EC2811060D@apple.com>
<6FD46D53-5B96-4D3A-8BC0-A5C4EC8563B9@apple.com>
<4C521554-B45D-41FC-8A22-6A1EAFDC36C2@apple.com>
<7B4D9FCE-0960-4F0A-8513-8C71F567CC10@apple.com>
Message-ID:
On Aug 8, 2011, at 1:25 AM, John McCall wrote:
> On Aug 8, 2011, at 1:13 AM, Bill Wendling wrote:
>> On Aug 8, 2011, at 12:03 AM, John McCall wrote:
>>> Correct. The first filters out exceptions they aren't a and aren't b and aren't c, and the second trips on exceptions if they aren't a, or they aren't b, or they aren't c.
>>>
>>> Combining filters is also impossible because of the semantics of std::unexpected, which is allowed to change the exception type to satisfy the filter.
>>>
>> Why does this prohibit combining filters? Or, I guess more to the point, what do you mean by combining the filters? Are you suggesting that we cannot inline a function with an exception specification into another function with a different exception specification?
>
> No, that's not what I meant. What I mean is that, conceptually, filters always apply in the order that an exception would propagate through them, and there's a fallback mechanism for changing exception types, so while there are rules you can use to optimize filters, they're somewhat complex.
>
> Basically, it is legal to turn this:
> filter a, b
> filter a, b
> into this:
> filter a, b
>
> And it is legal to turn this:
> filter a
> filter a, b
> into this:
> filter a
>
> But it is not legal to turn this:
> filter a, b
> filter a
> into this:
> filter a
>
> Fortunately, you can just ignore all that for now. :) Just make sure that the representation is somehow capable of listing any number of exception types per filter, including zero.
>
Okay, grand! Thanks for the clarification. I was hoping it wasn't what I wrote, because that would be brutal. :-)
-bw
From baldrick at free.fr Mon Aug 8 04:46:21 2011
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 08 Aug 2011 11:46:21 +0200
Subject: [llvm-commits] Newest LandingPad Patch
In-Reply-To: <1D33093C-44C0-43BE-B5CD-9CF8F0907484@apple.com>
References: <1D33093C-44C0-43BE-B5CD-9CF8F0907484@apple.com>
Message-ID: <4E3FB06D.6080405@free.fr>
Hi Bill,
> + /// getPersonalityFn - Get the personality function associated with this
> + /// landing pad.
> + const Function *getPersonalityFn() const {
> + return cast(getOperand(0));
> + }
I think you should change this to
return cast(getOperand(0)->stripPointerCasts());
That's because you can't avoid sometimes getting a bitcast here. For example,
suppose you have two modules that both declare __gxx_personality_v0 and use it
in a landingpad instruction, but they use a slightly different prototype for
__gxx_personality_v0. When you link the bitcode from the two modules together,
the prototype difference will be resolved by replacing one __gxx_personality_v0
with a bitcast of the other. This results in landingpad instructions with a
bitcast of a function for the personality function operand, and then... boom!
Likewise, you can't assume that typeinfos are global variables, you have to
allow for the possibility that they are bitcasts of global variables. I didn't
notice any place that assumes they are global variables, so hopefully everything
is OK for them.
> --- lib/VMCore/AsmWriter.cpp (revision 136744)
> +++ lib/VMCore/AsmWriter.cpp (working copy)
> @@ -1735,6 +1735,31 @@
> writeOperand(I.getOperand(1), true);
> for (const unsigned *i = IVI->idx_begin(), *e = IVI->idx_end(); i != e; ++i)
> Out << ", " << *i;
> + } else if (const LandingPadInst *LPI = dyn_cast(&I)) {
> + Out << ' ';
> + TypePrinter.print(I.getType(), Out);
> + Out << " personality ";
> + writeOperand(LPI->getPersonalityFn(), true); Out << '\n';
If the personality operand was a bitcast then here you would fail to output the
bitcast. You should probably just write out operand 0.
> @@ -3513,6 +3514,57 @@
> return AteExtraComma ? InstExtraComma : InstNormal;
> }
>
> +/// ParseLandingPad
> +/// ::= 'landingpad' Type 'personality' TypeAndValue 'cleanup'? Clause+
> +/// Clause
> +/// ::= 'catch' TypeAndValue
> +/// ::= 'filter' TypeAndValue*
> +bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
> + Type *Ty = 0; LocTy TyLoc;
> + Value *PersFn; LocTy PersFnLoc;
> + LocTy LPLoc = Lex.getLoc();
> +
> + if (ParseType(Ty, TyLoc) ||
> + ParseToken(lltok::kw_personality, "expected 'personality'") ||
> + ParseTypeAndValue(PersFn, PersFnLoc, PFS))
> + return true;
> +
> + LandingPadInst *LP = LandingPadInst::Create(Ty, cast(PersFn), 0);
Here you will blow up if the personality function is a bitcast. Also, you
should probably write the parsing in such a way as to output a helpful message
rather than crashing (as cast would) if someone provides invalid
input.
> + LP->setCleanup(EatIfPresent(lltok::kw_cleanup));
> +
> + while (Lex.getKind() == lltok::kw_catch || Lex.getKind() == lltok::kw_filter){
> + if (Lex.getKind() == lltok::kw_catch) {
> + ParseToken(lltok::kw_catch, "expected 'catch'");
> +
> + Value *V; LocTy VLoc;
> + if (ParseTypeAndValue(V, VLoc, PFS)) {
> + delete LP;
> + return true;
> + }
> + LP->addClause(LandingPadInst::Catch, cast(V));
This should probably output an error rather than crashing if V is not a
constant.
> + } else {
> + ParseToken(lltok::kw_filter, "expected 'filter'");
> + SmallVector Filters;
> +
> + if (Lex.getKind() == lltok::Type) {
> + do {
> + Value *V; LocTy VLoc;
> + if (ParseTypeAndValue(V, VLoc, PFS)) {
> + delete LP;
> + return true;
> + }
> + Filters.push_back(cast(V));
This should probably output an error rather than crashing if V is not a
constant.
> --- lib/Bitcode/Reader/BitcodeReader.cpp (revision 136744)
> +++ lib/Bitcode/Reader/BitcodeReader.cpp (working copy)
> @@ -2543,6 +2543,45 @@
> break;
> }
>
> + case bitc::FUNC_CODE_INST_LANDINGPAD: {
> + // LANDINGPAD: [ty, val, val, num, (id0,val0 ...)?]
> + unsigned Idx = 0;
> + if (Record.size() < 4)
> + return Error("Invalid LANDINGPAD record");
> + Type *Ty = getTypeByID(Record[Idx++]);
> + if (!Ty) return Error("Invalid LANDINGPAD record");
> + Value *PersFn = 0;
> + if (getValueTypePair(Record, Idx, NextValueNo, PersFn))
> + return Error("Invalid LANDINGPAD record");
> +
> + bool IsCleanup = !!Record[Idx++];
> + unsigned NumClauses = Record[Idx++];
> + LandingPadInst *LP = LandingPadInst::Create(Ty, cast(PersFn),
Kaboom if a bitcast of a function rather than a function. Here too you should
probably try to output a message rather than crashing if you get some strange
input.
> Index: lib/Bitcode/Writer/BitcodeWriter.cpp
> ===================================================================
> --- lib/Bitcode/Writer/BitcodeWriter.cpp (revision 136744)
> +++ lib/Bitcode/Writer/BitcodeWriter.cpp (working copy)
> @@ -1166,6 +1166,26 @@
> break;
> }
>
> + case Instruction::LandingPad: {
> + const LandingPadInst &LP = cast(I);
> + Code = bitc::FUNC_CODE_INST_LANDINGPAD;
> + Vals.push_back(VE.getTypeID(LP.getType()));
> + PushValueAndType(LP.getPersonalityFn(), InstID, Vals, VE);
This would drop any bitcast on the personality function.
Ciao, Duncan.
From renato.golin at arm.com Mon Aug 8 04:58:24 2011
From: renato.golin at arm.com (Renato Golin)
Date: Mon, 8 Aug 2011 10:58:24 +0100
Subject: [llvm-commits] [PATCH] ULEB FIXME in ARM back-end
In-Reply-To:
References:
Message-ID:
Ping?
On 1 August 2011 13:20, Renato Golin wrote:
> Hi all,
>
> I've been playing with a FIXME in the ARM back-end (to get more
> acquainted) and one simple FIXME was an ULEB printing in the
> AsmPrinter.
>
> According to the ARM EABI, both build attribute tag and value are
> ULEBs and not chars as they were being emitted. Today, I don't know of
> any attribute that would emit tags or values bigger than 127 but this
> seamed like an easy start.
>
> The patch changes the emission of values to ULEB by storing all tags
> and values in a typed list and emit later the right value, computing
> the size as it goes. I've run all tests (including the build
> attributes ones in ARM be) and it passes everything.
>
> There are three problems I see with this patch, but would like to know
> from you what's the best way to solve them:
>
> ?1. It uses a local structure to hold both ULEB and String values in
> order, but other MC structures will also emit ULEB in the near future
> (we should make sure it does, at least), so this structure could
> become a proper small class on a more visible place.
>
> ?2. It wastes memory since both number and string values are on every
> item, but it's not possible to put StringRef in an union since
> Stringref has non-trivial constructors. A solution is to use
> polymorphism but that's too big for this tiny case. If we decide to
> expose the class higher up, then it makes sense to do so.
>
> ?3. It's calculating the ULEB size in place, where other routines in
> LLVM can do that (but are not accessible from this class). A
> refactoring is in need to expose that routine to the intended
> audience.
>
> If neither of those problems are relevant, or if they're just minor,
> we can put other FIXMEs around. Otherwise, I'm open to suggestions.
>
> best,
> --renato
>
--
cheers,
--renato
From baldrick at free.fr Mon Aug 8 07:23:30 2011
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 08 Aug 2011 12:23:30 -0000
Subject: [llvm-commits] [dragonegg] r137045 - in /dragonegg/trunk:
include/dragonegg/cache.h src/Types.cpp src/cache.c
Message-ID: <20110808122330.0D75F2A6C12C@llvm.org>
Author: baldrick
Date: Mon Aug 8 07:23:29 2011
New Revision: 137045
URL: http://llvm.org/viewvc/llvm-project?rev=137045&view=rev
Log:
Remove llvm_has_cached since it has no advantages over checking
if llvm_get_cached returns a non-null value.
Modified:
dragonegg/trunk/include/dragonegg/cache.h
dragonegg/trunk/src/Types.cpp
dragonegg/trunk/src/cache.c
Modified: dragonegg/trunk/include/dragonegg/cache.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/cache.h?rev=137045&r1=137044&r2=137045&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/cache.h (original)
+++ dragonegg/trunk/include/dragonegg/cache.h Mon Aug 8 07:23:29 2011
@@ -28,10 +28,6 @@
union tree_node;
-/* llvm_has_cached - Returns whether a value has been associated with the
- tree. */
-extern int llvm_has_cached(union tree_node *tree);
-
/* llvm_get_cached - Returns the value associated with the tree, or NULL. */
extern const void *llvm_get_cached(union tree_node *tree);
Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=137045&r1=137044&r2=137045&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Mon Aug 8 07:23:29 2011
@@ -338,8 +338,7 @@
}
static bool llvm_has_type(tree Tr) {
- assert(TYPE_P(Tr) && "Expected a gcc type!");
- return llvm_has_cached(Tr);
+ return llvm_get_type(Tr) != 0;
}
Modified: dragonegg/trunk/src/cache.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/cache.c?rev=137045&r1=137044&r2=137045&view=diff
==============================================================================
--- dragonegg/trunk/src/cache.c (original)
+++ dragonegg/trunk/src/cache.c Mon Aug 8 07:23:29 2011
@@ -55,18 +55,6 @@
#include "dragonegg/gt-cache-4.5.h"
#endif
-/* llvm_has_cached - Returns whether a value has been associated with the
- tree. */
-int llvm_has_cached(union tree_node *tree) {
- struct tree_map_base in;
-
- if (!llvm_cache)
- return false;
-
- in.from = tree;
- return htab_find(llvm_cache, &in) != NULL;
-}
-
/* llvm_get_cached - Returns the value associated with the tree, or NULL. */
const void *llvm_get_cached(union tree_node *tree) {
struct tree_llvm_map *h;
From baldrick at free.fr Mon Aug 8 10:15:14 2011
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 08 Aug 2011 17:15:14 +0200
Subject: [llvm-commits] [Patch] DwarfEHPrepare for New EH
In-Reply-To:
References:
Message-ID: <4E3FFD82.8090701@free.fr>
Hi Bill,
> This patch implements the small amount which needs to be done by the DwarfEHPrepare pass. What it does is takes the 'resume' instruction and converts it into a call to _Unwind_Resume. The SjLj changes will be done in the SjLj lowering pass.
why do this in DwarfEHPrepare (which should be zapped in the long run I guess)?
Shouldn't it be lowered in SelectionDAGBuilder like other instructions are?
Also, it should probably be turned into a RESUME SDag Node, so that different
targets can be different things with it (eg: ARM doesn't want _Unwind_Resume
IIRC).
Ciao, Duncan.
From rafael.espindola at gmail.com Mon Aug 8 10:18:20 2011
From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=)
Date: Mon, 08 Aug 2011 11:18:20 -0400
Subject: [llvm-commits] [llvm] r136954 -
/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
In-Reply-To: <20110805005303.677762A6C12C@llvm.org>
References: <20110805005303.677762A6C12C@llvm.org>
Message-ID: <4E3FFE3C.3090704@gmail.com>
On 08/04/2011 08:53 PM, Jason W Kim wrote:
> Author: jasonwkim
> Date: Thu Aug 4 19:53:03 2011
> New Revision: 136954
>
> URL: http://llvm.org/viewvc/llvm-project?rev=136954&view=rev
> Log:
> Fix http://llvm.org/bugs/show_bug.cgi?id=10583\n - test for 1 and 2 byte fixups to be added
Thanks
> Modified:
> llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
>
> Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp?rev=136954&r1=136953&r2=136954&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp (original)
> +++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Thu Aug 4 19:53:03 2011
> @@ -94,21 +94,17 @@
> assert(Fixup.getOffset() + Size<= DataSize&&
> "Invalid fixup offset!");
>
> - // Check that the upper bits are either all 0 or all 1's
> - switch (Size) {
> - case 1:
> - assert((isInt<8>(Value) || isUInt<8>(Value))&&
> - "Value does not fit in a 1Byte Reloc");
> - break;
> - case 2:
> - assert((isInt<16>(Value) || isUInt<16>(Value))&&
> - "Value does not fit in a 2Byte Reloc");
> - break;
> - case 4:
> - assert((isInt<32>(Value) || isUInt<32>(Value))&&
> - "Value does not fit in a 4Byte Reloc");
> - break;
> - }
> + // Check that uppper bits are either all zeros or all ones.
> + // Specifically ignore overflow/underflow as long as the leakage is
> + // limited to the lower bits. This is to remain compatible with
> + // other assemblers.
> +
> + const uint64_t Mask = ~0ULL;
> + const uint64_t UpperV = (Value>> (Size * 8));
> + const uint64_t MaskF = (Mask>> (Size * 8));
> + assert(((Size == 8) ||
> + ((UpperV& MaskF) == 0ULL) || ((UpperV& MaskF) == MaskF))&&
> + "Value does not fit in the Fixup field");
>
> for (unsigned i = 0; i != Size; ++i)
> Data[Fixup.getOffset() + i] = uint8_t(Value>> (i * 8));
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From Micah.Villmow at amd.com Mon Aug 8 10:24:55 2011
From: Micah.Villmow at amd.com (Villmow, Micah)
Date: Mon, 8 Aug 2011 10:24:55 -0500
Subject: [llvm-commits] [PATCH] Add Pattern ID Information
In-Reply-To: <99124877-9AFB-42A0-8F86-60133AA0B9B7@apple.com>
References: <0ea0e9376fbd37e5bfe8e726cd8e1820a2f951aa.1312408044.git.dag@cray.com>
<89B29A49-519B-4B8D-A816-50793D3D2A5A@apple.com>
<87oc05pae6.fsf@smith.obbligato.org>
<89232ADE-1739-4151-9FA6-E3D7D8BC934F@2pi.dk>
<871ux0puhr.fsf@smith.obbligato.org>
<98EC6EBC-F059-4975-A12F-9BB5DCFB41EC@2pi.dk>
<0A430C75-4EB9-41EC-9BA2-EC70BE7A1B60@2pi.dk>
<99124877-9AFB-42A0-8F86-60133AA0B9B7@apple.com>
Message-ID:
> -----Original Message-----
> From: Chris Lattner [mailto:clattner at apple.com]
> Sent: Friday, August 05, 2011 5:30 PM
> To: Jakob Stoklund Olesen
> Cc: Villmow, Micah; Commit Messages and Patches for LLVM
> Subject: Re: [llvm-commits] [PATCH] Add Pattern ID Information
>
>
> On Aug 5, 2011, at 4:42 PM, Jakob Stoklund Olesen wrote:
>
> >
> > On Aug 5, 2011, at 4:28 PM, Villmow, Micah wrote:
> >
> >>> You would be better off using an immediate operand to encode your
> extra
> >>> semantics.
> >> [Villmow, Micah] That is not really feasible to add an extra operand
> to
> >> hundreds of instructions when there is already a location that store
> the
> >> 15 bits of information that is needed(8 in flags, 7 in
> AsmPrinterFlags).
> >
> > You are of course free to do whatever you want in your own tree. I am
> simply trying to steer you in a direction that will cause you less
> grief when merging with trunk.
>
> Also, your argument is basically "we are knowingly do something that is
> documented as a bad idea, because it is easier than fixing our code to
> do the right thing". I'm not going to do it, but this makes me want to
> go rip out asmprinter flags - it doesn't make me inclined to extend
> them.
>
[Villmow, Micah] I'm not saying extend AsmPrinterFlags, I'm saying remove it and use the
space that it was reserving to extend the 'Flags' field to 16 bits. I don't see this as the
wrong approach as this is instruction information, not a new operand. I don't see a valid reason
why I need to change my instructions by an extra operand just to work around an artificial
limitation in LLVM. Having per instruction storage space is required to handle instructions
that require information to be allocated dynamically and not at tablegen compile time.
> -Chris
From rafael.espindola at gmail.com Mon Aug 8 10:28:38 2011
From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=)
Date: Mon, 08 Aug 2011 11:28:38 -0400
Subject: [llvm-commits] [patch][arm] Implement support for the Q,
R and H modifiers
In-Reply-To: <1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
References: <4E3AFA25.6040300@gmail.com>
<27F14F88-6F43-4A4F-9F53-280370D1CC57@apple.com>
<1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
Message-ID: <4E4000A6.1070908@gmail.com>
>> This assumes the operand is the low register of the pair, i.e. even. Is that guaranteed?
>
> No.
>
> We don't allocate even/odd pairs for 64-bit values. We don't even allocate consecutive registers.
>
> Without that constraint, I can't imagine a use for the 'H' modifier?
True. I only tested with function arguments, so I missed this. Thanks
for catching it.
The attached patch handles only the R and Q constraints. Is it OK?
> /jakob
>
Cheers,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: arm-rq.patch
Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/4b963865/attachment.pl
From stoklund at 2pi.dk Mon Aug 8 10:59:39 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Mon, 08 Aug 2011 08:59:39 -0700
Subject: [llvm-commits] [patch][arm] Implement support for the Q,
R and H modifiers
In-Reply-To: <4E4000A6.1070908@gmail.com>
References: <4E3AFA25.6040300@gmail.com>
<27F14F88-6F43-4A4F-9F53-280370D1CC57@apple.com>
<1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
<4E4000A6.1070908@gmail.com>
Message-ID: <23DF2B59-63B7-4334-8B06-4AC2BAF43D56@2pi.dk>
On Aug 8, 2011, at 8:28 AM, Rafael ?vila de Esp?ndola wrote:
>>> This assumes the operand is the low register of the pair, i.e. even. Is that guaranteed?
>>
>> No.
>>
>> We don't allocate even/odd pairs for 64-bit values. We don't even allocate consecutive registers.
>>
>> Without that constraint, I can't imagine a use for the 'H' modifier?
>
> True. I only tested with function arguments, so I missed this. Thanks for catching it.
>
> The attached patch handles only the R and Q constraints. Is it OK?
You are missing some error handling. You are accessing OpNum+1 without checking that it is part of the current asm operand.
/jakob
From aaron at aaronballman.com Mon Aug 8 08:10:48 2011
From: aaron at aaronballman.com (Aaron Ballman)
Date: Mon, 8 Aug 2011 08:10:48 -0500
Subject: [llvm-commits] [PATCH] CrashRecoveryContext.cpp Win32 support
Message-ID:
Hello! I noticed there was a "fixme" listed in
CrashRecoveryContext.cpp and that some Win32 support was needed. I
believe this patch will solve the issue. I have tested it with Visual
Studio 2010, and MinGW gcc 4.5.2 and the behavior is the same as what
I get on OS X.
I was unable to get the test suite to run in my environment (had all
the prerequisites installed, followed the instructions on the site),
so I've not been able to run this against the suite.
One thing to note about this patch is that is only provides support
for Windows XP and higher. Trying to support older versions of
Windows is possible (Win2k and higher) but comes with more pitfalls
(as noted in the comments).
If you have any questions, please ask!
~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CrashRecoveryContext.diff
Type: application/octet-stream
Size: 5204 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/d1fbe81b/attachment-0001.obj
From kristof.beyls at arm.com Mon Aug 8 08:54:56 2011
From: kristof.beyls at arm.com (Kristof Beyls)
Date: Mon, 8 Aug 2011 14:54:56 +0100
Subject: [llvm-commits] [PATCH] Fix NOP encodings in ARM backend.
Message-ID: <001001cc55d2$c1c4e020$454ea060$@beyls@arm.com>
Hi,
With the attached patch, I'm trying to fix a FIXME in the ARM backend. This
patch fixes ARMAsmBackend::WriteNopData, so that it takes into account the
version of the ARM architecture that is being targeted. For versions before
ARMv6T2, there is no NOP instruction, and NOPs are encoded as MOV r0,r0 (in
ARM
mode) or MOV r8,r8 (in Thumb mode). For targets later than ARMv6T2, the
encoding for the NOP instruction is created.
I have a few questions about this patch:
1. To make sure that ARMAsmBackend::WriteNopData can figure out which ARM
sub-target it compiles for, I had to adapt the Target::MCAsmBackendCtorTy
to
also pass on an MCSubtargetInfo argument. Is this the best way to get
sub-target information to the ARMAsmBackend object?
(this change results in a few function signature changes in the
ARM, PowerPC, X86 and MBlaze backends).
2. It's hard to create test cases to test this properly, since I think
that there is another bug in lib/MC/MCAssembler.cpp, where processing
an alignment fragment results in calling ARMAsmBackend::WriteNopData, but
without putting the ARMAsmBackend in the right ARM or Thumb state.
Therefore, e.g. when processing an assembler file with .align directives
in the middle of a Thumb code section, still ARM NOP encodings are
generated instead of Thumb NOP encodings.
Question 2a: Is it OK to write a FIXME to indicate this brokenness?
Should
I also file a bugzilla issue?
Question 2b: Is it OK to leave that fix for a later, separate, patch? For
that fix, it will be easier to create good test cases that will also test
this patch.
Thanks,
Kristof
PS. I'm cc-ing to the cfe-commits list because the change in
Target::MCAsmBackendCtorTy requires 2 lines to change in Clang too, see
attached file clang_arm_nop_encoding.patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm_arm_nop_encoding.patch
Type: application/octet-stream
Size: 15693 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/937ec169/attachment-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_arm_nop_encoding.patch
Type: application/octet-stream
Size: 1154 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/937ec169/attachment-0003.obj
From rafael.espindola at gmail.com Mon Aug 8 11:38:33 2011
From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=)
Date: Mon, 08 Aug 2011 12:38:33 -0400
Subject: [llvm-commits] [patch][arm] Implement support for the Q,
R and H modifiers
In-Reply-To: <23DF2B59-63B7-4334-8B06-4AC2BAF43D56@2pi.dk>
References: <4E3AFA25.6040300@gmail.com>
<27F14F88-6F43-4A4F-9F53-280370D1CC57@apple.com>
<1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
<4E4000A6.1070908@gmail.com>
<23DF2B59-63B7-4334-8B06-4AC2BAF43D56@2pi.dk>
Message-ID: <4E401109.1050203@gmail.com>
> You are missing some error handling. You are accessing OpNum+1
> without checking that it is part of the current asm operand.
The attached patch adds "RegOp >= MI->getNumOperands()" check. Is there
a more specific check for asm operands?
> /jakob
>
Thanks,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: arm-rq.patch
Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/6ac7c787/attachment.pl
From stoklund at 2pi.dk Mon Aug 8 11:48:42 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Mon, 08 Aug 2011 09:48:42 -0700
Subject: [llvm-commits] [patch][arm] Implement support for the Q,
R and H modifiers
In-Reply-To: <4E401109.1050203@gmail.com>
References: <4E3AFA25.6040300@gmail.com>
<27F14F88-6F43-4A4F-9F53-280370D1CC57@apple.com>
<1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
<4E4000A6.1070908@gmail.com>
<23DF2B59-63B7-4334-8B06-4AC2BAF43D56@2pi.dk>
<4E401109.1050203@gmail.com>
Message-ID:
On Aug 8, 2011, at 9:38 AM, Rafael ?vila de Esp?ndola wrote:
>
>> You are missing some error handling. You are accessing OpNum+1
>> without checking that it is part of the current asm operand.
>
> The attached patch adds "RegOp >= MI->getNumOperands()" check. Is there a more specific check for asm operands?
Yes, each group of machine operands on an INLINEASM begin with an immediate describing the group.
In this case, it is probably good enough to check that OpNum+1 exists and is a register.
/jakob
From renato.golin at arm.com Mon Aug 8 12:09:57 2011
From: renato.golin at arm.com (Renato Golin)
Date: Mon, 08 Aug 2011 17:09:57 -0000
Subject: [llvm-commits] [www] r137048 -
/www/trunk/devmtg/2011-09-16/index.html
Message-ID: <20110808170957.82FDB2A6C12C@llvm.org>
Author: rengolin
Date: Mon Aug 8 12:09:57 2011
New Revision: 137048
URL: http://llvm.org/viewvc/llvm-project?rev=137048&view=rev
Log:
confirmed venue, schedule, time for euro-llvm 2011
Modified:
www/trunk/devmtg/2011-09-16/index.html
Modified: www/trunk/devmtg/2011-09-16/index.html
URL: http://llvm.org/viewvc/llvm-project/www/trunk/devmtg/2011-09-16/index.html?rev=137048&r1=137047&r2=137048&view=diff
==============================================================================
--- www/trunk/devmtg/2011-09-16/index.html (original)
+++ www/trunk/devmtg/2011-09-16/index.html Mon Aug 8 12:09:57 2011
@@ -4,16 +4,16 @@
- - What: The first European User Group Meeting.
-
+ - What: The first European User Group Meeting.
- Why: To get acquainted, learn how LLVM is used, and exchange ideas.
- - When: On the afternoon of September 16th, 2011
- - Where: London, UK (venue to be defined yet)
+
- When: September 16th, 2011 from 12:00 ~ 19:30
+ - Where: Hamilton House, Mabledon Place, London, UK, WC1H 9BD
+ (map)
|
-
+
This will be a half-day meeting for LLVM users to exchange ideas, expose new
developments and generally strengthen the network of LLVM developers in and
@@ -34,35 +34,128 @@
Current developments and the future of LLVM (MC, JIT, vectorisation, &c.)
-Organisation
-
We'll be discussing the organisation of the event on the
main LLVM mailing list,
and we welcome suggestions and help. The event
will take place during the afternoon and we'll provide dinner and some beer
at the end to complement the networking.
-
Registration:
-Registration is via email (Euro-LLVM at arm.com), on a first-come-first-serve
-basis, free of charge. Please, send your details (name, email,
-company/institution). Attendance will be limited to about 60 people,
-depending on the venue.
-
-Financial Support:
-
-At this time, we cannot be sure if there will be funding for active
-contributors and students to attend the event. However, we are hopeful that
-we will have company sponsorship to make this happen. Those who are funded
-are required to present at the meeting and may have other requirements from
-their sponsor (i.e. writing a blog post, etc).
+We're still accepting registration via email (Euro-LLVM at arm.com), free of charge.
+Please, send your details (name, email, company/institution).
+Attendance will be limited to 60 people.
If you need funding to attend the meeting, please tell us in your
registration email (to Euro-LLVM at arm.com).
-Agenda
-TBD.
+Tentative Agenda
+
+
+
+| Time | Mander Hall | Side Room #1 | Side Room #2 |
+
+
+|
+ 12:00
+ |
+
+ Welcome and refreshments
+ |
+
+
+
+|
+ 13:00
+ |
+
+ Handling Multi-Versioning in LLVM: Code Tracking and Cloning
+ P. Clauss, A. Jimborean, V. Loechner
+ |
+ |
+ |
+
+
+
+|
+ 13:45
+ |
+
+ More Target Independent LLVM Bitcode
+ Jin-Gu Kang
+ |
+ |
+ |
+
+
+
+|
+ 14:30
+ |
+
+ Tea Break
+ |
+Side session |
+Side session |
+
+
+
+|
+ 15:15
+ |
+
+ Jet: A Language and Heterogeneous Compiler for Fluid Simulations
+ Dan Bailey
+ |
+ |
+ |
+
+
+
+|
+ 16:00
+ |
+
+ Status of the LLVM ARM back-end, Anton Korobeynikov
+ |
+Implementing dynamic scopes in cling
+ Vassil Vassilev |
+ |
+
+
+
+|
+ 16:45
+ |
+
+ Lightning Talks
+ |
+Side session |
+Side session |
+
+
+
+|
+ 17:30
+ |
+
+ Tea Break
+ |
+Side session |
+Side session |
+
+
+
+|
+ 18:15
+ |
+
+ Dinner and wrap up
+ |
+
+
+
+
From renato.golin at arm.com Mon Aug 8 12:13:22 2011
From: renato.golin at arm.com (Renato Golin)
Date: Mon, 08 Aug 2011 17:13:22 -0000
Subject: [llvm-commits] [www] r137049 -
/www/trunk/devmtg/2011-09-16/index.html
Message-ID: <20110808171322.42B4C2A6C12C@llvm.org>
Author: rengolin
Date: Mon Aug 8 12:13:22 2011
New Revision: 137049
URL: http://llvm.org/viewvc/llvm-project?rev=137049&view=rev
Log:
colour in last line, centered in header
Modified:
www/trunk/devmtg/2011-09-16/index.html
Modified: www/trunk/devmtg/2011-09-16/index.html
URL: http://llvm.org/viewvc/llvm-project/www/trunk/devmtg/2011-09-16/index.html?rev=137049&r1=137048&r2=137049&view=diff
==============================================================================
--- www/trunk/devmtg/2011-09-16/index.html (original)
+++ www/trunk/devmtg/2011-09-16/index.html Mon Aug 8 12:13:22 2011
@@ -53,7 +53,7 @@
-| Time | Mander Hall | Side Room #1 | Side Room #2 |
+| Time | Mander Hall | Side Room #1 | Side Room #2 |
|
@@ -145,7 +145,7 @@
| Side session |
-
+
|
18:15
|
From stoklund at 2pi.dk Mon Aug 8 12:15:43 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Mon, 08 Aug 2011 17:15:43 -0000
Subject: [llvm-commits] [llvm] r137050 - in /llvm/trunk:
lib/Target/X86/X86FloatingPoint.cpp test/CodeGen/X86/inline-asm-fpstack.ll
Message-ID: <20110808171543.8623E2A6C12C@llvm.org>
Author: stoklund
Date: Mon Aug 8 12:15:43 2011
New Revision: 137050
URL: http://llvm.org/viewvc/llvm-project?rev=137050&view=rev
Log:
Don't clobber pending ST regs when FP regs are killed.
X86FloatingPoint keeps track of pending ST registers for an upcoming
inline asm instruction with fixed stack register constraints. It does
this by remembering which FP register holds the value that should appear
at a fixed stack position for the inline asm.
When that FP register is killed before the inline asm, make sure to
duplicate it to a scratch register, so the ST register still has a live
FP reference.
This could happen when the same FP register was copied to two ST
registers, or when a spill instruction is inserted between the ST copy
and the inline asm.
This fixes PR10602.
Modified:
llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
llvm/trunk/test/CodeGen/X86/inline-asm-fpstack.ll
Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=137050&r1=137049&r2=137050&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Mon Aug 8 12:15:43 2011
@@ -260,6 +260,21 @@
BuildMI(*MBB, I, dl, TII->get(X86::LD_Frr)).addReg(STReg);
}
+ /// duplicatePendingSTBeforeKill - The instruction at I is about to kill
+ /// RegNo. If any PendingST registers still need the RegNo value, duplicate
+ /// them to new scratch registers.
+ void duplicatePendingSTBeforeKill(unsigned RegNo, MachineInstr *I) {
+ for (unsigned i = 0; i != NumPendingSTs; ++i) {
+ if (PendingST[i] != RegNo)
+ continue;
+ unsigned SR = getScratchReg();
+ DEBUG(dbgs() << "Duplicating pending ST" << i
+ << " in FP" << RegNo << " to FP" << SR << '\n');
+ duplicateToTop(RegNo, SR, I);
+ PendingST[i] = SR;
+ }
+ }
+
/// popStackAfter - Pop the current value off of the top of the FP stack
/// after the specified instruction.
void popStackAfter(MachineBasicBlock::iterator &I);
@@ -973,6 +988,9 @@
unsigned Reg = getFPReg(MI->getOperand(NumOps-1));
bool KillsSrc = MI->killsRegister(X86::FP0+Reg);
+ if (KillsSrc)
+ duplicatePendingSTBeforeKill(Reg, I);
+
// FISTP64m is strange because there isn't a non-popping versions.
// If we have one _and_ we don't want to pop the operand, duplicate the value
// on the stack instead of moving it. This ensure that popping the value is
@@ -1036,6 +1054,7 @@
bool KillsSrc = MI->killsRegister(X86::FP0+Reg);
if (KillsSrc) {
+ duplicatePendingSTBeforeKill(Reg, I);
// If this is the last use of the source register, just make sure it's on
// the top of the stack.
moveToTop(Reg, I);
@@ -1322,6 +1341,7 @@
// When the source is killed, allocate a scratch FP register.
if (KillsSrc) {
+ duplicatePendingSTBeforeKill(SrcFP, I);
unsigned Slot = getSlot(SrcFP);
unsigned SR = getScratchReg();
PendingST[DstST] = SR;
Modified: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-fpstack.ll?rev=137050&r1=137049&r2=137050&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-fpstack.ll (original)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-fpstack.ll Mon Aug 8 12:15:43 2011
@@ -329,3 +329,14 @@
%asmresult = extractvalue %complex %0, 0
ret float %asmresult
}
+
+; Pass the same value in two fixed stack slots.
+; CHECK: PR10602
+; CHECK: flds LCPI
+; CHECK: fld %st(0)
+; CHECK: fcomi %st(1), %st(0)
+define i32 @PR10602() nounwind ssp {
+entry:
+ %0 = tail call i32 asm "fcomi $2, $1; pushf; pop $0", "=r,{st},{st(1)},~{dirflag},~{fpsr},~{flags}"(double 2.000000e+00, double 2.000000e+00) nounwind
+ ret i32 %0
+}
From rafael.espindola at gmail.com Mon Aug 8 12:30:12 2011
From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=)
Date: Mon, 08 Aug 2011 13:30:12 -0400
Subject: [llvm-commits] [patch][arm] Implement support for the Q,
R and H modifiers
In-Reply-To:
References: <4E3AFA25.6040300@gmail.com>
<27F14F88-6F43-4A4F-9F53-280370D1CC57@apple.com>
<1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
<4E4000A6.1070908@gmail.com>
<23DF2B59-63B7-4334-8B06-4AC2BAF43D56@2pi.dk>
<4E401109.1050203@gmail.com>
Message-ID: <4E401D24.4060605@gmail.com>
> Yes, each group of machine operands on an INLINEASM begin with an immediate describing the group.
Cool. The attached patch uses InlineAsm::getNumOperandRegisters. is it ok.
> In this case, it is probably good enough to check that OpNum+1 exists and is a register.
The previous patch does that if you prefer it :-)
> /jakob
>
Cheers,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: arm-rq.patch
Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/3e7a5b33/attachment.pl
From echristo at apple.com Mon Aug 8 12:38:07 2011
From: echristo at apple.com (Eric Christopher)
Date: Mon, 08 Aug 2011 10:38:07 -0700
Subject: [llvm-commits] [patch][arm] Implement support for the Q,
R and H modifiers
In-Reply-To: <4E401D24.4060605@gmail.com>
References: <4E3AFA25.6040300@gmail.com>
<27F14F88-6F43-4A4F-9F53-280370D1CC57@apple.com>
<1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
<4E4000A6.1070908@gmail.com>
<23DF2B59-63B7-4334-8B06-4AC2BAF43D56@2pi.dk>
<4E401109.1050203@gmail.com>
<4E401D24.4060605@gmail.com>
Message-ID:
Hi Rafael,
On Aug 8, 2011, at 10:30 AM, Rafael ?vila de Esp?ndola wrote:
>
>> Yes, each group of machine operands on an INLINEASM begin with an immediate describing the group.
>
> Cool. The attached patch uses InlineAsm::getNumOperandRegisters. is it ok.
>
>> In this case, it is probably good enough to check that OpNum+1 exists and is a register.
>
> The previous patch does that if you prefer it :-)
Sorry about the delay in responding, I've just returned from vacation.
I have some concerns about this patch as is - basically I'm worried about subtle miscompiles based on how gcc does register allocation for multiple reg wide values versus how llvm does it. In the gcc case it will (as far as I know) assign consecutive registers for these sorts of values, but there's no guarantee that llvm will do this. This means that in the case of stm/ldm instructions with the 'Q' and 'R' modifiers that we'd get registers that weren't meant, leading to subtle problems that users would need to debug. When we get support for assigning values into consecutive registers this won't be a problem.
What are your thoughts?
-eric
From dpatel at apple.com Mon Aug 8 13:22:10 2011
From: dpatel at apple.com (Devang Patel)
Date: Mon, 08 Aug 2011 18:22:10 -0000
Subject: [llvm-commits] [llvm] r137056 -
/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Message-ID: <20110808182210.D37832A6C12C@llvm.org>
Author: dpatel
Date: Mon Aug 8 13:22:10 2011
New Revision: 137056
URL: http://llvm.org/viewvc/llvm-project?rev=137056&view=rev
Log:
Simplify by creating parent first.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=137056&r1=137055&r2=137056&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 8 13:22:10 2011
@@ -149,12 +149,14 @@
DbgScope(DbgScope *P, DIDescriptor D, const MDNode *I = 0)
: Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(false),
LastInsn(0), FirstInsn(0),
- DFSIn(0), DFSOut(0), IndentLevel(0) {}
+ DFSIn(0), DFSOut(0), IndentLevel(0) {
+ if (Parent)
+ Parent->addScope(this);
+ }
virtual ~DbgScope();
// Accessors.
DbgScope *getParent() const { return Parent; }
- void setParent(DbgScope *P) { Parent = P; }
DIDescriptor getDesc() const { return Desc; }
const MDNode *getInlinedAt() const { return InlinedAtLocation; }
const MDNode *getScopeNode() const { return Desc; }
@@ -421,11 +423,7 @@
DIDescriptor ParentDesc = DB.getContext();
Parent = getOrCreateAbstractScope(ParentDesc);
}
-
AScope = new DbgScope(Parent, DIDescriptor(N), NULL);
-
- if (Parent)
- Parent->addScope(AScope);
AScope->setAbstractScope();
AbstractScopes[N] = AScope;
if (DIDescriptor(N).isSubprogram())
@@ -1590,17 +1588,16 @@
/// getOrCreateRegularScope - Create regular DbgScope.
DbgScope *DwarfDebug::getOrCreateRegularScope(MDNode *Scope) {
DbgScope *WScope = DbgScopeMap.lookup(Scope);
- if (WScope)
+ if (WScope)
return WScope;
- WScope = new DbgScope(NULL, DIDescriptor(Scope), NULL);
+
+ DbgScope *Parent = NULL;
+ if (DIDescriptor(Scope).isLexicalBlock())
+ Parent = getOrCreateDbgScope(DebugLoc::getFromDILexicalBlock(Scope));
+ WScope = new DbgScope(Parent, DIDescriptor(Scope), NULL);
DbgScopeMap.insert(std::make_pair(Scope, WScope));
- if (DIDescriptor(Scope).isLexicalBlock()) {
- DbgScope *Parent =
- getOrCreateDbgScope(DebugLoc::getFromDILexicalBlock(Scope));
- WScope->setParent(Parent);
- Parent->addScope(WScope);
- } else if (DIDescriptor(Scope).isSubprogram()
- && DISubprogram(Scope).describes(Asm->MF->getFunction()))
+ if (!Parent && DIDescriptor(Scope).isSubprogram()
+ && DISubprogram(Scope).describes(Asm->MF->getFunction()))
CurrentFnDbgScope = WScope;
return WScope;
@@ -1612,13 +1609,11 @@
if (InlinedScope)
return InlinedScope;
- InlinedScope = new DbgScope(NULL, DIDescriptor(Scope), InlinedAt);
DebugLoc InlinedLoc = DebugLoc::getFromDILocation(InlinedAt);
+ InlinedScope = new DbgScope(getOrCreateDbgScope(InlinedLoc),
+ DIDescriptor(Scope), InlinedAt);
InlinedDbgScopeMap[InlinedLoc] = InlinedScope;
DbgScopeMap[InlinedAt] = InlinedScope;
- DbgScope *Parent = getOrCreateDbgScope(InlinedLoc);
- InlinedScope->setParent(Parent);
- Parent->addScope(InlinedScope);
return InlinedScope;
}
From benny.kra at googlemail.com Mon Aug 8 13:32:13 2011
From: benny.kra at googlemail.com (Benjamin Kramer)
Date: Mon, 08 Aug 2011 18:32:13 -0000
Subject: [llvm-commits] [llvm] r137057 -
/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Message-ID: <20110808183213.14C482A6C12C@llvm.org>
Author: d0k
Date: Mon Aug 8 13:32:12 2011
New Revision: 137057
URL: http://llvm.org/viewvc/llvm-project?rev=137057&view=rev
Log:
llvm-objdump: Use help of CFG to print assembly when --cfg is passed.
This way we can avoid printing unreachable code (data).
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=137057&r1=137056&r2=137057&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Mon Aug 8 13:32:12 2011
@@ -248,28 +248,57 @@
raw_ostream &DebugOut = nulls();
#endif
- for (Index = Start; Index < End; Index += Size) {
- MCInst Inst;
- if (DisAsm->getInstruction(Inst, Size, memoryObject, Index, DebugOut)) {
- uint64_t addr;
- if (error(i->getAddress(addr))) break;
- outs() << format("%8x:\t", addr + Index);
- DumpBytes(StringRef(Bytes.data() + Index, Size));
- IP->printInst(&Inst, outs());
- outs() << "\n";
- } else {
- errs() << ToolName << ": warning: invalid instruction encoding\n";
- if (Size == 0)
- Size = 1; // skip illegible bytes
+ if (!CFG) {
+ for (Index = Start; Index < End; Index += Size) {
+ MCInst Inst;
+ if (DisAsm->getInstruction(Inst, Size, memoryObject, Index,
+ DebugOut)) {
+ uint64_t addr;
+ if (error(i->getAddress(addr))) break;
+ outs() << format("%8x:\t", addr + Index);
+ DumpBytes(StringRef(Bytes.data() + Index, Size));
+ IP->printInst(&Inst, outs());
+ outs() << "\n";
+ } else {
+ errs() << ToolName << ": warning: invalid instruction encoding\n";
+ if (Size == 0)
+ Size = 1; // skip illegible bytes
+ }
}
- }
- if (CFG) {
+ } else {
+ // Create CFG and use it for disassembly.
MCFunction f =
MCFunction::createFunctionFromMC(Symbols[si].second, DisAsm.get(),
memoryObject, Start, End, InstrInfo,
DebugOut);
+ for (MCFunction::iterator fi = f.begin(), fe = f.end(); fi != fe; ++fi){
+ bool hasPreds = false;
+ // Only print blocks that have predecessors.
+ // FIXME: Slow.
+ for (MCFunction::iterator pi = f.begin(), pe = f.end(); pi != pe;
+ ++pi)
+ if (pi->second.contains(&fi->second)) {
+ hasPreds = true;
+ break;
+ }
+
+ if (!hasPreds && fi != f.begin())
+ continue;
+
+ for (unsigned ii = 0, ie = fi->second.getInsts().size(); ii != ie;
+ ++ii) {
+ uint64_t addr;
+ if (error(i->getAddress(addr))) break;
+ const MCDecodedInst &Inst = fi->second.getInsts()[ii];
+ outs() << format("%8x:\t", addr + Inst.Address);
+ DumpBytes(StringRef(Bytes.data() + Inst.Address, Inst.Size));
+ IP->printInst(&Inst.Inst, outs());
+ outs() << '\n';
+ }
+ }
+
// Start a new dot file.
std::string Error;
raw_fd_ostream Out((f.getName().str() + ".dot").c_str(), Error);
From benny.kra at googlemail.com Mon Aug 8 13:41:34 2011
From: benny.kra at googlemail.com (Benjamin Kramer)
Date: Mon, 08 Aug 2011 18:41:34 -0000
Subject: [llvm-commits] [llvm] r137058 -
/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Message-ID: <20110808184134.92F742A6C12C@llvm.org>
Author: d0k
Date: Mon Aug 8 13:41:34 2011
New Revision: 137058
URL: http://llvm.org/viewvc/llvm-project?rev=137058&view=rev
Log:
llvm-objdump: disassembly enhancements
- Indent simple loops
- Print unreachable blocks as .byte directives
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=137058&r1=137057&r2=137058&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Mon Aug 8 13:41:34 2011
@@ -284,8 +284,23 @@
break;
}
- if (!hasPreds && fi != f.begin())
+ // Data block.
+ if (!hasPreds && fi != f.begin()) {
+ uint64_t End = llvm::next(fi) == fe ? SectSize :
+ llvm::next(fi)->first;
+ uint64_t addr;
+ if (error(i->getAddress(addr))) break;
+ outs() << "# " << End-fi->first << " bytes of data:\n";
+ for (unsigned pos = fi->first; pos != End; ++pos) {
+ outs() << format("%8x:\t", addr + pos);
+ DumpBytes(StringRef(Bytes.data() + pos, 1));
+ outs() << format("\t.byte 0x%02x\n", (uint8_t)Bytes[pos]);
+ }
continue;
+ }
+
+ if (fi->second.contains(&fi->second))
+ outs() << "# Loop begin:\n";
for (unsigned ii = 0, ie = fi->second.getInsts().size(); ii != ie;
++ii) {
@@ -294,6 +309,9 @@
const MCDecodedInst &Inst = fi->second.getInsts()[ii];
outs() << format("%8x:\t", addr + Inst.Address);
DumpBytes(StringRef(Bytes.data() + Inst.Address, Inst.Size));
+ // Simple loops.
+ if (fi->second.contains(&fi->second))
+ outs() << '\t';
IP->printInst(&Inst.Inst, outs());
outs() << '\n';
}
From nadav.rotem at intel.com Mon Aug 8 13:44:10 2011
From: nadav.rotem at intel.com (Rotem, Nadav)
Date: Mon, 8 Aug 2011 21:44:10 +0300
Subject: [llvm-commits] [PATCH] Optimize trunc store
Message-ID: <6594DDFF12B03D4E89690887C24869940296EB851B@hasmsx504.ger.corp.intel.com>
Hi,
Please review the attached patch. When performing a truncating store, it is sometimes possible to rearrange the data in-register prior to saving to memory. When we reorder the data in memory we prevent the need to save multiple scalars to memory, making a single regular store.
Thanks,
Nadav
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/8280c0d6/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: truncstore.diff
Type: application/octet-stream
Size: 5905 bytes
Desc: truncstore.diff
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/8280c0d6/attachment.obj
From benny.kra at googlemail.com Mon Aug 8 13:56:44 2011
From: benny.kra at googlemail.com (Benjamin Kramer)
Date: Mon, 08 Aug 2011 18:56:44 -0000
Subject: [llvm-commits] [llvm] r137059 - in /llvm/trunk:
include/llvm/MC/MCInstrAnalysis.h include/llvm/Target/TargetRegistry.h
lib/MC/MCInstrAnalysis.cpp lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
tools/llvm-objdump/MCFunction.cpp tools/llvm-objdump/MCFunction.h
tools/llvm-objdump/llvm-objdump.cpp
Message-ID: <20110808185644.A0F502A6C12C@llvm.org>
Author: d0k
Date: Mon Aug 8 13:56:44 2011
New Revision: 137059
URL: http://llvm.org/viewvc/llvm-project?rev=137059&view=rev
Log:
Add MCInstrAnalysis class. This allows the targets to specify own versions of MCInstrDescs functions.
- Add overrides for ARM.
- Teach llvm-objdump to use this instead of plain MCInstrDesc.
Added:
llvm/trunk/include/llvm/MC/MCInstrAnalysis.h
llvm/trunk/lib/MC/MCInstrAnalysis.cpp
Modified:
llvm/trunk/include/llvm/Target/TargetRegistry.h
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
llvm/trunk/tools/llvm-objdump/MCFunction.cpp
llvm/trunk/tools/llvm-objdump/MCFunction.h
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Added: llvm/trunk/include/llvm/MC/MCInstrAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInstrAnalysis.h?rev=137059&view=auto
==============================================================================
--- llvm/trunk/include/llvm/MC/MCInstrAnalysis.h (added)
+++ llvm/trunk/include/llvm/MC/MCInstrAnalysis.h Mon Aug 8 13:56:44 2011
@@ -0,0 +1,54 @@
+//===-- llvm/MC/MCInstrAnalysis.h - InstrDesc target hooks ------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the MCInstrAnalysis class which the MCTargetDescs can
+// derive from to give additional information to MC.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCInstrDesc.h"
+#include "llvm/MC/MCInstrInfo.h"
+
+namespace llvm {
+
+class MCInstrAnalysis {
+protected:
+ friend class Target;
+ const MCInstrInfo *Info;
+
+ MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
+public:
+ virtual bool isBranch(const MCInst &Inst) const {
+ return Info->get(Inst.getOpcode()).isBranch();
+ }
+
+ virtual bool isConditionalBranch(const MCInst &Inst) const {
+ return Info->get(Inst.getOpcode()).isBranch();
+ }
+
+ virtual bool isUnconditionalBranch(const MCInst &Inst) const {
+ return Info->get(Inst.getOpcode()).isUnconditionalBranch();
+ }
+
+ virtual bool isIndirectBranch(const MCInst &Inst) const {
+ return Info->get(Inst.getOpcode()).isIndirectBranch();
+ }
+
+ virtual bool isReturn(const MCInst &Inst) const {
+ return Info->get(Inst.getOpcode()).isReturn();
+ }
+
+ /// evaluateBranch - Given a branch instruction try to get the address the
+ /// branch targets. Otherwise return -1.
+ virtual uint64_t
+ evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size) const;
+};
+
+}
Modified: llvm/trunk/include/llvm/Target/TargetRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegistry.h?rev=137059&r1=137058&r2=137059&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegistry.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegistry.h Mon Aug 8 13:56:44 2011
@@ -20,6 +20,7 @@
#define LLVM_TARGET_TARGETREGISTRY_H
#include "llvm/MC/MCCodeGenInfo.h"
+#include "llvm/MC/MCInstrAnalysis.h"
#include "llvm/ADT/Triple.h"
#include
#include
@@ -74,6 +75,7 @@
Reloc::Model RM,
CodeModel::Model CM);
typedef MCInstrInfo *(*MCInstrInfoCtorFnTy)(void);
+ typedef MCInstrAnalysis *(*MCInstrAnalysisCtorFnTy)(const MCInstrInfo*Info);
typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(StringRef TT);
typedef MCSubtargetInfo *(*MCSubtargetInfoCtorFnTy)(StringRef TT,
StringRef CPU,
@@ -147,6 +149,10 @@
/// if registered.
MCInstrInfoCtorFnTy MCInstrInfoCtorFn;
+ /// MCInstrAnalysisCtorFn - Constructor function for this target's
+ /// MCInstrAnalysis, if registered.
+ MCInstrAnalysisCtorFnTy MCInstrAnalysisCtorFn;
+
/// MCRegInfoCtorFn - Constructor function for this target's MCRegisterInfo,
/// if registered.
MCRegInfoCtorFnTy MCRegInfoCtorFn;
@@ -281,6 +287,14 @@
return MCInstrInfoCtorFn();
}
+ /// createMCInstrAnalysis - Create a MCInstrAnalysis implementation.
+ ///
+ MCInstrAnalysis *createMCInstrAnalysis(const MCInstrInfo *Info) const {
+ if (!MCInstrAnalysisCtorFn)
+ return new MCInstrAnalysis(Info);
+ return MCInstrAnalysisCtorFn(Info);
+ }
+
/// createMCRegInfo - Create a MCRegisterInfo implementation.
///
MCRegisterInfo *createMCRegInfo(StringRef Triple) const {
@@ -557,6 +571,15 @@
T.MCInstrInfoCtorFn = Fn;
}
+ /// RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for
+ /// the given target.
+ static void RegisterMCInstrAnalysis(Target &T,
+ Target::MCInstrAnalysisCtorFnTy Fn) {
+ // Ignore duplicate registration.
+ if (!T.MCInstrAnalysisCtorFn)
+ T.MCInstrAnalysisCtorFn = Fn;
+ }
+
/// RegisterMCRegInfo - Register a MCRegisterInfo implementation for the
/// given target.
///
Added: llvm/trunk/lib/MC/MCInstrAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCInstrAnalysis.cpp?rev=137059&view=auto
==============================================================================
--- llvm/trunk/lib/MC/MCInstrAnalysis.cpp (added)
+++ llvm/trunk/lib/MC/MCInstrAnalysis.cpp Mon Aug 8 13:56:44 2011
@@ -0,0 +1,20 @@
+//===-- MCInstrAnalysis.cpp - InstrDesc target hooks ------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCInstrAnalysis.h"
+using namespace llvm;
+
+uint64_t MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
+ uint64_t Size) const {
+ if (Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
+ return -1ULL;
+
+ int64_t Imm = Inst.getOperand(0).getImm();
+ return Addr+Size+Imm;
+}
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp?rev=137059&r1=137058&r2=137059&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp Mon Aug 8 13:56:44 2011
@@ -13,6 +13,7 @@
#include "ARMMCTargetDesc.h"
#include "ARMMCAsmInfo.h"
+#include "ARMBaseInfo.h"
#include "InstPrinter/ARMInstPrinter.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
@@ -159,6 +160,53 @@
return 0;
}
+namespace {
+
+class ARMMCInstrAnalysis : public MCInstrAnalysis {
+public:
+ ARMMCInstrAnalysis(const MCInstrInfo *Info) : MCInstrAnalysis(Info) {}
+ virtual bool isBranch(const MCInst &Inst) const {
+ // Don't flag "bx lr" as a branch.
+ return MCInstrAnalysis::isBranch(Inst) && (Inst.getOpcode() != ARM::BX ||
+ Inst.getOperand(0).getReg() != ARM::LR);
+ }
+
+ virtual bool isUnconditionalBranch(const MCInst &Inst) const {
+ // BCCs with the "always" predicate are unconditional branches.
+ if (Inst.getOpcode() == ARM::Bcc && Inst.getOperand(1).getImm()==ARMCC::AL)
+ return true;
+ return MCInstrAnalysis::isUnconditionalBranch(Inst);
+ }
+
+ virtual bool isConditionalBranch(const MCInst &Inst) const {
+ // BCCs with the "always" predicate are unconditional branches.
+ if (Inst.getOpcode() == ARM::Bcc && Inst.getOperand(1).getImm()==ARMCC::AL)
+ return false;
+ return MCInstrAnalysis::isConditionalBranch(Inst);
+ }
+
+ virtual bool isReturn(const MCInst &Inst) const {
+ // Recognize "bx lr" as return.
+ return Inst.getOpcode() == ARM::BX && Inst.getOperand(0).getReg()==ARM::LR;
+ }
+
+ uint64_t evaluateBranch(const MCInst &Inst, uint64_t Addr,
+ uint64_t Size) const {
+ // We only handle PCRel branches for now.
+ if (Info->get(Inst.getOpcode()).OpInfo[0].OperandType!=MCOI::OPERAND_PCREL)
+ return -1ULL;
+
+ int64_t Imm = Inst.getOperand(0).getImm();
+ // FIXME: This is not right for thumb.
+ return Addr+Imm+8; // In ARM mode the PC is always off by 8 bytes.
+ }
+};
+
+}
+
+static MCInstrAnalysis *createARMMCInstrAnalysis(const MCInstrInfo *Info) {
+ return new ARMMCInstrAnalysis(Info);
+}
// Force static initialization.
extern "C" void LLVMInitializeARMTargetMC() {
@@ -178,6 +226,11 @@
TargetRegistry::RegisterMCRegInfo(TheARMTarget, createARMMCRegisterInfo);
TargetRegistry::RegisterMCRegInfo(TheThumbTarget, createARMMCRegisterInfo);
+ TargetRegistry::RegisterMCInstrAnalysis(TheARMTarget,
+ createARMMCInstrAnalysis);
+ TargetRegistry::RegisterMCInstrAnalysis(TheThumbTarget,
+ createARMMCInstrAnalysis);
+
// Register the MC subtarget info.
TargetRegistry::RegisterMCSubtargetInfo(TheARMTarget,
ARM_MC::createARMMCSubtargetInfo);
Modified: llvm/trunk/tools/llvm-objdump/MCFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MCFunction.cpp?rev=137059&r1=137058&r2=137059&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MCFunction.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MCFunction.cpp Mon Aug 8 13:56:44 2011
@@ -17,6 +17,7 @@
#include "llvm/MC/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstPrinter.h"
+#include "llvm/MC/MCInstrAnalysis.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/Support/MemoryObject.h"
@@ -28,7 +29,7 @@
MCFunction
MCFunction::createFunctionFromMC(StringRef Name, const MCDisassembler *DisAsm,
const MemoryObject &Region, uint64_t Start,
- uint64_t End, const MCInstrInfo *InstrInfo,
+ uint64_t End, const MCInstrAnalysis *Ana,
raw_ostream &DebugOut) {
std::set Splits;
Splits.insert(Start);
@@ -40,21 +41,17 @@
MCInst Inst;
if (DisAsm->getInstruction(Inst, Size, Region, Index, DebugOut)) {
- const MCInstrDesc &Desc = InstrInfo->get(Inst.getOpcode());
- if (Desc.isBranch()) {
- if (Desc.OpInfo[0].OperandType == MCOI::OPERAND_PCREL) {
- int64_t Imm = Inst.getOperand(0).getImm();
- // FIXME: Distinguish relocations from nop jumps.
- if (Imm != 0) {
- if (Index+Imm+Size >= End) {
- Instructions.push_back(MCDecodedInst(Index, Size, Inst));
- continue; // Skip branches that leave the function.
- }
- Splits.insert(Index+Imm+Size);
- }
+ if (Ana->isBranch(Inst)) {
+ uint64_t targ = Ana->evaluateBranch(Inst, Index, Size);
+ // FIXME: Distinguish relocations from nop jumps.
+ if (targ != -1ULL && (targ == Index+Size || targ >= End)) {
+ Instructions.push_back(MCDecodedInst(Index, Size, Inst));
+ continue; // Skip branches that leave the function.
}
+ if (targ != -1ULL)
+ Splits.insert(targ);
Splits.insert(Index+Size);
- } else if (Desc.isReturn()) {
+ } else if (Ana->isReturn(Inst)) {
Splits.insert(Index+Size);
}
@@ -90,26 +87,22 @@
MCBasicBlock &BB = i->second;
if (BB.getInsts().empty()) continue;
const MCDecodedInst &Inst = BB.getInsts().back();
- const MCInstrDesc &Desc = InstrInfo->get(Inst.Inst.getOpcode());
- if (Desc.isBranch()) {
- // PCRel branch, we know the destination.
- if (Desc.OpInfo[0].OperandType == MCOI::OPERAND_PCREL) {
- int64_t Imm = Inst.Inst.getOperand(0).getImm();
- if (Imm != 0)
- BB.addSucc(&f.getBlockAtAddress(Inst.Address+Inst.Size+Imm));
- // Conditional branches can also fall through to the next block.
- if (Desc.isConditionalBranch() && llvm::next(i) != e)
- BB.addSucc(&llvm::next(i)->second);
- } else {
+ if (Ana->isBranch(Inst.Inst)) {
+ uint64_t targ = Ana->evaluateBranch(Inst.Inst, Inst.Address, Inst.Size);
+ if (targ == -1ULL) {
// Indirect branch. Bail and add all blocks of the function as a
// successor.
for (MCFunction::iterator i = f.begin(), e = f.end(); i != e; ++i)
BB.addSucc(&i->second);
- }
+ } else if (targ != Inst.Address+Inst.Size)
+ BB.addSucc(&f.getBlockAtAddress(targ));
+ // Conditional branches can also fall through to the next block.
+ if (Ana->isConditionalBranch(Inst.Inst) && llvm::next(i) != e)
+ BB.addSucc(&llvm::next(i)->second);
} else {
// No branch. Fall through to the next block.
- if (!Desc.isReturn() && llvm::next(i) != e)
+ if (!Ana->isReturn(Inst.Inst) && llvm::next(i) != e)
BB.addSucc(&llvm::next(i)->second);
}
}
Modified: llvm/trunk/tools/llvm-objdump/MCFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MCFunction.h?rev=137059&r1=137058&r2=137059&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MCFunction.h (original)
+++ llvm/trunk/tools/llvm-objdump/MCFunction.h Mon Aug 8 13:56:44 2011
@@ -20,7 +20,7 @@
namespace llvm {
class MCDisassembler;
-class MCInstrInfo;
+class MCInstrAnalysis;
class MemoryObject;
class raw_ostream;
@@ -68,7 +68,7 @@
static MCFunction
createFunctionFromMC(StringRef Name, const MCDisassembler *DisAsm,
const MemoryObject &Region, uint64_t Start, uint64_t End,
- const MCInstrInfo *InstrInfo, raw_ostream &DebugOut);
+ const MCInstrAnalysis *Ana, raw_ostream &DebugOut);
typedef MapTy::iterator iterator;
iterator begin() { return Blocks.begin(); }
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=137059&r1=137058&r2=137059&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Mon Aug 8 13:56:44 2011
@@ -165,6 +165,8 @@
return;
}
const MCInstrInfo *InstrInfo = TheTarget->createMCInstrInfo();
+ OwningPtr
+ InstrAnalysis(TheTarget->createMCInstrAnalysis(InstrInfo));
outs() << '\n';
outs() << Filename
@@ -270,8 +272,8 @@
// Create CFG and use it for disassembly.
MCFunction f =
MCFunction::createFunctionFromMC(Symbols[si].second, DisAsm.get(),
- memoryObject, Start, End, InstrInfo,
- DebugOut);
+ memoryObject, Start, End,
+ InstrAnalysis.get(), DebugOut);
for (MCFunction::iterator fi = f.begin(), fe = f.end(); fi != fe; ++fi){
bool hasPreds = false;
From rafael.espindola at gmail.com Mon Aug 8 14:01:55 2011
From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=)
Date: Mon, 08 Aug 2011 15:01:55 -0400
Subject: [llvm-commits] [patch][arm] Implement support for the Q,
R and H modifiers
In-Reply-To:
References: <4E3AFA25.6040300@gmail.com>
<27F14F88-6F43-4A4F-9F53-280370D1CC57@apple.com>
<1E673A39-42C2-400D-8C77-D43D014E1ABF@2pi.dk>
<4E4000A6.1070908@gmail.com>
<23DF2B59-63B7-4334-8B06-4AC2BAF43D56@2pi.dk>
<4E401109.1050203@gmail.com>
<4E401D24.4060605@gmail.com>
Message-ID: <4E4032A3.4050608@gmail.com>
> Sorry about the delay in responding, I've just returned from
> vacation.
np and welcome back!
> I have some concerns about this patch as is - basically I'm worried
> about subtle miscompiles based on how gcc does register allocation
> for multiple reg wide values versus how llvm does it. In the gcc case
> it will (as far as I know) assign consecutive registers for these
> sorts of values, but there's no guarantee that llvm will do this.
I think that is correct. When printing 'H' for example, gcc uses "REGNO
(x) + 1". I could not find any other reference to those constraints, so
it looks like gcc uses sequential registers unconditionally.
> This means that in the case of stm/ldm instructions with the 'Q' and
> 'R' modifiers that we'd get registers that weren't meant, leading to
> subtle problems that users would need to debug. When we get support
> for assigning values into consecutive registers this won't be a
> problem.
>
> What are your thoughts?
This is the first time I have seen these constraints, so I don't know
how common they are and of those uses which ones assume sequential
registers.
I have attached the testcase where we have found this problem. In this
particular case, we don't depend on the registers being sequential (but
llvm does it anyway because it is an argument).
How hard would it be to add the constraint that the registers have to be
sequential? If doing it I would probably try it by creating a new pseudo
reg class that alias the regular R registers and use those as operands
to the inline asm. Is that what you had in mind?
So, I guess this is a judgment call. The current patch allows us to
handle some inline asm but causes us to miscompile others that we
currently reject.
> -eric
Cheers,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.c
Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/955f3573/attachment.c
From benny.kra at googlemail.com Mon Aug 8 14:09:02 2011
From: benny.kra at googlemail.com (Benjamin Kramer)
Date: Mon, 08 Aug 2011 19:09:02 -0000
Subject: [llvm-commits] [llvm] r137060 - in /llvm/trunk:
include/llvm/MC/MCInstrAnalysis.h lib/MC/CMakeLists.txt
Message-ID: <20110808190902.3C5C32A6C12C@llvm.org>
Author: d0k
Date: Mon Aug 8 14:09:02 2011
New Revision: 137060
URL: http://llvm.org/viewvc/llvm-project?rev=137060&view=rev
Log:
Pacify virtual dtor warnings and cmake buildbots.
Modified:
llvm/trunk/include/llvm/MC/MCInstrAnalysis.h
llvm/trunk/lib/MC/CMakeLists.txt
Modified: llvm/trunk/include/llvm/MC/MCInstrAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInstrAnalysis.h?rev=137060&r1=137059&r2=137060&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCInstrAnalysis.h (original)
+++ llvm/trunk/include/llvm/MC/MCInstrAnalysis.h Mon Aug 8 14:09:02 2011
@@ -25,6 +25,8 @@
MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
public:
+ virtual ~MCInstrAnalysis() {}
+
virtual bool isBranch(const MCInst &Inst) const {
return Info->get(Inst.getOpcode()).isBranch();
}
Modified: llvm/trunk/lib/MC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=137060&r1=137059&r2=137060&view=diff
==============================================================================
--- llvm/trunk/lib/MC/CMakeLists.txt (original)
+++ llvm/trunk/lib/MC/CMakeLists.txt Mon Aug 8 14:09:02 2011
@@ -15,6 +15,7 @@
MCExpr.cpp
MCInst.cpp
MCInstPrinter.cpp
+ MCInstrAnalysis.cpp
MCLabel.cpp
MCDwarf.cpp
MCLoggingStreamer.cpp
From eli.friedman at gmail.com Mon Aug 8 14:49:37 2011
From: eli.friedman at gmail.com (Eli Friedman)
Date: Mon, 08 Aug 2011 19:49:37 -0000
Subject: [llvm-commits] [llvm] r137061 - in /llvm/trunk:
lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-sxt-uxt.ll
Message-ID: <20110808194937.E4DB22A6C12C@llvm.org>
Author: efriedma
Date: Mon Aug 8 14:49:37 2011
New Revision: 137061
URL: http://llvm.org/viewvc/llvm-project?rev=137061&view=rev
Log:
Fix up the patterns for SXTB, SXTH, UXTB, and UXTH so that they are correctly active without HasT2ExtractPack. PR10611.
Added:
llvm/trunk/test/CodeGen/Thumb2/thumb2-sxt-uxt.ll
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=137061&r1=137060&r2=137061&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Aug 8 14:49:37 2011
@@ -977,7 +977,8 @@
class T2I_ext_rrot opcod, string opc, PatFrag opnode>
: T2TwoReg<(outs rGPR:$Rd), (ins rGPR:$Rm, rot_imm:$rot), IIC_iEXTr,
opc, ".w\t$Rd, $Rm$rot",
- [(set rGPR:$Rd, (opnode (rotr rGPR:$Rm, rot_imm:$rot)))]> {
+ [(set rGPR:$Rd, (opnode (rotr rGPR:$Rm, rot_imm:$rot)))]>,
+ Requires<[IsThumb2]> {
let Inst{31-27} = 0b11111;
let Inst{26-23} = 0b0100;
let Inst{22-20} = opcod;
@@ -3407,9 +3408,9 @@
// SXT/UXT with no rotate
let AddedComplexity = 16 in {
def : T2Pat<(and rGPR:$Rm, 0x000000FF), (t2UXTB rGPR:$Rm, 0)>,
- Requires<[HasT2ExtractPack, IsThumb2]>;
+ Requires<[IsThumb2]>;
def : T2Pat<(and rGPR:$Rm, 0x0000FFFF), (t2UXTH rGPR:$Rm, 0)>,
- Requires<[HasT2ExtractPack, IsThumb2]>;
+ Requires<[IsThumb2]>;
def : T2Pat<(and rGPR:$Rm, 0x00FF00FF), (t2UXTB16 rGPR:$Rm, 0)>,
Requires<[HasT2ExtractPack, IsThumb2]>;
def : T2Pat<(add rGPR:$Rn, (and rGPR:$Rm, 0x00FF)),
@@ -3421,9 +3422,9 @@
}
def : T2Pat<(sext_inreg rGPR:$Src, i8), (t2SXTB rGPR:$Src, 0)>,
- Requires<[HasT2ExtractPack, IsThumb2]>;
+ Requires<[IsThumb2]>;
def : T2Pat<(sext_inreg rGPR:$Src, i16), (t2SXTH rGPR:$Src, 0)>,
- Requires<[HasT2ExtractPack, IsThumb2]>;
+ Requires<[IsThumb2]>;
def : T2Pat<(add rGPR:$Rn, (sext_inreg rGPR:$Rm, i8)),
(t2SXTAB rGPR:$Rn, rGPR:$Rm, 0)>,
Requires<[HasT2ExtractPack, IsThumb2]>;
Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-sxt-uxt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sxt-uxt.ll?rev=137061&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb2/thumb2-sxt-uxt.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sxt-uxt.ll Mon Aug 8 14:49:37 2011
@@ -0,0 +1,29 @@
+; RUN: llc < %s -march=thumb -mcpu=cortex-m3 | FileCheck %s
+
+define i32 @test1(i16 zeroext %z) nounwind {
+; CHECK: test1:
+; CHECK: sxth
+ %r = sext i16 %z to i32
+ ret i32 %r
+}
+
+define i32 @test2(i8 zeroext %z) nounwind {
+; CHECK: test2:
+; CHECK: sxtb
+ %r = sext i8 %z to i32
+ ret i32 %r
+}
+
+define i32 @test3(i16 signext %z) nounwind {
+; CHECK: test3:
+; CHECK: uxth
+ %r = zext i16 %z to i32
+ ret i32 %r
+}
+
+define i32 @test4(i8 signext %z) nounwind {
+; CHECK: test4:
+; CHECK: uxtb
+ %r = zext i8 %z to i32
+ ret i32 %r
+}
From resistor at mac.com Mon Aug 8 15:42:17 2011
From: resistor at mac.com (Owen Anderson)
Date: Mon, 08 Aug 2011 20:42:17 -0000
Subject: [llvm-commits] [llvm] r137062 - in /llvm/trunk:
lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMInstrThumb.td
lib/Target/ARM/ARMInstrThumb2.td
lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
utils/TableGen/EDEmitter.cpp
Message-ID: <20110808204217.EC3622A6C12C@llvm.org>
Author: resistor
Date: Mon Aug 8 15:42:17 2011
New Revision: 137062
URL: http://llvm.org/viewvc/llvm-project?rev=137062&view=rev
Log:
Fix encodings for Thumb ASR and LSR immediate operands. They encode the range 1-32, with 32 encoded as 0.
Modified:
llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
llvm/trunk/utils/TableGen/EDEmitter.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=137062&r1=137061&r2=137062&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Mon Aug 8 15:42:17 2011
@@ -236,6 +236,8 @@
const {return 0; }
uint32_t getLdStSORegOpValue(const MachineInstr &MI, unsigned OpIdx)
const { return 0; }
+ unsigned getThumbSRImmOpValue(const MachineInstr &MI, unsigned OpIdx)
+ const { return 0; }
unsigned getAddrModeImm12OpValue(const MachineInstr &MI, unsigned Op)
const {
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=137062&r1=137061&r2=137062&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Aug 8 15:42:17 2011
@@ -19,6 +19,13 @@
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
SDNPVariadic]>;
+def imm_sr : Operand, ImmLeaf 0 && Imm <= 32;
+}]> {
+ let EncoderMethod = "getThumbSRImmOpValue";
+ let DecoderMethod = "DecodeThumbSRImm";
+}
+
def imm_neg_XFORM : SDNodeXFormgetTargetConstant(-(int)N->getZExtValue(), MVT::i32);
}]>;
@@ -91,6 +98,7 @@
def t_blxtarget : Operand {
let EncoderMethod = "getThumbBLXTargetOpValue";
+ let DecoderMethod = "DecodeThumbBLXOffset";
}
}
@@ -876,10 +884,10 @@
// ASR immediate
def tASRri : // A8.6.14
- T1sIGenEncodeImm<{0,1,0,?,?}, (outs tGPR:$Rd), (ins tGPR:$Rm, i32imm:$imm5),
+ T1sIGenEncodeImm<{0,1,0,?,?}, (outs tGPR:$Rd), (ins tGPR:$Rm, imm_sr:$imm5),
IIC_iMOVsi,
"asr", "\t$Rd, $Rm, $imm5",
- [(set tGPR:$Rd, (sra tGPR:$Rm, (i32 imm:$imm5)))]> {
+ [(set tGPR:$Rd, (sra tGPR:$Rm, (i32 imm_sr:$imm5)))]> {
bits<5> imm5;
let Inst{10-6} = imm5;
}
@@ -976,10 +984,10 @@
// LSR immediate
def tLSRri : // A8.6.90
- T1sIGenEncodeImm<{0,0,1,?,?}, (outs tGPR:$Rd), (ins tGPR:$Rm, i32imm:$imm5),
+ T1sIGenEncodeImm<{0,0,1,?,?}, (outs tGPR:$Rd), (ins tGPR:$Rm, imm_sr:$imm5),
IIC_iMOVsi,
"lsr", "\t$Rd, $Rm, $imm5",
- [(set tGPR:$Rd, (srl tGPR:$Rm, (i32 imm:$imm5)))]> {
+ [(set tGPR:$Rd, (srl tGPR:$Rm, (i32 imm_sr:$imm5)))]> {
bits<5> imm5;
let Inst{10-6} = imm5;
}
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=137062&r1=137061&r2=137062&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Aug 8 15:42:17 2011
@@ -66,7 +66,7 @@
}], t2_so_imm_neg_XFORM>;
/// imm1_31 predicate - True if the 32-bit immediate is in the range [1,31].
-def imm1_31 : ImmLeaf, ImmLeaf= 1 && (int32_t)Imm < 32;
}]>;
@@ -759,12 +759,12 @@
/// T2I_sh_ir - Defines a set of (op reg, {so_imm|r}) patterns for a shift /
// rotate operation that produces a value.
-multiclass T2I_sh_ir opcod, string opc, PatFrag opnode> {
+multiclass T2I_sh_ir opcod, string opc, Operand ty, PatFrag opnode> {
// 5-bit imm
def ri : T2sTwoRegShiftImm<
- (outs rGPR:$Rd), (ins rGPR:$Rm, i32imm:$imm), IIC_iMOVsi,
+ (outs rGPR:$Rd), (ins rGPR:$Rm, ty:$imm), IIC_iMOVsi,
opc, ".w\t$Rd, $Rm, $imm",
- [(set rGPR:$Rd, (opnode rGPR:$Rm, imm1_31:$imm))]> {
+ [(set rGPR:$Rd, (opnode rGPR:$Rm, ty:$imm))]> {
let Inst{31-27} = 0b11101;
let Inst{26-21} = 0b010010;
let Inst{19-16} = 0b1111; // Rn
@@ -1913,10 +1913,10 @@
// Shift and rotate Instructions.
//
-defm t2LSL : T2I_sh_ir<0b00, "lsl", BinOpFrag<(shl node:$LHS, node:$RHS)>>;
-defm t2LSR : T2I_sh_ir<0b01, "lsr", BinOpFrag<(srl node:$LHS, node:$RHS)>>;
-defm t2ASR : T2I_sh_ir<0b10, "asr", BinOpFrag<(sra node:$LHS, node:$RHS)>>;
-defm t2ROR : T2I_sh_ir<0b11, "ror", BinOpFrag<(rotr node:$LHS, node:$RHS)>>;
+defm t2LSL : T2I_sh_ir<0b00, "lsl", imm1_31, BinOpFrag<(shl node:$LHS, node:$RHS)>>;
+defm t2LSR : T2I_sh_ir<0b01, "lsr", imm_sr, BinOpFrag<(srl node:$LHS, node:$RHS)>>;
+defm t2ASR : T2I_sh_ir<0b10, "asr", imm_sr, BinOpFrag<(sra node:$LHS, node:$RHS)>>;
+defm t2ROR : T2I_sh_ir<0b11, "ror", imm1_31, BinOpFrag<(rotr node:$LHS, node:$RHS)>>;
// (rotr x, (and y, 0x...1f)) ==> (ROR x, y)
def : Pat<(rotr rGPR:$lhs, (and rGPR:$rhs, lo5AllOne)),
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp?rev=137062&r1=137061&r2=137062&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp Mon Aug 8 15:42:17 2011
@@ -294,6 +294,9 @@
unsigned getShiftRight64Imm(const MCInst &MI, unsigned Op,
SmallVectorImpl &Fixups) const;
+ unsigned getThumbSRImmOpValue(const MCInst &MI, unsigned Op,
+ SmallVectorImpl &Fixups) const;
+
unsigned NEONThumb2DataIPostEncoder(const MCInst &MI,
unsigned EncodedValue) const;
unsigned NEONThumb2LoadStorePostEncoder(const MCInst &MI,
@@ -440,6 +443,16 @@
return isAdd;
}
+uint32_t ARMMCCodeEmitter::
+getThumbSRImmOpValue(const MCInst &MI, unsigned OpIdx,
+ SmallVectorImpl &Fixups) const {
+ const MCOperand &MO = MI.getOperand(OpIdx);
+ assert(MO.isImm() && "Expected constant shift!");
+ int val = MO.getImm();
+ return (val == 32) ? 0 : val;
+}
+
+
/// getBranchTargetOpValue - Helper function to get the branch target operand,
/// which is either an immediate or requires a fixup.
static uint32_t getBranchTargetOpValue(const MCInst &MI, unsigned OpIdx,
Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/EDEmitter.cpp?rev=137062&r1=137061&r2=137062&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/EDEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/EDEmitter.cpp Mon Aug 8 15:42:17 2011
@@ -615,6 +615,8 @@
IMM("t2ldrlabel");
IMM("postidx_imm8");
IMM("postidx_imm8s4");
+ IMM("imm_sr");
+ IMM("imm1_31");
MISC("brtarget", "kOperandTypeARMBranchTarget"); // ?
MISC("uncondbrtarget", "kOperandTypeARMBranchTarget"); // ?
From wendling at apple.com Mon Aug 8 15:49:23 2011
From: wendling at apple.com (Bill Wendling)
Date: Mon, 08 Aug 2011 13:49:23 -0700
Subject: [llvm-commits] Newest LandingPad Patch
In-Reply-To: <4E3FB06D.6080405@free.fr>
References: <1D33093C-44C0-43BE-B5CD-9CF8F0907484@apple.com>
<4E3FB06D.6080405@free.fr>
Message-ID: <9646C440-5F6A-4EB8-A18F-1364B819A83B@apple.com>
Hi Duncan,
Thanks for the review. The possibility of 'bitcasts' makes this annoying. If I cannot guarantee that they will always be Constant*s or Function*s, I'll just change this to use Value*s instead.
-bw
On Aug 8, 2011, at 2:46 AM, Duncan Sands wrote:
> Hi Bill,
>
>> + /// getPersonalityFn - Get the personality function associated with this
>> + /// landing pad.
>> + const Function *getPersonalityFn() const {
>> + return cast(getOperand(0));
>> + }
>
> I think you should change this to
> return cast(getOperand(0)->stripPointerCasts());
>
> That's because you can't avoid sometimes getting a bitcast here. For example,
> suppose you have two modules that both declare __gxx_personality_v0 and use it
> in a landingpad instruction, but they use a slightly different prototype for
> __gxx_personality_v0. When you link the bitcode from the two modules together,
> the prototype difference will be resolved by replacing one __gxx_personality_v0
> with a bitcast of the other. This results in landingpad instructions with a
> bitcast of a function for the personality function operand, and then... boom!
>
> Likewise, you can't assume that typeinfos are global variables, you have to
> allow for the possibility that they are bitcasts of global variables. I didn't
> notice any place that assumes they are global variables, so hopefully everything
> is OK for them.
>
>> --- lib/VMCore/AsmWriter.cpp (revision 136744)
>> +++ lib/VMCore/AsmWriter.cpp (working copy)
>> @@ -1735,6 +1735,31 @@
>> writeOperand(I.getOperand(1), true);
>> for (const unsigned *i = IVI->idx_begin(), *e = IVI->idx_end(); i != e; ++i)
>> Out << ", " << *i;
>> + } else if (const LandingPadInst *LPI = dyn_cast(&I)) {
>> + Out << ' ';
>> + TypePrinter.print(I.getType(), Out);
>> + Out << " personality ";
>> + writeOperand(LPI->getPersonalityFn(), true); Out << '\n';
>
> If the personality operand was a bitcast then here you would fail to output the
> bitcast. You should probably just write out operand 0.
>
>> @@ -3513,6 +3514,57 @@
>> return AteExtraComma ? InstExtraComma : InstNormal;
>> }
>>
>> +/// ParseLandingPad
>> +/// ::= 'landingpad' Type 'personality' TypeAndValue 'cleanup'? Clause+
>> +/// Clause
>> +/// ::= 'catch' TypeAndValue
>> +/// ::= 'filter' TypeAndValue*
>> +bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
>> + Type *Ty = 0; LocTy TyLoc;
>> + Value *PersFn; LocTy PersFnLoc;
>> + LocTy LPLoc = Lex.getLoc();
>> +
>> + if (ParseType(Ty, TyLoc) ||
>> + ParseToken(lltok::kw_personality, "expected 'personality'") ||
>> + ParseTypeAndValue(PersFn, PersFnLoc, PFS))
>> + return true;
>> +
>> + LandingPadInst *LP = LandingPadInst::Create(Ty, cast(PersFn), 0);
>
> Here you will blow up if the personality function is a bitcast. Also, you
> should probably write the parsing in such a way as to output a helpful message
> rather than crashing (as cast would) if someone provides invalid
> input.
>
>> + LP->setCleanup(EatIfPresent(lltok::kw_cleanup));
>> +
>> + while (Lex.getKind() == lltok::kw_catch || Lex.getKind() == lltok::kw_filter){
>> + if (Lex.getKind() == lltok::kw_catch) {
>> + ParseToken(lltok::kw_catch, "expected 'catch'");
>> +
>> + Value *V; LocTy VLoc;
>> + if (ParseTypeAndValue(V, VLoc, PFS)) {
>> + delete LP;
>> + return true;
>> + }
>> + LP->addClause(LandingPadInst::Catch, cast(V));
>
> This should probably output an error rather than crashing if V is not a
> constant.
>
>> + } else {
>> + ParseToken(lltok::kw_filter, "expected 'filter'");
>> + SmallVector Filters;
>> +
>> + if (Lex.getKind() == lltok::Type) {
>> + do {
>> + Value *V; LocTy VLoc;
>> + if (ParseTypeAndValue(V, VLoc, PFS)) {
>> + delete LP;
>> + return true;
>> + }
>> + Filters.push_back(cast(V));
>
> This should probably output an error rather than crashing if V is not a
> constant.
>
>> --- lib/Bitcode/Reader/BitcodeReader.cpp (revision 136744)
>> +++ lib/Bitcode/Reader/BitcodeReader.cpp (working copy)
>> @@ -2543,6 +2543,45 @@
>> break;
>> }
>>
>> + case bitc::FUNC_CODE_INST_LANDINGPAD: {
>> + // LANDINGPAD: [ty, val, val, num, (id0,val0 ...)?]
>> + unsigned Idx = 0;
>> + if (Record.size() < 4)
>> + return Error("Invalid LANDINGPAD record");
>> + Type *Ty = getTypeByID(Record[Idx++]);
>> + if (!Ty) return Error("Invalid LANDINGPAD record");
>> + Value *PersFn = 0;
>> + if (getValueTypePair(Record, Idx, NextValueNo, PersFn))
>> + return Error("Invalid LANDINGPAD record");
>> +
>> + bool IsCleanup = !!Record[Idx++];
>> + unsigned NumClauses = Record[Idx++];
>> + LandingPadInst *LP = LandingPadInst::Create(Ty, cast(PersFn),
>
> Kaboom if a bitcast of a function rather than a function. Here too you should
> probably try to output a message rather than crashing if you get some strange
> input.
>
>> Index: lib/Bitcode/Writer/BitcodeWriter.cpp
>> ===================================================================
>> --- lib/Bitcode/Writer/BitcodeWriter.cpp (revision 136744)
>> +++ lib/Bitcode/Writer/BitcodeWriter.cpp (working copy)
>> @@ -1166,6 +1166,26 @@
>> break;
>> }
>>
>> + case Instruction::LandingPad: {
>> + const LandingPadInst &LP = cast(I);
>> + Code = bitc::FUNC_CODE_INST_LANDINGPAD;
>> + Vals.push_back(VE.getTypeID(LP.getType()));
>> + PushValueAndType(LP.getPersonalityFn(), InstID, Vals, VE);
>
> This would drop any bitcast on the personality function.
>
> Ciao, Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From stoklund at 2pi.dk Mon Aug 8 15:53:24 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Mon, 08 Aug 2011 20:53:24 -0000
Subject: [llvm-commits] [llvm] r137063 - in /llvm/trunk:
include/llvm/Target/TargetInstrInfo.h lib/CodeGen/TargetInstrInfoImpl.cpp
lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h
Message-ID: <20110808205324.AA3452A6C12C@llvm.org>
Author: stoklund
Date: Mon Aug 8 15:53:24 2011
New Revision: 137063
URL: http://llvm.org/viewvc/llvm-project?rev=137063&view=rev
Log:
Hoist hasLoadFromStackSlot and hasStoreToStackSlot.
These the methods are target-independent since they simply scan the
memory operands. They can live in TargetInstrInfoImpl.
Modified:
llvm/trunk/include/llvm/Target/TargetInstrInfo.h
llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=137063&r1=137062&r2=137063&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Mon Aug 8 15:53:24 2011
@@ -693,6 +693,12 @@
unsigned &SrcOpIdx2) const;
virtual bool canFoldMemoryOperand(const MachineInstr *MI,
const SmallVectorImpl &Ops) const;
+ virtual bool hasLoadFromStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
+ int &FrameIndex) const;
+ virtual bool hasStoreToStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
+ int &FrameIndex) const;
virtual bool PredicateInstruction(MachineInstr *MI,
const SmallVectorImpl &Pred) const;
virtual void reMaterialize(MachineBasicBlock &MBB,
Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=137063&r1=137062&r2=137063&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Mon Aug 8 15:53:24 2011
@@ -160,6 +160,42 @@
return MadeChange;
}
+bool TargetInstrInfoImpl::hasLoadFromStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
+ int &FrameIndex) const {
+ for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
+ oe = MI->memoperands_end();
+ o != oe;
+ ++o) {
+ if ((*o)->isLoad() && (*o)->getValue())
+ if (const FixedStackPseudoSourceValue *Value =
+ dyn_cast((*o)->getValue())) {
+ FrameIndex = Value->getFrameIndex();
+ MMO = *o;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool TargetInstrInfoImpl::hasStoreToStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
+ int &FrameIndex) const {
+ for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
+ oe = MI->memoperands_end();
+ o != oe;
+ ++o) {
+ if ((*o)->isStore() && (*o)->getValue())
+ if (const FixedStackPseudoSourceValue *Value =
+ dyn_cast((*o)->getValue())) {
+ FrameIndex = Value->getFrameIndex();
+ MMO = *o;
+ return true;
+ }
+ }
+ return false;
+}
+
void TargetInstrInfoImpl::reMaterialize(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
unsigned DestReg,
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=137063&r1=137062&r2=137063&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Aug 8 15:53:24 2011
@@ -856,24 +856,6 @@
return 0;
}
-bool X86InstrInfo::hasLoadFromStackSlot(const MachineInstr *MI,
- const MachineMemOperand *&MMO,
- int &FrameIndex) const {
- for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
- oe = MI->memoperands_end();
- o != oe;
- ++o) {
- if ((*o)->isLoad() && (*o)->getValue())
- if (const FixedStackPseudoSourceValue *Value =
- dyn_cast((*o)->getValue())) {
- FrameIndex = Value->getFrameIndex();
- MMO = *o;
- return true;
- }
- }
- return false;
-}
-
unsigned X86InstrInfo::isStoreToStackSlot(const MachineInstr *MI,
int &FrameIndex) const {
if (isFrameStoreOpcode(MI->getOpcode()))
@@ -896,24 +878,6 @@
return 0;
}
-bool X86InstrInfo::hasStoreToStackSlot(const MachineInstr *MI,
- const MachineMemOperand *&MMO,
- int &FrameIndex) const {
- for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
- oe = MI->memoperands_end();
- o != oe;
- ++o) {
- if ((*o)->isStore() && (*o)->getValue())
- if (const FixedStackPseudoSourceValue *Value =
- dyn_cast((*o)->getValue())) {
- FrameIndex = Value->getFrameIndex();
- MMO = *o;
- return true;
- }
- }
- return false;
-}
-
/// regIsPICBase - Return true if register is PIC base (i.e.g defined by
/// X86::MOVPC32r.
static bool regIsPICBase(unsigned BaseReg, const MachineRegisterInfo &MRI) {
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=137063&r1=137062&r2=137063&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Mon Aug 8 15:53:24 2011
@@ -166,17 +166,6 @@
unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI,
int &FrameIndex) const;
- /// hasLoadFromStackSlot - If the specified machine instruction has
- /// a load from a stack slot, return true along with the FrameIndex
- /// of the loaded stack slot and the machine mem operand containing
- /// the reference. If not, return false. Unlike
- /// isLoadFromStackSlot, this returns true for any instructions that
- /// loads from the stack. This is a hint only and may not catch all
- /// cases.
- bool hasLoadFromStackSlot(const MachineInstr *MI,
- const MachineMemOperand *&MMO,
- int &FrameIndex) const;
-
unsigned isStoreToStackSlot(const MachineInstr *MI, int &FrameIndex) const;
/// isStoreToStackSlotPostFE - Check for post-frame ptr elimination
/// stack locations as well. This uses a heuristic so it isn't
@@ -184,16 +173,6 @@
unsigned isStoreToStackSlotPostFE(const MachineInstr *MI,
int &FrameIndex) const;
- /// hasStoreToStackSlot - If the specified machine instruction has a
- /// store to a stack slot, return true along with the FrameIndex of
- /// the loaded stack slot and the machine mem operand containing the
- /// reference. If not, return false. Unlike isStoreToStackSlot,
- /// this returns true for any instructions that loads from the
- /// stack. This is a hint only and may not catch all cases.
- bool hasStoreToStackSlot(const MachineInstr *MI,
- const MachineMemOperand *&MMO,
- int &FrameIndex) const;
-
bool isReallyTriviallyReMaterializable(const MachineInstr *MI,
AliasAnalysis *AA) const;
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
From grosbach at apple.com Mon Aug 8 15:59:31 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 08 Aug 2011 20:59:31 -0000
Subject: [llvm-commits] [llvm] r137064 -
/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Message-ID: <20110808205931.A743E2A6C12C@llvm.org>
Author: grosbach
Date: Mon Aug 8 15:59:31 2011
New Revision: 137064
URL: http://llvm.org/viewvc/llvm-project?rev=137064&view=rev
Log:
ARM load/store label parsing.
Allow labels for load/store instructions when parsing. There's encoding
issues, still, so this doesn't work all the way through, yet.
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=137064&r1=137063&r2=137064&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Aug 8 15:59:31 2011
@@ -566,6 +566,12 @@
return Val > -256 && Val < 256;
}
bool isMemImm12Offset() const {
+ // If we have an immediate that's not a constant, treat it as a label
+ // reference needing a fixup. If it is a constant, it's something else
+ // and we reject it.
+ if (Kind == Immediate && !isa(getImm()))
+ return true;
+
if (Kind != Memory || Mem.OffsetRegNum != 0)
return false;
// Immediate offset in range [-4095, 4095].
@@ -830,6 +836,14 @@
void addMemImm12OffsetOperands(MCInst &Inst, unsigned N) const {
assert(N == 2 && "Invalid number of operands!");
+ // If this is an immediate, it's a label reference.
+ if (Kind == Immediate) {
+ addExpr(Inst, getImm());
+ Inst.addOperand(MCOperand::CreateImm(0));
+ return;
+ }
+
+ // Otherwise, it's a normal memory reg+offset.
int64_t Val = Mem.OffsetImm ? Mem.OffsetImm->getValue() : 0;
Inst.addOperand(MCOperand::CreateReg(Mem.BaseRegNum));
Inst.addOperand(MCOperand::CreateImm(Val));
From gkistanova at gmail.com Mon Aug 8 16:03:11 2011
From: gkistanova at gmail.com (Galina Kistanova)
Date: Mon, 08 Aug 2011 21:03:11 -0000
Subject: [llvm-commits] [zorg] r137065 - in
/zorg/trunk/buildbot/osuosl/master/config: builders.py slaves.py
Message-ID: <20110808210311.7C6572A6C12C@llvm.org>
Author: gkistanova
Date: Mon Aug 8 16:03:11 2011
New Revision: 137065
URL: http://llvm.org/viewvc/llvm-project?rev=137065&view=rev
Log:
Add new clang builder.
Modified:
zorg/trunk/buildbot/osuosl/master/config/builders.py
zorg/trunk/buildbot/osuosl/master/config/slaves.py
Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=137065&r1=137064&r2=137065&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/builders.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py Mon Aug 8 16:03:11 2011
@@ -300,6 +300,15 @@
stage1_config='Release+Asserts',
test=True),
'category' : 'clang'},
+
+ {'name': "clang-native-mingw32-win7",
+ 'slavenames':["kistanova8"],
+ 'builddir':"clang-native-mingw32-win7",
+ 'factory' : ClangBuilder.getClangBuildFactory(triple='i686-pc-mingw32',
+ useTwoStage=True,
+ stage1_config='Release+Asserts',
+ stage2_config='Release+Asserts'),
+ 'category' : 'clang'},
# Clang cross builders.
{'name': "clang-x86_64-darwin10-self-mingw32",
Modified: zorg/trunk/buildbot/osuosl/master/config/slaves.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/slaves.py?rev=137065&r1=137064&r2=137065&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/slaves.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/slaves.py Mon Aug 8 16:03:11 2011
@@ -63,7 +63,7 @@
# FreeBSD 8.2 X86_64
create_slave("kistanova7", properties={'jobs' : 2}, max_builds=1),
- # Dummy entries for future use.
+ # Windows 7 Ultimate
create_slave("kistanova8", properties={'jobs' : 1}, max_builds=1),
# Quad Core x86_64, Solaris / AurorAUX
From wendling at apple.com Mon Aug 8 16:23:27 2011
From: wendling at apple.com (Bill Wendling)
Date: Mon, 08 Aug 2011 14:23:27 -0700
Subject: [llvm-commits] [PATCH] Revised LandingPadInst Patch
Message-ID:
This is the next iteration of the landingpad instruction patch. It incorporates the feedback from Chris and Duncan. Notably, the values that are stored are now "Value*"s instead of "Function*" or "Constant*". Duncan pointed out that bitcasts can get in the way of things.
I didn't explain the last patch well. The syntax allows for only one "type" per "catch" clause. However, the "filter" clause needs to allow for zero or more "types". This is because this filter:
filter A, B, C
is different from this filter:
filter A
filter B
filter C
The LandingPadInst has this ugly wart on it, namely the "Index" structure that Chris pointed out. I need a way to indicate the clause type for an object in the OperandList, it's index into that list, and how many "types" are associated with that. This is because of inlining. When we inline things, we are going to append the clauses to this list. And they need to be in the correct order so that the exception tables are generated correctly.
Please review and let me know what you think. Thanks!
-bw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: landingpadinst.2.diff
Type: application/octet-stream
Size: 34897 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110808/1f06ee2c/attachment.obj
-------------- next part --------------
From bruno.cardoso at gmail.com Mon Aug 8 16:31:08 2011
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Mon, 08 Aug 2011 21:31:08 -0000
Subject: [llvm-commits] [llvm] r137067 - in /llvm/trunk:
lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/avx-shift.ll
Message-ID: <20110808213108.A2C652A6C12C@llvm.org>
Author: bruno
Date: Mon Aug 8 16:31:08 2011
New Revision: 137067
URL: http://llvm.org/viewvc/llvm-project?rev=137067&view=rev
Log:
Add support for several vector shifts operations while in AVX mode. Fix PR10581
Added:
llvm/trunk/test/CodeGen/X86/avx-shift.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=137067&r1=137066&r2=137067&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 8 16:31:08 2011
@@ -883,7 +883,7 @@
setOperationAction(ISD::SINT_TO_FP, MVT::v4i32, Legal);
}
- if (Subtarget->hasSSE41()) {
+ if (Subtarget->hasSSE41() || Subtarget->hasAVX()) {
setOperationAction(ISD::FFLOOR, MVT::f32, Legal);
setOperationAction(ISD::FCEIL, MVT::f32, Legal);
setOperationAction(ISD::FTRUNC, MVT::f32, Legal);
@@ -922,10 +922,11 @@
}
}
- if (Subtarget->hasSSE2()) {
+ if (Subtarget->hasSSE2() || Subtarget->hasAVX()) {
setOperationAction(ISD::SRL, MVT::v2i64, Custom);
setOperationAction(ISD::SRL, MVT::v4i32, Custom);
setOperationAction(ISD::SRL, MVT::v16i8, Custom);
+ setOperationAction(ISD::SRL, MVT::v8i16, Custom);
setOperationAction(ISD::SHL, MVT::v2i64, Custom);
setOperationAction(ISD::SHL, MVT::v4i32, Custom);
@@ -935,7 +936,7 @@
setOperationAction(ISD::SRA, MVT::v8i16, Custom);
}
- if (Subtarget->hasSSE42())
+ if (Subtarget->hasSSE42() || Subtarget->hasAVX())
setOperationAction(ISD::VSETCC, MVT::v2i64, Custom);
if (!UseSoftFloat && Subtarget->hasAVX()) {
@@ -975,6 +976,19 @@
setOperationAction(ISD::CONCAT_VECTORS, MVT::v32i8, Custom);
setOperationAction(ISD::CONCAT_VECTORS, MVT::v16i16, Custom);
+ setOperationAction(ISD::SRL, MVT::v4i64, Custom);
+ setOperationAction(ISD::SRL, MVT::v8i32, Custom);
+ setOperationAction(ISD::SRL, MVT::v16i16, Custom);
+ setOperationAction(ISD::SRL, MVT::v32i8, Custom);
+
+ setOperationAction(ISD::SHL, MVT::v4i64, Custom);
+ setOperationAction(ISD::SHL, MVT::v8i32, Custom);
+ setOperationAction(ISD::SHL, MVT::v16i16, Custom);
+ setOperationAction(ISD::SHL, MVT::v32i8, Custom);
+
+ setOperationAction(ISD::SRA, MVT::v8i32, Custom);
+ setOperationAction(ISD::SRA, MVT::v16i16, Custom);
+
// Custom lower several nodes for 256-bit types.
for (unsigned i = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) {
@@ -9195,11 +9209,42 @@
DebugLoc dl = Op.getDebugLoc();
SDValue R = Op.getOperand(0);
SDValue Amt = Op.getOperand(1);
-
LLVMContext *Context = DAG.getContext();
- // Must have SSE2.
- if (!Subtarget->hasSSE2()) return SDValue();
+ if (!(Subtarget->hasSSE2() || Subtarget->hasAVX()))
+ return SDValue();
+
+ // Decompose 256-bit shifts into smaller 128-bit shifts.
+ if (VT.getSizeInBits() == 256) {
+ int NumElems = VT.getVectorNumElements();
+ MVT EltVT = VT.getVectorElementType().getSimpleVT();
+ EVT NewVT = MVT::getVectorVT(EltVT, NumElems/2);
+
+ // Extract the two vectors
+ SDValue V1 = Extract128BitVector(R, DAG.getConstant(0, MVT::i32), DAG, dl);
+ SDValue V2 = Extract128BitVector(R, DAG.getConstant(NumElems/2, MVT::i32),
+ DAG, dl);
+
+ // Recreate the shift amount vectors
+ SmallVector Amt1Csts;
+ SmallVector Amt2Csts;
+ for (int i = 0; i < NumElems/2; ++i)
+ Amt1Csts.push_back(Amt->getOperand(i));
+ for (int i = NumElems/2; i < NumElems; ++i)
+ Amt2Csts.push_back(Amt->getOperand(i));
+
+ SDValue Amt1 = DAG.getNode(ISD::BUILD_VECTOR, dl, NewVT,
+ &Amt1Csts[0], NumElems/2);
+ SDValue Amt2 = DAG.getNode(ISD::BUILD_VECTOR, dl, NewVT,
+ &Amt2Csts[0], NumElems/2);
+
+ // Issue new vector shifts for the smaller types
+ V1 = DAG.getNode(Op.getOpcode(), dl, NewVT, V1, Amt1);
+ V2 = DAG.getNode(Op.getOpcode(), dl, NewVT, V2, Amt2);
+
+ // Concatenate the result back
+ return DAG.getNode(ISD::CONCAT_VECTORS, dl, VT, V1, V2);
+ }
// Optimize shl/srl/sra with constant shift amount.
if (isSplatVector(Amt.getNode())) {
@@ -9250,9 +9295,6 @@
}
// Lower SHL with variable shift amount.
- // Cannot lower SHL without SSE2 or later.
- if (!Subtarget->hasSSE2()) return SDValue();
-
if (VT == MVT::v4i32 && Op->getOpcode() == ISD::SHL) {
Op = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, dl, VT,
DAG.getConstant(Intrinsic::x86_sse2_pslli_d, MVT::i32),
@@ -12099,7 +12141,7 @@
// all elements are shifted by the same amount. We can't do this in legalize
// because the a constant vector is typically transformed to a constant pool
// so we have no knowledge of the shift amount.
- if (!Subtarget->hasSSE2())
+ if (!(Subtarget->hasSSE2() || Subtarget->hasAVX()))
return SDValue();
if (VT != MVT::v2i64 && VT != MVT::v4i32 && VT != MVT::v8i16)
Added: llvm/trunk/test/CodeGen/X86/avx-shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-shift.ll?rev=137067&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-shift.ll (added)
+++ llvm/trunk/test/CodeGen/X86/avx-shift.ll Mon Aug 8 16:31:08 2011
@@ -0,0 +1,64 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
+
+;;; Shift left
+; CHECK: vpslld
+; CHECK: vpslld
+define <8 x i32> @vshift00(<8 x i32> %a) nounwind readnone {
+ %s = shl <8 x i32> %a,
+ ret <8 x i32> %s
+}
+
+; CHECK: vpsllw
+; CHECK: vpsllw
+define <16 x i16> @vshift01(<16 x i16> %a) nounwind readnone {
+ %s = shl <16 x i16> %a,
+ ret <16 x i16> %s
+}
+
+; CHECK: vpsllq
+; CHECK: vpsllq
+define <4 x i64> @vshift02(<4 x i64> %a) nounwind readnone {
+ %s = shl <4 x i64> %a,
+ ret <4 x i64> %s
+}
+
+;;; Logical Shift right
+; CHECK: vpsrld
+; CHECK: vpsrld
+define <8 x i32> @vshift03(<8 x i32> %a) nounwind readnone {
+ %s = lshr <8 x i32> %a,
+ ret <8 x i32> %s
+}
+
+; CHECK: vpsrlw
+; CHECK: vpsrlw
+define <16 x i16> @vshift04(<16 x i16> %a) nounwind readnone {
+ %s = lshr <16 x i16> %a,
+ ret <16 x i16> %s
+}
+
+; CHECK: vpsrlq
+; CHECK: vpsrlq
+define <4 x i64> @vshift05(<4 x i64> %a) nounwind readnone {
+ %s = lshr <4 x i64> %a,
+ ret <4 x i64> %s
+}
+
+;;; Arithmetic Shift right
+; CHECK: vpsrad
+; CHECK: vpsrad
+define <8 x i32> @vshift06(<8 x i32> %a) nounwind readnone {
+ %s = ashr <8 x i32> %a,
+ ret <8 x i32> %s
+}
+
+; CHECK: vpsraw
+; CHECK: vpsraw
+define <16 x i16> @vshift07(<16 x i16> %a) nounwind readnone {
+ %s = ashr <16 x i16> %a,
+ ret <16 x i16> %s
+}
+
From stoklund at 2pi.dk Mon Aug 8 16:45:32 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Mon, 08 Aug 2011 21:45:32 -0000
Subject: [llvm-commits] [llvm] r137069 - in /llvm/trunk/lib/Target/ARM:
ARMBaseInstrInfo.cpp ARMBaseInstrInfo.h
Message-ID: <20110808214532.65BBC2A6C12C@llvm.org>
Author: stoklund
Date: Mon Aug 8 16:45:32 2011
New Revision: 137069
URL: http://llvm.org/viewvc/llvm-project?rev=137069&view=rev
Log:
Implement isLoadFromStackSlotPostFE and isStoreToStackSlotPostFE for ARM.
They improve the verbose assembly.
Modified:
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h
Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=137069&r1=137068&r2=137069&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Mon Aug 8 16:45:32 2011
@@ -810,6 +810,12 @@
return 0;
}
+unsigned ARMBaseInstrInfo::isStoreToStackSlotPostFE(const MachineInstr *MI,
+ int &FrameIndex) const {
+ const MachineMemOperand *Dummy;
+ return MI->getDesc().mayStore() && hasStoreToStackSlot(MI, Dummy, FrameIndex);
+}
+
void ARMBaseInstrInfo::
loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned DestReg, int FI,
@@ -945,6 +951,12 @@
return 0;
}
+unsigned ARMBaseInstrInfo::isLoadFromStackSlotPostFE(const MachineInstr *MI,
+ int &FrameIndex) const {
+ const MachineMemOperand *Dummy;
+ return MI->getDesc().mayLoad() && hasLoadFromStackSlot(MI, Dummy, FrameIndex);
+}
+
MachineInstr*
ARMBaseInstrInfo::emitFrameIndexDebugValue(MachineFunction &MF,
int FrameIx, uint64_t Offset,
Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=137069&r1=137068&r2=137069&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Mon Aug 8 16:45:32 2011
@@ -101,6 +101,10 @@
int &FrameIndex) const;
virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
int &FrameIndex) const;
+ virtual unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI,
+ int &FrameIndex) const;
+ virtual unsigned isStoreToStackSlotPostFE(const MachineInstr *MI,
+ int &FrameIndex) const;
virtual void copyPhysReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I, DebugLoc DL,
From wendling at apple.com Mon Aug 8 17:08:48 2011
From: wendling at apple.com (Bill Wendling)
Date: Mon, 08 Aug 2011 15:08:48 -0700
Subject: [llvm-commits] [Patch] DwarfEHPrepare for New EH
In-Reply-To: <4E3FFD82.8090701@free.fr>
References:
<4E3FFD82.8090701@free.fr>
Message-ID:
On Aug 8, 2011, at 8:15 AM, Duncan Sands wrote:
> Hi Bill,
>
>> This patch implements the small amount which needs to be done by the DwarfEHPrepare pass. What it does is takes the 'resume' instruction and converts it into a call to _Unwind_Resume. The SjLj changes will be done in the SjLj lowering pass.
>
> why do this in DwarfEHPrepare (which should be zapped in the long run I guess)?
I did it here because inserting a function call in the back-end is tricky. :) But yes, I'd love to see DwarfEHPrepare (and SjLjEHPrepare) go away.
> Shouldn't it be lowered in SelectionDAGBuilder like other instructions are?
> Also, it should probably be turned into a RESUME SDag Node, so that different
> targets can be different things with it (eg: ARM doesn't want _Unwind_Resume
> IIRC).
>
The ARM stuff uses SjLj exception handling, which is handled by the SjLjEHPrepare pass.
The question isn't so much "which back-end needs what function call?", but "what is the family of exception handling we're dealing with, and what does its ABI tell us should be the 'resume' call?". We currently support two types of exception handling, of course: zero-cost and setjmp-longjmp. We are told which one to use via a flag in MCAsmInfo, though it's really personality function specific. I don't know if this will (or should) change in the future.
-bw
From grosbach at apple.com Mon Aug 8 17:11:33 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 08 Aug 2011 22:11:33 -0000
Subject: [llvm-commits] [llvm] r137070 -
/llvm/trunk/test/MC/ARM/arm-memory-instructions.s
Message-ID: <20110808221133.8CEC02A6C12C@llvm.org>
Author: grosbach
Date: Mon Aug 8 17:11:33 2011
New Revision: 137070
URL: http://llvm.org/viewvc/llvm-project?rev=137070&view=rev
Log:
Add FIXME.
Modified:
llvm/trunk/test/MC/ARM/arm-memory-instructions.s
Modified: llvm/trunk/test/MC/ARM/arm-memory-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm-memory-instructions.s?rev=137070&r1=137069&r2=137070&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/arm-memory-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/arm-memory-instructions.s Mon Aug 8 17:11:33 2011
@@ -23,6 +23,13 @@
@ CHECK: ldr r1, [r2], #30 @ encoding: [0x1e,0x10,0x92,0xe4]
@ CHECK: ldr r3, [r1], #-30 @ encoding: [0x1e,0x30,0x11,0xe4]
+ at ------------------------------------------------------------------------------
+@ FIXME: LDR (literal)
+ at ------------------------------------------------------------------------------
+@ label operands currently assert the show-encoding asm comment helper due
+@ to the use of non-contiguous bit ranges for fixups in ARM. Once that's
+@ cleaned up, we can write useful assembly testcases for these sorts of
+@ instructions.
@------------------------------------------------------------------------------
@ LDR (register)
From grosbach at apple.com Mon Aug 8 17:37:06 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 08 Aug 2011 22:37:06 -0000
Subject: [llvm-commits] [llvm] r137071 -
/llvm/trunk/test/MC/ARM/arm-memory-instructions.s
Message-ID: <20110808223707.017542A6C12C@llvm.org>
Author: grosbach
Date: Mon Aug 8 17:37:06 2011
New Revision: 137071
URL: http://llvm.org/viewvc/llvm-project?rev=137071&view=rev
Log:
ARM parsing and encoding for LDRB instruction.
Modified:
llvm/trunk/test/MC/ARM/arm-memory-instructions.s
Modified: llvm/trunk/test/MC/ARM/arm-memory-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm-memory-instructions.s?rev=137071&r1=137070&r2=137071&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/arm-memory-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/arm-memory-instructions.s Mon Aug 8 17:37:06 2011
@@ -51,3 +51,41 @@
@ CHECK: ldr r4, [r3], -r6 @ encoding: [0x06,0x40,0x13,0xe6]
@ CHECK: ldr r3, [r8, -r2, lsl #15] @ encoding: [0x82,0x37,0x18,0xe7]
@ CHECK: ldr r1, [r5], r3, asr #15 @ encoding: [0xc3,0x17,0x95,0xe6]
+
+
+ at ------------------------------------------------------------------------------
+@ LDRB (immediate)
+ at ------------------------------------------------------------------------------
+ ldrb r3, [r8]
+ ldrb r1, [sp, #63]
+ ldrb r9, [r3, #4095]!
+ ldrb r8, [r1], #22
+ ldrb r2, [r7], #-19
+
+@ CHECK: ldrb r3, [r8] @ encoding: [0x00,0x30,0xd8,0xe5]
+@ CHECK: ldrb r1, [sp, #63] @ encoding: [0x3f,0x10,0xdd,0xe5]
+@ CHECK: ldrb r9, [r3, #4095]! @ encoding: [0xff,0x9f,0xf3,0xe5]
+@ CHECK: ldrb r8, [r1], #22 @ encoding: [0x16,0x80,0xd1,0xe4]
+@ CHECK: ldrb r2, [r7], #-19 @ encoding: [0x13,0x20,0x57,0xe4]
+
+
+ at ------------------------------------------------------------------------------
+@ LDRB (register)
+ at ------------------------------------------------------------------------------
+ ldr r9, [r8, r5]
+ ldr r1, [r5, -r1]
+ ldr r3, [r5, r2]!
+ ldr r6, [r9, -r3]!
+ ldr r2, [r1], r4
+ ldr r8, [r4], -r5
+ ldr r7, [r12, -r1, lsl #15]
+ ldr r5, [r2], r9, asr #15
+
+@ CHECK: ldr r9, [r8, r5] @ encoding: [0x05,0x90,0x98,0xe7]
+@ CHECK: ldr r1, [r5, -r1] @ encoding: [0x01,0x10,0x15,0xe7]
+@ CHECK: ldr r3, [r5, r2]! @ encoding: [0x02,0x30,0xb5,0xe7]
+@ CHECK: ldr r6, [r9, -r3]! @ encoding: [0x03,0x60,0x39,0xe7]
+@ CHECK: ldr r2, [r1], r4 @ encoding: [0x04,0x20,0x91,0xe6]
+@ CHECK: ldr r8, [r4], -r5 @ encoding: [0x05,0x80,0x14,0xe6]
+@ CHECK: ldr r7, [r12, -r1, lsl #15] @ encoding: [0x81,0x77,0x1c,0xe7]
+@ CHECK: ldr r5, [r2], r9, asr #15 @ encoding: [0xc9,0x57,0x92,0xe6]
From echristo at apple.com Mon Aug 8 18:01:28 2011
From: echristo at apple.com (Eric Christopher)
Date: Mon, 08 Aug 2011 16:01:28 -0700
Subject: [llvm-commits] [RFC] Adding PassManagerBuilder to the C API
In-Reply-To: <4E34BB0D.1050809@gmail.com>
References: <4E34BB0D.1050809@gmail.com>
Message-ID: <6F803DE5-8DA2-43F5-8442-58CBE280E4A0@apple.com>
>
> If people agree this is the best way, I will finish up the patch and
> send it for review. If you have a better idea, let me know :-)
This doesn't appear to be any worse than the current mechanism. :)
-eric
From isanbard at gmail.com Mon Aug 8 18:01:11 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 08 Aug 2011 23:01:11 -0000
Subject: [llvm-commits] [llvm] r137072 -
/llvm/trunk/lib/VMCore/PassManager.cpp
Message-ID: <20110808230111.3D8A22A6C12C@llvm.org>
Author: void
Date: Mon Aug 8 18:01:10 2011
New Revision: 137072
URL: http://llvm.org/viewvc/llvm-project?rev=137072&view=rev
Log:
Indicate that there are changes if runOfFunction returns saying that there are.
Patch by Jingyue!
Modified:
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=137072&r1=137071&r2=137072&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Aug 8 18:01:10 2011
@@ -1532,7 +1532,7 @@
bool Changed = doInitialization(M);
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- runOnFunction(*I);
+ Changed |= runOnFunction(*I);
return doFinalization(M) || Changed;
}
From resistor at mac.com Mon Aug 8 18:25:22 2011
From: resistor at mac.com (Owen Anderson)
Date: Mon, 08 Aug 2011 23:25:22 -0000
Subject: [llvm-commits] [llvm] r137073 -
/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
Message-ID: <20110808232522.DD4392A6C12C@llvm.org>
Author: resistor
Date: Mon Aug 8 18:25:22 2011
New Revision: 137073
URL: http://llvm.org/viewvc/llvm-project?rev=137073&view=rev
Log:
Thumb1 BL instructions encoding 22 bits of displacement, not 21.
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=137073&r1=137072&r2=137073&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Aug 8 18:25:22 2011
@@ -94,6 +94,7 @@
def t_bltarget : Operand {
let EncoderMethod = "getThumbBLTargetOpValue";
+ let DecoderMethod = "DecodeThumbBLTargetOperand";
}
def t_blxtarget : Operand {
@@ -168,6 +169,7 @@
def t_addrmode_sp : Operand,
ComplexPattern {
let EncoderMethod = "getAddrModeThumbSPOpValue";
+ let DecoderMethod = "DecodeThumbAddrModeSP";
let PrintMethod = "printThumbAddrModeSPOperand";
let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm);
}
@@ -374,7 +376,8 @@
"bl${p}\t$func",
[(ARMtcall tglobaladdr:$func)]>,
Requires<[IsThumb, IsNotDarwin]> {
- bits<21> func;
+ bits<22> func;
+ let Inst{26} = func{21};
let Inst{25-16} = func{20-11};
let Inst{13} = 1;
let Inst{11} = 1;
From grosbach at apple.com Mon Aug 8 18:28:47 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 08 Aug 2011 23:28:47 -0000
Subject: [llvm-commits] [llvm] r137074 - in /llvm/trunk:
lib/Target/ARM/ARMInstrInfo.td test/MC/ARM/arm-memory-instructions.s
Message-ID: <20110808232847.4390E2A6C12C@llvm.org>
Author: grosbach
Date: Mon Aug 8 18:28:47 2011
New Revision: 137074
URL: http://llvm.org/viewvc/llvm-project?rev=137074&view=rev
Log:
ARM parsing and encoding for LDRBT instruction.
Fix the instruction representation to correctly only allow post-indexed form.
Add tests.
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
llvm/trunk/test/MC/ARM/arm-memory-instructions.s
Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=137074&r1=137073&r2=137074&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Aug 8 18:28:47 2011
@@ -2034,20 +2034,37 @@
let Inst{11-0} = addr{11-0};
let AsmMatchConverter = "cvtLdWriteBackRegAddrMode2";
}
-def LDRBT : AI2ldstidx<1, 1, 0, (outs GPR:$Rt, GPR:$base_wb),
- (ins addrmode2:$addr), IndexModePost, LdFrm, IIC_iLoad_bh_ru,
- "ldrbt", "\t$Rt, $addr", "$addr.base = $base_wb", []> {
- // {17-14} Rn
- // {13} 1 == Rm, 0 == imm12
+
+def LDRBT_POST_REG : AI2ldstidx<1, 1, 0, (outs GPR:$Rt, GPR:$Rn_wb),
+ (ins addr_offset_none:$addr, am2offset_reg:$offset),
+ IndexModePost, LdFrm, IIC_iLoad_bh_ru,
+ "ldrbt", "\t$Rt, $addr, $offset",
+ "$addr.base = $Rn_wb", []> {
// {12} isAdd
// {11-0} imm12/Rm
- bits<18> addr;
- let Inst{25} = addr{13};
- let Inst{23} = addr{12};
+ bits<14> offset;
+ bits<4> addr;
+ let Inst{25} = 1;
+ let Inst{23} = offset{12};
let Inst{21} = 1; // overwrite
- let Inst{19-16} = addr{17-14};
- let Inst{11-0} = addr{11-0};
- let AsmMatchConverter = "cvtLdWriteBackRegAddrMode2";
+ let Inst{19-16} = addr;
+ let Inst{11-0} = offset{11-0};
+}
+
+def LDRBT_POST_IMM : AI2ldstidx<1, 1, 0, (outs GPR:$Rt, GPR:$Rn_wb),
+ (ins addr_offset_none:$addr, am2offset_imm:$offset),
+ IndexModePost, LdFrm, IIC_iLoad_bh_ru,
+ "ldrbt", "\t$Rt, $addr, $offset",
+ "$addr.base = $Rn_wb", []> {
+ // {12} isAdd
+ // {11-0} imm12/Rm
+ bits<14> offset;
+ bits<4> addr;
+ let Inst{25} = 0;
+ let Inst{23} = offset{12};
+ let Inst{21} = 1; // overwrite
+ let Inst{19-16} = addr;
+ let Inst{11-0} = offset{11-0};
}
multiclass AI3ldrT op, string opc> {
Modified: llvm/trunk/test/MC/ARM/arm-memory-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm-memory-instructions.s?rev=137074&r1=137073&r2=137074&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/arm-memory-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/arm-memory-instructions.s Mon Aug 8 18:28:47 2011
@@ -89,3 +89,19 @@
@ CHECK: ldr r8, [r4], -r5 @ encoding: [0x05,0x80,0x14,0xe6]
@ CHECK: ldr r7, [r12, -r1, lsl #15] @ encoding: [0x81,0x77,0x1c,0xe7]
@ CHECK: ldr r5, [r2], r9, asr #15 @ encoding: [0xc9,0x57,0x92,0xe6]
+
+
+ at ------------------------------------------------------------------------------
+@ LDRBT
+ at ------------------------------------------------------------------------------
+@ FIXME: Optional offset operand.
+ ldrbt r3, [r1], #4
+ ldrbt r2, [r8], #-8
+ ldrbt r8, [r7], r6
+ ldrbt r1, [r2], -r6, lsl #12
+
+
+@ CHECK: ldrbt r3, [r1], #4 @ encoding: [0x04,0x30,0xf1,0xe4]
+@ CHECK: ldrbt r2, [r8], #-8 @ encoding: [0x08,0x20,0x78,0xe4]
+@ CHECK: ldrbt r8, [r7], r6 @ encoding: [0x06,0x80,0xf7,0xe6]
+@ CHECK: ldrbt r1, [r2], -r6, lsl #12 @ encoding: [0x06,0x16,0x72,0xe6]
From aggarwa4 at illinois.edu Mon Aug 8 18:48:15 2011
From: aggarwa4 at illinois.edu (Arushi Aggarwal)
Date: Mon, 08 Aug 2011 23:48:15 -0000
Subject: [llvm-commits] [poolalloc] r137076 -
/poolalloc/trunk/lib/AssistDS/ArgCast.cpp
Message-ID: <20110808234815.6D1192A6C12C@llvm.org>
Author: aggarwa4
Date: Mon Aug 8 18:48:15 2011
New Revision: 137076
URL: http://llvm.org/viewvc/llvm-project?rev=137076&view=rev
Log:
Allow file to compile with mainline.
Modified:
poolalloc/trunk/lib/AssistDS/ArgCast.cpp
Modified: poolalloc/trunk/lib/AssistDS/ArgCast.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/ArgCast.cpp?rev=137076&r1=137075&r2=137076&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/ArgCast.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/ArgCast.cpp Mon Aug 8 18:48:15 2011
@@ -58,7 +58,7 @@
// Find all uses of this function
for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); ui != ue; ) {
// check if is ever casted to a different function type
- ConstantExpr *CE = dyn_cast(ui++);
+ ConstantExpr *CE = dyn_cast(*ui++);
if(!CE)
continue;
if (CE->getOpcode() != Instruction::BitCast)
@@ -82,7 +82,7 @@
uee = CE->use_end(); uii != uee; ++uii) {
// Find all uses of the casted value, and check if it is
// used in a Call Instruction
- if (CallInst* CI = dyn_cast(uii)) {
+ if (CallInst* CI = dyn_cast(*uii)) {
// Check that it is the called value, and not an argument
if(CI->getCalledValue() != CE)
continue;
@@ -113,8 +113,8 @@
SmallVector Args;
unsigned i =0;
for(i =0; i< FTy->getNumParams(); ++i) {
- const Type *ArgType = CI->getOperand(i+1)->getType();
- const Type *FormalType = FTy->getParamType(i);
+ Type *ArgType = CI->getOperand(i+1)->getType();
+ Type *FormalType = FTy->getParamType(i);
// If the types for this argument match, just add it to the
// parameter list. No cast needs to be inserted.
if(ArgType == FormalType) {
@@ -171,7 +171,7 @@
}
// else replace the call instruction
- CallInst *CINew = CallInst::Create(F, Args.begin(), Args.end(), "", CI);
+ CallInst *CINew = CallInst::Create(F, Args, "", CI);
CINew->setCallingConv(CI->getCallingConv());
CINew->setAttributes(CI->getAttributes());
if(!CI->use_empty()) {
From aggarwa4 at illinois.edu Mon Aug 8 19:18:22 2011
From: aggarwa4 at illinois.edu (Arushi Aggarwal)
Date: Tue, 09 Aug 2011 00:18:22 -0000
Subject: [llvm-commits] [poolalloc] r137079 - in /poolalloc/trunk:
include/assistDS/ArgCast.h include/assistDS/Devirt.h
include/assistDS/FuncSimplify.h include/assistDS/FuncSpec.h
lib/AssistDS/Devirt.cpp lib/AssistDS/DynCount.cpp lib/AssistDS/FuncSpec.cpp
Message-ID: <20110809001822.D62302A6C12C@llvm.org>
Author: aggarwa4
Date: Mon Aug 8 19:18:22 2011
New Revision: 137079
URL: http://llvm.org/viewvc/llvm-project?rev=137079&view=rev
Log:
Changes to compile with mainline llvm
Modified:
poolalloc/trunk/include/assistDS/ArgCast.h
poolalloc/trunk/include/assistDS/Devirt.h
poolalloc/trunk/include/assistDS/FuncSimplify.h
poolalloc/trunk/include/assistDS/FuncSpec.h
poolalloc/trunk/lib/AssistDS/Devirt.cpp
poolalloc/trunk/lib/AssistDS/DynCount.cpp
poolalloc/trunk/lib/AssistDS/FuncSpec.cpp
Modified: poolalloc/trunk/include/assistDS/ArgCast.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/ArgCast.h?rev=137079&r1=137078&r2=137079&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/ArgCast.h (original)
+++ poolalloc/trunk/include/assistDS/ArgCast.h Mon Aug 8 19:18:22 2011
@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Instructions.h"
+#include "llvm/Constants.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
@@ -27,7 +28,7 @@
class ArgCast : public ModulePass {
public:
static char ID;
- ArgCast() : ModulePass(&ID) {}
+ ArgCast() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/include/assistDS/Devirt.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/Devirt.h?rev=137079&r1=137078&r2=137079&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/Devirt.h (original)
+++ poolalloc/trunk/include/assistDS/Devirt.h Mon Aug 8 19:18:22 2011
@@ -57,7 +57,7 @@
public:
static char ID;
- Devirtualize() : ModulePass(&ID), CTF(0) {}
+ Devirtualize() : ModulePass(ID), CTF(0) {}
virtual bool runOnModule(Module & M);
Modified: poolalloc/trunk/include/assistDS/FuncSimplify.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/FuncSimplify.h?rev=137079&r1=137078&r2=137079&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/FuncSimplify.h (original)
+++ poolalloc/trunk/include/assistDS/FuncSimplify.h Mon Aug 8 19:18:22 2011
@@ -23,7 +23,7 @@
class FuncSimplify : public ModulePass {
public:
static char ID;
- FuncSimplify() : ModulePass(&ID) {}
+ FuncSimplify() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/include/assistDS/FuncSpec.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/FuncSpec.h?rev=137079&r1=137078&r2=137079&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/FuncSpec.h (original)
+++ poolalloc/trunk/include/assistDS/FuncSpec.h Mon Aug 8 19:18:22 2011
@@ -28,7 +28,7 @@
class FuncSpec : public ModulePass {
public:
static char ID;
- FuncSpec() : ModulePass(&ID) {}
+ FuncSpec() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/lib/AssistDS/Devirt.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/Devirt.cpp?rev=137079&r1=137078&r2=137079&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/Devirt.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/Devirt.cpp Mon Aug 8 19:18:22 2011
@@ -42,7 +42,7 @@
//
static inline
PointerType * getVoidPtrType (LLVMContext & C) {
- const Type * Int8Type = IntegerType::getInt8Ty(C);
+ Type * Int8Type = IntegerType::getInt8Ty(C);
return PointerType::getUnqual(Int8Type);
}
@@ -53,7 +53,7 @@
// Given an LLVM value, insert a cast instruction to make it a given type.
//
static inline Value *
-castTo (Value * V, const Type * Ty, std::string Name, Instruction * InsertPt) {
+castTo (Value * V, Type * Ty, std::string Name, Instruction * InsertPt) {
//
// Don't bother creating a cast if it's already the correct type.
//
@@ -147,7 +147,7 @@
// will be the function to call.
//
Value* ptr = CS.getCalledValue();
- std::vector TP;
+ std::vector TP;
TP.insert (TP.begin(), ptr->getType());
for (CallSite::arg_iterator i = CS.arg_begin();
i != CS.arg_end();
@@ -155,7 +155,7 @@
TP.push_back ((*i)->getType());
}
- const FunctionType* NewTy = FunctionType::get(CS.getType(), TP, false);
+ FunctionType* NewTy = FunctionType::get(CS.getType(), TP, false);
Module * M = CS.getInstruction()->getParent()->getParent()->getParent();
Function* F = Function::Create (NewTy,
GlobalValue::InternalLinkage,
@@ -193,8 +193,7 @@
targets[FL] = BL;
// Create the direct function call
Value* directCall = CallInst::Create ((Value *)FL,
- fargs.begin(),
- fargs.end(),
+ fargs,
"",
BL);
@@ -224,7 +223,7 @@
// Create basic blocks which will test the value of the incoming function
// pointer and branch to the appropriate basic block to call the function.
//
- const Type * VoidPtrType = getVoidPtrType (M->getContext());
+ Type * VoidPtrType = getVoidPtrType (M->getContext());
Value * FArg = castTo (F->arg_begin(), VoidPtrType, "", InsertPt);
BasicBlock * tailBB = failBB;
for (unsigned index = 0; index < Targets.size(); ++index) {
@@ -265,8 +264,9 @@
//
// Make the entry basic block branch to the first comparison basic block.
//
- InsertPt->setUnconditionalDest (tailBB);
-
+ //InsertPt->setUnconditionalDest (tailBB);
+ InsertPt->setSuccessor(0, tailBB);
+ InsertPt->setSuccessor(1, tailBB);
//
// Return the newly created bounce function.
//
@@ -323,8 +323,7 @@
std::vector Params (CI->op_begin(), CI->op_end());
std::string name = CI->hasName() ? CI->getNameStr() + ".dv" : "";
CallInst* CN = CallInst::Create ((Value *) NF,
- Params.begin(),
- Params.end(),
+ Params,
name,
CI);
CI->replaceAllUsesWith(CN);
@@ -335,8 +334,7 @@
InvokeInst* CN = InvokeInst::Create((Value *) NF,
CI->getNormalDest(),
CI->getUnwindDest(),
- Params.begin(),
- Params.end(),
+ Params,
name,
CI);
CI->replaceAllUsesWith(CN);
Modified: poolalloc/trunk/lib/AssistDS/DynCount.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/DynCount.cpp?rev=137079&r1=137078&r2=137079&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/DynCount.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/DynCount.cpp Mon Aug 8 19:18:22 2011
@@ -15,6 +15,7 @@
#include "llvm/Pass.h"
#include "llvm/Module.h"
#include "llvm/Instructions.h"
+#include "llvm/Constants.h"
#include "llvm/Target/TargetData.h"
#include "dsa/TypeSafety.h"
@@ -27,7 +28,7 @@
public:
static char ID;
- Dyncount () : ModulePass ((intptr_t) &ID) { }
+ Dyncount () : ModulePass (ID) { }
const char *getPassName() const {
return "Count safe/unsafe load/store";
}
@@ -132,7 +133,7 @@
std::vector args;
args.push_back (Total);
args.push_back (Safe);
- CallInst::Create (Setup, args.begin(), args.end(), "", BB.getFirstNonPHI());
+ CallInst::Create (Setup, args, "", BB.getFirstNonPHI());
return true;
Modified: poolalloc/trunk/lib/AssistDS/FuncSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/FuncSpec.cpp?rev=137079&r1=137078&r2=137079&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/FuncSpec.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/FuncSpec.cpp Mon Aug 8 19:18:22 2011
@@ -71,7 +71,7 @@
// Now find all call sites that it is called from
for(Value::use_iterator ui = I->use_begin(), ue = I->use_end();
ui != ue; ++ui) {
- if (CallInst* CI = dyn_cast(ui)) {
+ if (CallInst* CI = dyn_cast(*ui)) {
// Check that it is the called value (and not an argument)
if(CI->getCalledValue()->stripPointerCasts() == I) {
std::vector > Consts;
From stoklund at 2pi.dk Mon Aug 8 19:29:53 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Tue, 09 Aug 2011 00:29:53 -0000
Subject: [llvm-commits] [llvm] r137082 - in /llvm/trunk:
include/llvm/CodeGen/Passes.h lib/CodeGen/RegAllocBasic.cpp
lib/CodeGen/RegAllocGreedy.cpp lib/CodeGen/RegAllocLinearScan.cpp
lib/CodeGen/RegAllocPBQP.cpp lib/CodeGen/RegisterCoalescer.cpp
lib/CodeGen/Splitter.cpp
Message-ID: <20110809002953.60B832A6C12C@llvm.org>
Author: stoklund
Date: Mon Aug 8 19:29:53 2011
New Revision: 137082
URL: http://llvm.org/viewvc/llvm-project?rev=137082&view=rev
Log:
Refer to the RegisterCoalescer pass by ID.
A public interface is no longer needed since RegisterCoalescer is not an
analysis any more.
Modified:
llvm/trunk/include/llvm/CodeGen/Passes.h
llvm/trunk/lib/CodeGen/RegAllocBasic.cpp
llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
llvm/trunk/lib/CodeGen/Splitter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=137082&r1=137081&r2=137082&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Mon Aug 8 19:29:53 2011
@@ -24,7 +24,6 @@
class MachineFunctionPass;
class PassInfo;
class TargetLowering;
- class RegisterCoalescer;
class raw_ostream;
/// createUnreachableBlockEliminationPass - The LLVM code generator does not
@@ -81,6 +80,9 @@
/// register allocators.
extern char &TwoAddressInstructionPassID;
+ /// RegisteCoalescer pass - This pass merges live ranges to eliminate copies.
+ extern char &RegisterCoalescerPassID;
+
/// SpillPlacement analysis. Suggest optimal placement of spill code between
/// basic blocks.
///
@@ -125,11 +127,6 @@
///
FunctionPass *createDefaultPBQPRegisterAllocator();
- /// RegisterCoalescer Pass - Coalesce all copies possible. Can run
- /// independently of the register allocator.
- ///
- RegisterCoalescer *createRegisterCoalescer();
-
/// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code,
/// and eliminates abstract frame references.
///
Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=137082&r1=137081&r2=137082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocBasic.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocBasic.cpp Mon Aug 8 19:29:53 2011
@@ -20,7 +20,6 @@
#include "RenderMachineFunction.h"
#include "Spiller.h"
#include "VirtRegMap.h"
-#include "RegisterCoalescer.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
@@ -160,7 +159,7 @@
AU.addPreserved();
if (StrongPHIElim)
AU.addRequiredID(StrongPHIEliminationID);
- AU.addRequiredTransitive();
+ AU.addRequiredTransitiveID(RegisterCoalescerPassID);
AU.addRequired();
AU.addRequired();
AU.addPreserved();
Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=137082&r1=137081&r2=137082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Mon Aug 8 19:29:53 2011
@@ -22,7 +22,6 @@
#include "SpillPlacement.h"
#include "SplitKit.h"
#include "VirtRegMap.h"
-#include "RegisterCoalescer.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Function.h"
@@ -324,7 +323,7 @@
AU.addPreserved();
if (StrongPHIElim)
AU.addRequiredID(StrongPHIEliminationID);
- AU.addRequiredTransitive();
+ AU.addRequiredTransitiveID(RegisterCoalescerPassID);
AU.addRequired();
AU.addRequired();
AU.addPreserved();
Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=137082&r1=137081&r2=137082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Mon Aug 8 19:29:53 2011
@@ -18,7 +18,6 @@
#include "VirtRegRewriter.h"
#include "RegisterClassInfo.h"
#include "Spiller.h"
-#include "RegisterCoalescer.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Function.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
@@ -209,7 +208,7 @@
AU.addRequiredID(StrongPHIEliminationID);
// Make sure PassManager knows which analyses to make available
// to coalescing and which analyses coalescing invalidates.
- AU.addRequiredTransitive();
+ AU.addRequiredTransitiveID(RegisterCoalescerPassID);
AU.addRequired();
AU.addRequiredID(LiveStacksID);
AU.addPreservedID(LiveStacksID);
Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=137082&r1=137081&r2=137082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Mon Aug 8 19:29:53 2011
@@ -450,7 +450,7 @@
au.addPreserved();
au.addRequired();
//au.addRequiredID(SplitCriticalEdgesID);
- au.addRequired();
+ au.addRequiredID(RegisterCoalescerPassID);
if (customPassID)
au.addRequiredID(*customPassID);
au.addRequired();
Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=137082&r1=137081&r2=137082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Mon Aug 8 19:29:53 2011
@@ -75,6 +75,8 @@
cl::desc("Verify machine instrs before and after register coalescing"),
cl::Hidden);
+char &llvm::RegisterCoalescerPassID = RegisterCoalescer::ID;
+
INITIALIZE_PASS_BEGIN(RegisterCoalescer, "simple-register-coalescing",
"Simple Register Coalescing", false, false)
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
@@ -1841,7 +1843,3 @@
void RegisterCoalescer::print(raw_ostream &O, const Module* m) const {
li_->print(O, m);
}
-
-RegisterCoalescer *llvm::createRegisterCoalescer() {
- return new RegisterCoalescer();
-}
Modified: llvm/trunk/lib/CodeGen/Splitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Splitter.cpp?rev=137082&r1=137081&r2=137082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Splitter.cpp (original)
+++ llvm/trunk/lib/CodeGen/Splitter.cpp Mon Aug 8 19:29:53 2011
@@ -11,7 +11,6 @@
#include "Splitter.h"
-#include "RegisterCoalescer.h"
#include "llvm/Module.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
@@ -20,6 +19,7 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -262,7 +262,7 @@
au.addPreserved();
au.addRequired();
au.addPreserved();
- au.addPreserved();
+ au.addPreservedID(RegisterCoalescerPassID);
au.addPreserved();
au.addPreserved();
au.addRequired();
From aggarwa4 at illinois.edu Mon Aug 8 19:31:04 2011
From: aggarwa4 at illinois.edu (Arushi Aggarwal)
Date: Tue, 09 Aug 2011 00:31:04 -0000
Subject: [llvm-commits] [poolalloc] r137083 - in /poolalloc/trunk:
include/assistDS/GEPExprArgs.h lib/AssistDS/GEPExprArgs.cpp
Message-ID: <20110809003104.3372C2A6C12C@llvm.org>
Author: aggarwa4
Date: Mon Aug 8 19:31:04 2011
New Revision: 137083
URL: http://llvm.org/viewvc/llvm-project?rev=137083&view=rev
Log:
Port to mainline
Modified:
poolalloc/trunk/include/assistDS/GEPExprArgs.h
poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp
Modified: poolalloc/trunk/include/assistDS/GEPExprArgs.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/GEPExprArgs.h?rev=137083&r1=137082&r2=137083&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/GEPExprArgs.h (original)
+++ poolalloc/trunk/include/assistDS/GEPExprArgs.h Mon Aug 8 19:31:04 2011
@@ -1,4 +1,4 @@
-//===-- GEPExprArg.cpp - Promote args if they come from GEPs -------------===//
+
//
// The LLVM Compiler Infrastructure
//
@@ -27,7 +27,7 @@
class GEPExprArgs : public ModulePass {
public:
static char ID;
- GEPExprArgs() : ModulePass(&ID) {}
+ GEPExprArgs() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp?rev=137083&r1=137082&r2=137083&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp Mon Aug 8 19:31:04 2011
@@ -14,9 +14,11 @@
#include "assistDS/GEPExprArgs.h"
#include "llvm/Constants.h"
+#include "llvm/Operator.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/ValueMap.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Debug.h"
#include "llvm/Use.h"
@@ -89,14 +91,14 @@
// Construct the new Type
// Appends the struct Type at the beginning
- std::vectorTP;
+ std::vectorTP;
TP.push_back(GEP->getPointerOperand()->getType());
for(unsigned c = 1; c < CI->getNumOperands();c++) {
TP.push_back(CI->getOperand(c)->getType());
}
//return type is same as that of original instruction
- const FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false);
+ FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false);
Function *NewF;
numSimplified++;
if(numSimplified > 800)
@@ -111,7 +113,7 @@
NI->setName("GEParg");
++NI;
- DenseMap ValueMap;
+ ValueToValueMapTy ValueMap;
for (Function::arg_iterator II = F->arg_begin(); NI != NewF->arg_end(); ++II, ++NI) {
ValueMap[II] = NI;
@@ -122,7 +124,7 @@
0, F->getAttributes().getRetAttributes()));
// Perform the cloning.
SmallVector Returns;
- CloneFunctionInto(NewF, F, ValueMap, Returns);
+ CloneFunctionInto(NewF, F, ValueMap, false, Returns);
std::vector fargs;
for(Function::arg_iterator ai = NewF->arg_begin(),
ae= NewF->arg_end(); ai != ae; ++ai) {
@@ -141,8 +143,7 @@
SmallVector Indices;
Indices.append(GEP->op_begin()+1, GEP->op_end());
GetElementPtrInst *GEP_new = GetElementPtrInst::Create(cast(NI),
- Indices.begin(),
- Indices.end(),
+ Indices,
"", InsertPoint);
fargs.at(argNum)->replaceAllUsesWith(GEP_new);
unsigned j = argNum + 1;
@@ -175,7 +176,7 @@
AttrListPtr NewCallPAL = AttrListPtr::get(AttributesVec.begin(),
AttributesVec.end());
- CallInst *CallI = CallInst::Create(NewF,Args.begin(), Args.end(),"", CI);
+ CallInst *CallI = CallInst::Create(NewF,Args,"", CI);
CallI->setCallingConv(CI->getCallingConv());
CallI->setAttributes(NewCallPAL);
CI->replaceAllUsesWith(CallI);
From gohman at apple.com Mon Aug 8 19:33:12 2011
From: gohman at apple.com (Dan Gohman)
Date: Tue, 09 Aug 2011 00:33:12 -0000
Subject: [llvm-commits] [llvm] r137085 -
/llvm/trunk/test/Transforms/ObjCARC/cfg-hazards.ll
Message-ID: <20110809003312.2C0842A6C12C@llvm.org>
Author: djg
Date: Mon Aug 8 19:33:11 2011
New Revision: 137085
URL: http://llvm.org/viewvc/llvm-project?rev=137085&view=rev
Log:
Tidy up these testcases to look more like real code does.
Modified:
llvm/trunk/test/Transforms/ObjCARC/cfg-hazards.ll
Modified: llvm/trunk/test/Transforms/ObjCARC/cfg-hazards.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ObjCARC/cfg-hazards.ll?rev=137085&r1=137084&r2=137085&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ObjCARC/cfg-hazards.ll (original)
+++ llvm/trunk/test/Transforms/ObjCARC/cfg-hazards.ll Mon Aug 8 19:33:11 2011
@@ -18,18 +18,18 @@
define void @test0(i8* %digits) {
entry:
%tmp1 = call i8* @objc_retain(i8* %digits) nounwind
- call void @use_pointer(i8* %tmp1)
+ call void @use_pointer(i8* %digits)
br label %for.body
for.body: ; preds = %for.body, %entry
%upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ]
- call void @use_pointer(i8* %tmp1)
+ call void @use_pointer(i8* %digits)
%inc = add i64 %upcDigitIndex.01, 1
%cmp = icmp ult i64 %inc, 12
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
- call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0
+ call void @objc_release(i8* %digits) nounwind, !clang.imprecise_release !0
ret void
}
@@ -47,14 +47,14 @@
for.body: ; preds = %for.body, %entry
%upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ]
- call void @use_pointer(i8* %tmp1)
- call void @use_pointer(i8* %tmp1)
+ call void @use_pointer(i8* %digits)
+ call void @use_pointer(i8* %digits)
%inc = add i64 %upcDigitIndex.01, 1
%cmp = icmp ult i64 %inc, 12
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
- call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0
+ call void @objc_release(i8* %digits) nounwind, !clang.imprecise_release !0
ret void
}
@@ -72,14 +72,14 @@
for.body: ; preds = %for.body, %entry
%upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ]
- call void @use_pointer(i8* %tmp1)
+ call void @use_pointer(i8* %digits)
%inc = add i64 %upcDigitIndex.01, 1
%cmp = icmp ult i64 %inc, 12
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
- call void @use_pointer(i8* %tmp1)
- call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0
+ call void @use_pointer(i8* %digits)
+ call void @objc_release(i8* %digits) nounwind, !clang.imprecise_release !0
ret void
}
From aggarwa4 at illinois.edu Mon Aug 8 19:38:50 2011
From: aggarwa4 at illinois.edu (Arushi Aggarwal)
Date: Tue, 09 Aug 2011 00:38:50 -0000
Subject: [llvm-commits] [poolalloc] r137087 - in /poolalloc/trunk:
include/assistDS/IndCloner.h include/assistDS/Int2PtrCmp.h
include/assistDS/LoadArgs.h include/assistDS/MergeGEP.h
lib/AssistDS/IndCloner.cpp lib/AssistDS/LoadArgs.cpp
lib/AssistDS/MergeGEP.cpp
Message-ID: <20110809003850.53C552A6C12C@llvm.org>
Author: aggarwa4
Date: Mon Aug 8 19:38:50 2011
New Revision: 137087
URL: http://llvm.org/viewvc/llvm-project?rev=137087&view=rev
Log:
Changes to compile with mainline
Modified:
poolalloc/trunk/include/assistDS/IndCloner.h
poolalloc/trunk/include/assistDS/Int2PtrCmp.h
poolalloc/trunk/include/assistDS/LoadArgs.h
poolalloc/trunk/include/assistDS/MergeGEP.h
poolalloc/trunk/lib/AssistDS/IndCloner.cpp
poolalloc/trunk/lib/AssistDS/LoadArgs.cpp
poolalloc/trunk/lib/AssistDS/MergeGEP.cpp
Modified: poolalloc/trunk/include/assistDS/IndCloner.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/IndCloner.h?rev=137087&r1=137086&r2=137087&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/IndCloner.h (original)
+++ poolalloc/trunk/include/assistDS/IndCloner.h Mon Aug 8 19:38:50 2011
@@ -27,7 +27,7 @@
class IndClone : public ModulePass {
public:
static char ID;
- IndClone() : ModulePass(&ID) {}
+ IndClone() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/include/assistDS/Int2PtrCmp.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/Int2PtrCmp.h?rev=137087&r1=137086&r2=137087&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/Int2PtrCmp.h (original)
+++ poolalloc/trunk/include/assistDS/Int2PtrCmp.h Mon Aug 8 19:38:50 2011
@@ -29,7 +29,7 @@
TargetData * TD;
public:
static char ID;
- Int2PtrCmp() : ModulePass(&ID) {}
+ Int2PtrCmp() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired();
Modified: poolalloc/trunk/include/assistDS/LoadArgs.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/LoadArgs.h?rev=137087&r1=137086&r2=137087&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/LoadArgs.h (original)
+++ poolalloc/trunk/include/assistDS/LoadArgs.h Mon Aug 8 19:38:50 2011
@@ -29,7 +29,7 @@
class LoadArgs : public ModulePass {
public:
static char ID;
- LoadArgs() : ModulePass(&ID) {}
+ LoadArgs() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/include/assistDS/MergeGEP.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/MergeGEP.h?rev=137087&r1=137086&r2=137087&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/MergeGEP.h (original)
+++ poolalloc/trunk/include/assistDS/MergeGEP.h Mon Aug 8 19:38:50 2011
@@ -23,7 +23,7 @@
class MergeArrayGEP : public ModulePass {
public:
static char ID;
- MergeArrayGEP() : ModulePass(&ID) {}
+ MergeArrayGEP() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/lib/AssistDS/IndCloner.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/IndCloner.cpp?rev=137087&r1=137086&r2=137087&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/IndCloner.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/IndCloner.cpp Mon Aug 8 19:38:50 2011
@@ -73,7 +73,7 @@
if (!I->isDeclaration() && !I->mayBeOverridden()) {
for (Value::use_iterator ui = I->use_begin(), ue = I->use_end();
ui != ue; ++ui) {
- if (!isa(ui) && !isa(ui)) {
+ if (!isa(*ui) && !isa(*ui)) {
if(!ui->use_empty())
//
// If this function is used for anything other than a direct function
@@ -148,7 +148,7 @@
for (Value::use_iterator ui = Original->use_begin(),
ue = Original->use_end();
ui != ue; ) {
- CallInst *CI = dyn_cast(ui);
+ CallInst *CI = dyn_cast(*ui);
ui++;
if (CI) {
if (CI->getOperand(0) == Original) {
Modified: poolalloc/trunk/lib/AssistDS/LoadArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/LoadArgs.cpp?rev=137087&r1=137086&r2=137087&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/LoadArgs.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/LoadArgs.cpp Mon Aug 8 19:38:50 2011
@@ -19,6 +19,7 @@
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/ValueMap.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Debug.h"
#include "llvm/Use.h"
@@ -118,7 +119,7 @@
// Construct the new Type
// Appends the struct Type at the beginning
- std::vectorTP;
+ std::vectorTP;
for(unsigned c = 1; c < CI->getNumOperands();c++) {
if(c == argNum)
TP.push_back(LI->getOperand(0)->getType());
@@ -126,7 +127,7 @@
}
//return type is same as that of original instruction
- const FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false);
+ FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false);
numSimplified++;
//if(numSimplified > 1000)
//return true;
@@ -145,7 +146,7 @@
fnCache[std::make_pair(F, NewFTy)] = NewF;
Function::arg_iterator NI = NewF->arg_begin();
- DenseMap ValueMap;
+ ValueToValueMapTy ValueMap;
unsigned count = 1;
for (Function::arg_iterator II = F->arg_begin(); NI != NewF->arg_end(); ++count, ++NI) {
@@ -160,7 +161,7 @@
}
// Perform the cloning.
SmallVector Returns;
- CloneFunctionInto(NewF, F, ValueMap, Returns);
+ CloneFunctionInto(NewF, F, ValueMap, false, Returns);
std::vector fargs;
for(Function::arg_iterator ai = NewF->arg_begin(),
ae= NewF->arg_end(); ai != ae; ++ai) {
@@ -202,7 +203,7 @@
AttrListPtr NewCallPAL = AttrListPtr::get(AttributesVec.begin(),
AttributesVec.end());
- CallInst *CallI = CallInst::Create(NewF,Args.begin(), Args.end(),"", CI);
+ CallInst *CallI = CallInst::Create(NewF,Args,"", CI);
CallI->setCallingConv(CI->getCallingConv());
CallI->setAttributes(NewCallPAL);
CI->replaceAllUsesWith(CallI);
Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=137087&r1=137086&r2=137087&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Mon Aug 8 19:38:50 2011
@@ -14,6 +14,7 @@
#include "assistDS/MergeGEP.h"
#include "llvm/Instructions.h"
+#include "llvm/Operator.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Instructions.h"
@@ -140,10 +141,10 @@
if (!Indices.empty()){
GetElementPtrInst *GEPNew = (GEP->isInBounds() && Src->isInBounds()) ?
- GetElementPtrInst::CreateInBounds(Src->getOperand(0), Indices.begin(),
- Indices.end(), GEP->getName(), GEP) :
- GetElementPtrInst::Create(Src->getOperand(0), Indices.begin(),
- Indices.end(), GEP->getName(), GEP);
+ GetElementPtrInst::CreateInBounds(Src->getOperand(0), Indices,
+ GEP->getName(), GEP) :
+ GetElementPtrInst::Create(Src->getOperand(0), Indices,
+ GEP->getName(), GEP);
numMerged++;
GEP->replaceAllUsesWith(GEPNew);
GEP->eraseFromParent();
From stoklund at 2pi.dk Mon Aug 8 19:43:37 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Tue, 09 Aug 2011 00:43:37 -0000
Subject: [llvm-commits] [llvm] r137088 - in /llvm/trunk/lib/CodeGen:
RegisterCoalescer.cpp RegisterCoalescer.h
Message-ID: <20110809004337.327382A6C12C@llvm.org>
Author: stoklund
Date: Mon Aug 8 19:43:37 2011
New Revision: 137088
URL: http://llvm.org/viewvc/llvm-project?rev=137088&view=rev
Log:
Move the RegisterCoalescer private to its implementation file.
RegisterCoalescer.h still has the CoalescerPair class interface.
Modified:
llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
llvm/trunk/lib/CodeGen/RegisterCoalescer.h
Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=137088&r1=137087&r2=137088&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Mon Aug 8 19:43:37 2011
@@ -15,8 +15,9 @@
#define DEBUG_TYPE "regcoalescing"
#include "RegisterCoalescer.h"
-#include "VirtRegMap.h"
#include "LiveDebugVariables.h"
+#include "RegisterClassInfo.h"
+#include "VirtRegMap.h"
#include "llvm/Pass.h"
#include "llvm/Value.h"
@@ -75,6 +76,127 @@
cl::desc("Verify machine instrs before and after register coalescing"),
cl::Hidden);
+namespace {
+ class RegisterCoalescer : public MachineFunctionPass {
+ MachineFunction* mf_;
+ MachineRegisterInfo* mri_;
+ const TargetMachine* tm_;
+ const TargetRegisterInfo* tri_;
+ const TargetInstrInfo* tii_;
+ LiveIntervals *li_;
+ LiveDebugVariables *ldv_;
+ const MachineLoopInfo* loopInfo;
+ AliasAnalysis *AA;
+ RegisterClassInfo RegClassInfo;
+
+ /// JoinedCopies - Keep track of copies eliminated due to coalescing.
+ ///
+ SmallPtrSet JoinedCopies;
+
+ /// ReMatCopies - Keep track of copies eliminated due to remat.
+ ///
+ SmallPtrSet ReMatCopies;
+
+ /// ReMatDefs - Keep track of definition instructions which have
+ /// been remat'ed.
+ SmallPtrSet ReMatDefs;
+
+ /// joinIntervals - join compatible live intervals
+ void joinIntervals();
+
+ /// CopyCoalesceInMBB - Coalesce copies in the specified MBB, putting
+ /// copies that cannot yet be coalesced into the "TryAgain" list.
+ void CopyCoalesceInMBB(MachineBasicBlock *MBB,
+ std::vector &TryAgain);
+
+ /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg,
+ /// which are the src/dst of the copy instruction CopyMI. This returns
+ /// true if the copy was successfully coalesced away. If it is not
+ /// currently possible to coalesce this interval, but it may be possible if
+ /// other things get coalesced, then it returns true by reference in
+ /// 'Again'.
+ bool JoinCopy(MachineInstr *TheCopy, bool &Again);
+
+ /// JoinIntervals - Attempt to join these two intervals. On failure, this
+ /// returns false. The output "SrcInt" will not have been modified, so we
+ /// can use this information below to update aliases.
+ bool JoinIntervals(CoalescerPair &CP);
+
+ /// AdjustCopiesBackFrom - We found a non-trivially-coalescable copy. If
+ /// the source value number is defined by a copy from the destination reg
+ /// see if we can merge these two destination reg valno# into a single
+ /// value number, eliminating a copy.
+ bool AdjustCopiesBackFrom(const CoalescerPair &CP, MachineInstr *CopyMI);
+
+ /// HasOtherReachingDefs - Return true if there are definitions of IntB
+ /// other than BValNo val# that can reach uses of AValno val# of IntA.
+ bool HasOtherReachingDefs(LiveInterval &IntA, LiveInterval &IntB,
+ VNInfo *AValNo, VNInfo *BValNo);
+
+ /// RemoveCopyByCommutingDef - We found a non-trivially-coalescable copy.
+ /// If the source value number is defined by a commutable instruction and
+ /// its other operand is coalesced to the copy dest register, see if we
+ /// can transform the copy into a noop by commuting the definition.
+ bool RemoveCopyByCommutingDef(const CoalescerPair &CP,MachineInstr *CopyMI);
+
+ /// ReMaterializeTrivialDef - If the source of a copy is defined by a
+ /// trivial computation, replace the copy by rematerialize the definition.
+ /// If PreserveSrcInt is true, make sure SrcInt is valid after the call.
+ bool ReMaterializeTrivialDef(LiveInterval &SrcInt, bool PreserveSrcInt,
+ unsigned DstReg, unsigned DstSubIdx,
+ MachineInstr *CopyMI);
+
+ /// shouldJoinPhys - Return true if a physreg copy should be joined.
+ bool shouldJoinPhys(CoalescerPair &CP);
+
+ /// isWinToJoinCrossClass - Return true if it's profitable to coalesce
+ /// two virtual registers from different register classes.
+ bool isWinToJoinCrossClass(unsigned SrcReg,
+ unsigned DstReg,
+ const TargetRegisterClass *SrcRC,
+ const TargetRegisterClass *DstRC,
+ const TargetRegisterClass *NewRC);
+
+ /// UpdateRegDefsUses - Replace all defs and uses of SrcReg to DstReg and
+ /// update the subregister number if it is not zero. If DstReg is a
+ /// physical register and the existing subregister number of the def / use
+ /// being updated is not zero, make sure to set it to the correct physical
+ /// subregister.
+ void UpdateRegDefsUses(const CoalescerPair &CP);
+
+ /// RemoveDeadDef - If a def of a live interval is now determined dead,
+ /// remove the val# it defines. If the live interval becomes empty, remove
+ /// it as well.
+ bool RemoveDeadDef(LiveInterval &li, MachineInstr *DefMI);
+
+ /// RemoveCopyFlag - If DstReg is no longer defined by CopyMI, clear the
+ /// VNInfo copy flag for DstReg and all aliases.
+ void RemoveCopyFlag(unsigned DstReg, const MachineInstr *CopyMI);
+
+ /// markAsJoined - Remember that CopyMI has already been joined.
+ void markAsJoined(MachineInstr *CopyMI);
+
+ /// eliminateUndefCopy - Handle copies of undef values.
+ bool eliminateUndefCopy(MachineInstr *CopyMI, const CoalescerPair &CP);
+
+ public:
+ static char ID; // Class identification, replacement for typeinfo
+ RegisterCoalescer() : MachineFunctionPass(ID) {
+ initializeRegisterCoalescerPass(*PassRegistry::getPassRegistry());
+ }
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const;
+
+ virtual void releaseMemory();
+
+ /// runOnMachineFunction - pass entry point
+ virtual bool runOnMachineFunction(MachineFunction&);
+
+ /// print - Implement the dump method.
+ virtual void print(raw_ostream &O, const Module* = 0) const;
+ };
+} /// end anonymous namespace
+
char &llvm::RegisterCoalescerPassID = RegisterCoalescer::ID;
INITIALIZE_PASS_BEGIN(RegisterCoalescer, "simple-register-coalescing",
Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.h?rev=137088&r1=137087&r2=137088&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.h (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.h Mon Aug 8 19:43:37 2011
@@ -12,156 +12,15 @@
//
//===----------------------------------------------------------------------===//
-#include "RegisterClassInfo.h"
-#include "llvm/Support/IncludeFile.h"
-#include "llvm/CodeGen/LiveInterval.h"
-#include "llvm/ADT/SmallPtrSet.h"
-
#ifndef LLVM_CODEGEN_REGISTER_COALESCER_H
#define LLVM_CODEGEN_REGISTER_COALESCER_H
namespace llvm {
- class MachineFunction;
- class RegallocQuery;
- class AnalysisUsage;
class MachineInstr;
class TargetRegisterInfo;
class TargetRegisterClass;
class TargetInstrInfo;
- class LiveDebugVariables;
- class VirtRegMap;
- class MachineLoopInfo;
-
- class CoalescerPair;
-
- /// An abstract interface for register coalescers. Coalescers must
- /// implement this interface to be part of the coalescer analysis
- /// group.
- class RegisterCoalescer : public MachineFunctionPass {
- MachineFunction* mf_;
- MachineRegisterInfo* mri_;
- const TargetMachine* tm_;
- const TargetRegisterInfo* tri_;
- const TargetInstrInfo* tii_;
- LiveIntervals *li_;
- LiveDebugVariables *ldv_;
- const MachineLoopInfo* loopInfo;
- AliasAnalysis *AA;
- RegisterClassInfo RegClassInfo;
-
- /// JoinedCopies - Keep track of copies eliminated due to coalescing.
- ///
- SmallPtrSet JoinedCopies;
-
- /// ReMatCopies - Keep track of copies eliminated due to remat.
- ///
- SmallPtrSet ReMatCopies;
-
- /// ReMatDefs - Keep track of definition instructions which have
- /// been remat'ed.
- SmallPtrSet ReMatDefs;
-
- /// joinIntervals - join compatible live intervals
- void joinIntervals();
-
- /// CopyCoalesceInMBB - Coalesce copies in the specified MBB, putting
- /// copies that cannot yet be coalesced into the "TryAgain" list.
- void CopyCoalesceInMBB(MachineBasicBlock *MBB,
- std::vector &TryAgain);
-
- /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg,
- /// which are the src/dst of the copy instruction CopyMI. This returns true
- /// if the copy was successfully coalesced away. If it is not currently
- /// possible to coalesce this interval, but it may be possible if other
- /// things get coalesced, then it returns true by reference in 'Again'.
- bool JoinCopy(MachineInstr *TheCopy, bool &Again);
-
- /// JoinIntervals - Attempt to join these two intervals. On failure, this
- /// returns false. The output "SrcInt" will not have been modified, so we can
- /// use this information below to update aliases.
- bool JoinIntervals(CoalescerPair &CP);
-
- /// AdjustCopiesBackFrom - We found a non-trivially-coalescable copy. If
- /// the source value number is defined by a copy from the destination reg
- /// see if we can merge these two destination reg valno# into a single
- /// value number, eliminating a copy.
- bool AdjustCopiesBackFrom(const CoalescerPair &CP, MachineInstr *CopyMI);
-
- /// HasOtherReachingDefs - Return true if there are definitions of IntB
- /// other than BValNo val# that can reach uses of AValno val# of IntA.
- bool HasOtherReachingDefs(LiveInterval &IntA, LiveInterval &IntB,
- VNInfo *AValNo, VNInfo *BValNo);
-
- /// RemoveCopyByCommutingDef - We found a non-trivially-coalescable copy.
- /// If the source value number is defined by a commutable instruction and
- /// its other operand is coalesced to the copy dest register, see if we
- /// can transform the copy into a noop by commuting the definition.
- bool RemoveCopyByCommutingDef(const CoalescerPair &CP,MachineInstr *CopyMI);
-
- /// ReMaterializeTrivialDef - If the source of a copy is defined by a trivial
- /// computation, replace the copy by rematerialize the definition.
- /// If PreserveSrcInt is true, make sure SrcInt is valid after the call.
- bool ReMaterializeTrivialDef(LiveInterval &SrcInt, bool PreserveSrcInt,
- unsigned DstReg, unsigned DstSubIdx,
- MachineInstr *CopyMI);
-
- /// shouldJoinPhys - Return true if a physreg copy should be joined.
- bool shouldJoinPhys(CoalescerPair &CP);
-
- /// isWinToJoinCrossClass - Return true if it's profitable to coalesce
- /// two virtual registers from different register classes.
- bool isWinToJoinCrossClass(unsigned SrcReg,
- unsigned DstReg,
- const TargetRegisterClass *SrcRC,
- const TargetRegisterClass *DstRC,
- const TargetRegisterClass *NewRC);
-
- /// UpdateRegDefsUses - Replace all defs and uses of SrcReg to DstReg and
- /// update the subregister number if it is not zero. If DstReg is a
- /// physical register and the existing subregister number of the def / use
- /// being updated is not zero, make sure to set it to the correct physical
- /// subregister.
- void UpdateRegDefsUses(const CoalescerPair &CP);
-
- /// RemoveDeadDef - If a def of a live interval is now determined dead,
- /// remove the val# it defines. If the live interval becomes empty, remove
- /// it as well.
- bool RemoveDeadDef(LiveInterval &li, MachineInstr *DefMI);
-
- /// RemoveCopyFlag - If DstReg is no longer defined by CopyMI, clear the
- /// VNInfo copy flag for DstReg and all aliases.
- void RemoveCopyFlag(unsigned DstReg, const MachineInstr *CopyMI);
-
- /// markAsJoined - Remember that CopyMI has already been joined.
- void markAsJoined(MachineInstr *CopyMI);
-
- /// eliminateUndefCopy - Handle copies of undef values.
- bool eliminateUndefCopy(MachineInstr *CopyMI, const CoalescerPair &CP);
-
- public:
- static char ID; // Class identification, replacement for typeinfo
- RegisterCoalescer() : MachineFunctionPass(ID) {
- initializeRegisterCoalescerPass(*PassRegistry::getPassRegistry());
- }
-
- /// Register allocators must call this from their own
- /// getAnalysisUsage to cover the case where the coalescer is not
- /// a Pass in the proper sense and isn't managed by PassManager.
- /// PassManager needs to know which analyses to make available and
- /// which to invalidate when running the register allocator or any
- /// pass that might call coalescing. The long-term solution is to
- /// allow hierarchies of PassManagers.
- virtual void getAnalysisUsage(AnalysisUsage &AU) const;
-
- virtual void releaseMemory();
-
- /// runOnMachineFunction - pass entry point
- virtual bool runOnMachineFunction(MachineFunction&);
-
- /// print - Implement the dump method.
- virtual void print(raw_ostream &O, const Module* = 0) const;
- };
/// CoalescerPair - A helper class for register coalescers. When deciding if
/// two registers can be coalesced, CoalescerPair can determine if a copy
From aggarwa4 at illinois.edu Mon Aug 8 19:46:44 2011
From: aggarwa4 at illinois.edu (Arushi Aggarwal)
Date: Tue, 09 Aug 2011 00:46:44 -0000
Subject: [llvm-commits] [poolalloc] r137089 - in /poolalloc/trunk:
include/assistDS/SimplifyExtractValue.h
lib/AssistDS/SimplifyExtractValue.cpp
Message-ID: <20110809004644.523732A6C12C@llvm.org>
Author: aggarwa4
Date: Mon Aug 8 19:46:44 2011
New Revision: 137089
URL: http://llvm.org/viewvc/llvm-project?rev=137089&view=rev
Log:
Port to mainline
Modified:
poolalloc/trunk/include/assistDS/SimplifyExtractValue.h
poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp
Modified: poolalloc/trunk/include/assistDS/SimplifyExtractValue.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/SimplifyExtractValue.h?rev=137089&r1=137088&r2=137089&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/SimplifyExtractValue.h (original)
+++ poolalloc/trunk/include/assistDS/SimplifyExtractValue.h Mon Aug 8 19:46:44 2011
@@ -24,7 +24,7 @@
class SimplifyEV : public ModulePass {
public:
static char ID;
- SimplifyEV() : ModulePass(&ID) {}
+ SimplifyEV() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp?rev=137089&r1=137088&r2=137089&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp Mon Aug 8 19:46:44 2011
@@ -17,6 +17,7 @@
#include "assistDS/SimplifyExtractValue.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/PatternMatch.h"
@@ -98,8 +99,8 @@
// Extract the remaining indices out of the constant indexed by the
// first index
ExtractValueInst *EV_new = ExtractValueInst::Create(V,
- EV->idx_begin() + 1,
- EV->idx_end(), "", EV);
+ EV->getIndices().slice(1),
+ "", EV);
EV->replaceAllUsesWith(EV_new);
DEBUG(errs() << "EV:");
DEBUG(errs() << "ERASE:");
@@ -126,15 +127,15 @@
// replace the extract value intruction with
// a gep and a load.
SmallVector Indices;
- const Type *Int32Ty = Type::getInt32Ty(M.getContext());
+ Type *Int32Ty = Type::getInt32Ty(M.getContext());
Indices.push_back(Constant::getNullValue(Int32Ty));
for (ExtractValueInst::idx_iterator I = EV->idx_begin(), E = EV->idx_end();
I != E; ++I) {
Indices.push_back(ConstantInt::get(Int32Ty, *I));
}
- GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(LI->getOperand(0), Indices.begin(),
- Indices.end(), LI->getName(), LI) ;
+ GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(LI->getOperand(0), Indices,
+ LI->getName(), LI) ;
LoadInst *LINew = new LoadInst(GEP, "", LI);
EV->replaceAllUsesWith(LINew);
EV->eraseFromParent();
@@ -160,7 +161,7 @@
// with
// %E = extractvalue { i32, { i32 } } %A, 0
ExtractValueInst *EV_new = ExtractValueInst::Create(IV->getAggregateOperand(),
- EV->idx_begin(), EV->idx_end(),"", EV);
+ EV->getIndices(), "", EV);
EV->replaceAllUsesWith(EV_new);
DEBUG(errs() << "EV:");
DEBUG(errs() << "ERASE:");
@@ -198,9 +199,9 @@
// by switching the order of the insert and extract (though the
// insertvalue should be left in, since it may have other uses).
Value *NewEV = ExtractValueInst::Create(IV->getAggregateOperand(),
- EV->idx_begin(), EV->idx_end(), "", EV);
+ EV->getIndices(), "", EV);
Value *NewIV = InsertValueInst::Create(NewEV, IV->getInsertedValueOperand(),
- insi, inse, "", EV);
+ makeArrayRef(insi, inse), "", EV);
EV->replaceAllUsesWith(NewIV);
DEBUG(errs() << "EV:");
DEBUG(errs() << "ERASE:");
@@ -220,7 +221,7 @@
// with
// %E extractvalue { i32 } { i32 42 }, 0
ExtractValueInst *EV_new = ExtractValueInst::Create(IV->getInsertedValueOperand(),
- exti, exte,"", EV);
+ makeArrayRef(exti, exte), "", EV);
EV->replaceAllUsesWith(EV_new);
DEBUG(errs() << "EV:");
DEBUG(errs() << "ERASE:");
From bruno.cardoso at gmail.com Mon Aug 8 19:46:57 2011
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Tue, 09 Aug 2011 00:46:57 -0000
Subject: [llvm-commits] [llvm] r137090 - in /llvm/trunk:
lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrSSE.td
test/CodeGen/X86/avx-256-cmp.ll
Message-ID: <20110809004657.844782A6C12C@llvm.org>
Author: bruno
Date: Mon Aug 8 19:46:57 2011
New Revision: 137090
URL: http://llvm.org/viewvc/llvm-project?rev=137090&view=rev
Log:
Make LowerVSETCC aware of AVX types and add patterns to match them.
Added:
llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86InstrSSE.td
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=137090&r1=137089&r2=137090&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 8 19:46:57 2011
@@ -989,6 +989,9 @@
setOperationAction(ISD::SRA, MVT::v8i32, Custom);
setOperationAction(ISD::SRA, MVT::v16i16, Custom);
+ setOperationAction(ISD::VSETCC, MVT::v8i32, Custom);
+ setOperationAction(ISD::VSETCC, MVT::v4i64, Custom);
+
// Custom lower several nodes for 256-bit types.
for (unsigned i = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) {
@@ -7912,9 +7915,10 @@
if (isFP) {
unsigned SSECC = 8;
- EVT VT0 = Op0.getValueType();
- assert(VT0 == MVT::v4f32 || VT0 == MVT::v2f64);
- unsigned Opc = VT0 == MVT::v4f32 ? X86ISD::CMPPS : X86ISD::CMPPD;
+ EVT EltVT = Op0.getValueType().getVectorElementType();
+ assert(EltVT == MVT::f32 || EltVT == MVT::f64);
+
+ unsigned Opc = EltVT == MVT::f32 ? X86ISD::CMPPS : X86ISD::CMPPD;
bool Swap = false;
switch (SetCCOpcode) {
@@ -7961,6 +7965,9 @@
return DAG.getNode(Opc, dl, VT, Op0, Op1, DAG.getConstant(SSECC, MVT::i8));
}
+ if (!isFP && VT.getSizeInBits() == 256)
+ return SDValue();
+
// We are handling one of the integer comparisons here. Since SSE only has
// GT and EQ comparisons for integer, swapping operands and multiple
// operations may be required for some comparisons.
Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=137090&r1=137089&r2=137090&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Aug 8 19:46:57 2011
@@ -1264,14 +1264,39 @@
SSEPackedDouble>, TB, OpSize;
}
+let Predicates = [HasSSE1] in {
def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), VR128:$src2, imm:$cc)),
(CMPPSrri (v4f32 VR128:$src1), (v4f32 VR128:$src2), imm:$cc)>;
def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)),
(CMPPSrmi (v4f32 VR128:$src1), addr:$src2, imm:$cc)>;
+}
+
+let Predicates = [HasSSE2] in {
def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), VR128:$src2, imm:$cc)),
(CMPPDrri VR128:$src1, VR128:$src2, imm:$cc)>;
def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)),
(CMPPDrmi VR128:$src1, addr:$src2, imm:$cc)>;
+}
+
+let Predicates = [HasAVX] in {
+def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), VR128:$src2, imm:$cc)),
+ (VCMPPSrri (v4f32 VR128:$src1), (v4f32 VR128:$src2), imm:$cc)>;
+def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)),
+ (VCMPPSrmi (v4f32 VR128:$src1), addr:$src2, imm:$cc)>;
+def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), VR128:$src2, imm:$cc)),
+ (VCMPPDrri VR128:$src1, VR128:$src2, imm:$cc)>;
+def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)),
+ (VCMPPDrmi VR128:$src1, addr:$src2, imm:$cc)>;
+
+def : Pat<(v8i32 (X86cmpps (v8f32 VR256:$src1), VR256:$src2, imm:$cc)),
+ (VCMPPSYrri (v8f32 VR256:$src1), (v8f32 VR256:$src2), imm:$cc)>;
+def : Pat<(v8i32 (X86cmpps (v8f32 VR256:$src1), (memop addr:$src2), imm:$cc)),
+ (VCMPPSYrmi (v8f32 VR256:$src1), addr:$src2, imm:$cc)>;
+def : Pat<(v4i64 (X86cmppd (v4f64 VR256:$src1), VR256:$src2, imm:$cc)),
+ (VCMPPDYrri VR256:$src1, VR256:$src2, imm:$cc)>;
+def : Pat<(v4i64 (X86cmppd (v4f64 VR256:$src1), (memop addr:$src2), imm:$cc)),
+ (VCMPPDYrmi VR256:$src1, addr:$src2, imm:$cc)>;
+}
//===----------------------------------------------------------------------===//
// SSE 1 & 2 - Shuffle Instructions
Added: llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll?rev=137090&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll (added)
+++ llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll Mon Aug 8 19:46:57 2011
@@ -0,0 +1,18 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
+
+; CHECK: vcmpltps %ymm
+; CHECK-NOT: vucomiss
+define <8 x i32> @cmp00(<8 x float> %a, <8 x float> %b) nounwind readnone {
+ %bincmp = fcmp olt <8 x float> %a, %b
+ %s = sext <8 x i1> %bincmp to <8 x i32>
+ ret <8 x i32> %s
+}
+
+; CHECK: vcmpltpd %ymm
+; CHECK-NOT: vucomisd
+define <4 x i64> @cmp01(<4 x double> %a, <4 x double> %b) nounwind readnone {
+ %bincmp = fcmp olt <4 x double> %a, %b
+ %s = sext <4 x i1> %bincmp to <4 x i64>
+ ret <4 x i64> %s
+}
+
From isanbard at gmail.com Mon Aug 8 19:47:30 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 09 Aug 2011 00:47:30 -0000
Subject: [llvm-commits] [llvm] r137091 -
/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
Message-ID: <20110809004730.A1A452A6C12C@llvm.org>
Author: void
Date: Mon Aug 8 19:47:30 2011
New Revision: 137091
URL: http://llvm.org/viewvc/llvm-project?rev=137091&view=rev
Log:
Add missing attributes to the C++ backend's output.
Modified:
llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=137091&r1=137090&r2=137091&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Mon Aug 8 19:47:30 2011
@@ -470,6 +470,9 @@
HANDLE_ATTR(NoImplicitFloat);
HANDLE_ATTR(Naked);
HANDLE_ATTR(InlineHint);
+ HANDLE_ATTR(Hotpatch);
+ HANDLE_ATTR(UWTable);
+ HANDLE_ATTR(NonLazyBind);
#undef HANDLE_ATTR
if (attrs & Attribute::StackAlignment)
Out << " | Attribute::constructStackAlignmentFromInt("
From aggarwa4 at illinois.edu Mon Aug 8 19:58:33 2011
From: aggarwa4 at illinois.edu (Arushi Aggarwal)
Date: Tue, 09 Aug 2011 00:58:33 -0000
Subject: [llvm-commits] [poolalloc] r137093 - in /poolalloc/trunk:
include/assistDS/SimplifyGEP.h include/assistDS/SimplifyInsertValue.h
include/assistDS/SimplifyLoad.h include/assistDS/StructReturnToPointer.h
lib/AssistDS/SimplifyGEP.cpp lib/AssistDS/SimplifyInsertValue.cpp
lib/AssistDS/SimplifyLoad.cpp lib/AssistDS/StructReturnToPointer.cpp
Message-ID: <20110809005833.88F012A6C12C@llvm.org>
Author: aggarwa4
Date: Mon Aug 8 19:58:33 2011
New Revision: 137093
URL: http://llvm.org/viewvc/llvm-project?rev=137093&view=rev
Log:
Move to mainline
Modified:
poolalloc/trunk/include/assistDS/SimplifyGEP.h
poolalloc/trunk/include/assistDS/SimplifyInsertValue.h
poolalloc/trunk/include/assistDS/SimplifyLoad.h
poolalloc/trunk/include/assistDS/StructReturnToPointer.h
poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp
poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp
poolalloc/trunk/lib/AssistDS/SimplifyLoad.cpp
poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp
Modified: poolalloc/trunk/include/assistDS/SimplifyGEP.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/SimplifyGEP.h?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/SimplifyGEP.h (original)
+++ poolalloc/trunk/include/assistDS/SimplifyGEP.h Mon Aug 8 19:58:33 2011
@@ -25,7 +25,7 @@
TargetData * TD;
public:
static char ID;
- SimplifyGEP() : ModulePass(&ID) {}
+ SimplifyGEP() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired();
Modified: poolalloc/trunk/include/assistDS/SimplifyInsertValue.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/SimplifyInsertValue.h?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/SimplifyInsertValue.h (original)
+++ poolalloc/trunk/include/assistDS/SimplifyInsertValue.h Mon Aug 8 19:58:33 2011
@@ -23,7 +23,7 @@
class SimplifyIV : public ModulePass {
public:
static char ID;
- SimplifyIV() : ModulePass(&ID) {}
+ SimplifyIV() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/include/assistDS/SimplifyLoad.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/SimplifyLoad.h?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/SimplifyLoad.h (original)
+++ poolalloc/trunk/include/assistDS/SimplifyLoad.h Mon Aug 8 19:58:33 2011
@@ -22,7 +22,7 @@
class SimplifyLoad : public ModulePass {
public:
static char ID;
- SimplifyLoad() : ModulePass(&ID) {}
+ SimplifyLoad() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/include/assistDS/StructReturnToPointer.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/StructReturnToPointer.h?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/StructReturnToPointer.h (original)
+++ poolalloc/trunk/include/assistDS/StructReturnToPointer.h Mon Aug 8 19:58:33 2011
@@ -23,7 +23,7 @@
class StructRet : public ModulePass {
public:
static char ID;
- StructRet() : ModulePass(&ID) {}
+ StructRet() : ModulePass(ID) {}
virtual bool runOnModule(Module& M);
};
}
Modified: poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp Mon Aug 8 19:58:33 2011
@@ -107,8 +107,7 @@
// -> GEP i8* X, ...
SmallVector Idx(GEP->idx_begin()+1, GEP->idx_end());
GetElementPtrInst *Res =
- GetElementPtrInst::Create(StrippedPtr, Idx.begin(),
- Idx.end(), GEP->getName(), GEP);
+ GetElementPtrInst::Create(StrippedPtr, Idx, GEP->getName(), GEP);
Res->setIsInBounds(GEP->isInBounds());
GEP->replaceAllUsesWith(Res);
continue;
@@ -132,8 +131,8 @@
// Transform things like:
// %t = getelementptr i32* bitcast ([2 x i32]* %str to i32*), i32 %V
// into: %t1 = getelementptr [2 x i32]* %str, i32 0, i32 %V; bitcast
- const Type *SrcElTy = StrippedPtrTy->getElementType();
- const Type *ResElTy=cast(PtrOp->getType())->getElementType();
+ Type *SrcElTy = StrippedPtrTy->getElementType();
+ Type *ResElTy=cast(PtrOp->getType())->getElementType();
if (TD && SrcElTy->isArrayTy() &&
TD->getTypeAllocSize(cast(SrcElTy)->getElementType()) ==
TD->getTypeAllocSize(ResElTy)) {
@@ -141,7 +140,7 @@
Idx[0] = Constant::getNullValue(Type::getInt32Ty(GEP->getContext()));
Idx[1] = GEP->getOperand(1);
Value *NewGEP = GetElementPtrInst::Create(StrippedPtr, Idx,
- Idx+2, GEP->getName(), GEP);
+ GEP->getName(), GEP);
// V and GEP are both pointer types --> BitCast
GEP->replaceAllUsesWith(new BitCastInst(NewGEP, GEP->getType(), GEP->getName(), GEP));
continue;
@@ -200,7 +199,7 @@
Idx[0] = Constant::getNullValue(Type::getInt32Ty(GEP->getContext()));
Idx[1] = NewIdx;
Value *NewGEP = GetElementPtrInst::Create(StrippedPtr, Idx,
- Idx+2, GEP->getName(), GEP);
+ GEP->getName(), GEP);
GEP->replaceAllUsesWith(new BitCastInst(NewGEP, GEP->getType(), GEP->getName(), GEP));
continue;
}
Modified: poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp Mon Aug 8 19:58:33 2011
@@ -63,7 +63,7 @@
if(IV->getNumUses() != 1)
continue;
// Check that its only use is a StoreInst
- StoreInst *SI = dyn_cast(IV->use_begin());
+ StoreInst *SI = dyn_cast(*(IV->use_begin()));
if(!SI)
continue;
// Check that it is the stored value
@@ -74,14 +74,14 @@
do {
// replace by a series of gep/stores
SmallVector Indices;
- const Type *Int32Ty = Type::getInt32Ty(M.getContext());
+ Type *Int32Ty = Type::getInt32Ty(M.getContext());
Indices.push_back(Constant::getNullValue(Int32Ty));
for (InsertValueInst::idx_iterator I = IV->idx_begin(), E = IV->idx_end();
I != E; ++I) {
Indices.push_back(ConstantInt::get(Int32Ty, *I));
}
- GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(SI->getOperand(1), Indices.begin(),
- Indices.end(), SI->getName(), SI) ;
+ GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(SI->getOperand(1), Indices,
+ SI->getName(), SI) ;
new StoreInst(IV->getInsertedValueOperand(), GEP, SI);
IV = dyn_cast(IV->getAggregateOperand());
Modified: poolalloc/trunk/lib/AssistDS/SimplifyLoad.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/SimplifyLoad.cpp?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/SimplifyLoad.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/SimplifyLoad.cpp Mon Aug 8 19:58:33 2011
@@ -57,7 +57,7 @@
if(!LI)
continue;
if(LI->getNumUses() == 1) {
- if(CastInst *CI = dyn_cast(LI->use_begin())) {
+ if(CastInst *CI = dyn_cast(*(LI->use_begin()))) {
if(LI->getType()->isPointerTy()) {
if(ConstantExpr *CE = dyn_cast(LI->getOperand(0))) {
if(const PointerType *PTy = dyn_cast(CE->getOperand(0)->getType()))
Modified: poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp?rev=137093&r1=137092&r2=137093&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp Mon Aug 8 19:58:33 2011
@@ -17,6 +17,7 @@
#include "llvm/Attributes.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/ValueMap.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Debug.h"
@@ -60,23 +61,23 @@
while(!worklist.empty()) {
Function *F = worklist.back();
worklist.pop_back();
- const Type *NewArgType = F->getReturnType()->getPointerTo();
+ Type *NewArgType = F->getReturnType()->getPointerTo();
// Construct the new Type
- std::vectorTP;
+ std::vectorTP;
TP.push_back(NewArgType);
for (Function::arg_iterator ii = F->arg_begin(), ee = F->arg_end();
ii != ee; ++ii) {
TP.push_back(ii->getType());
}
- const FunctionType *NFTy = FunctionType::get(F->getReturnType(), TP, F->isVarArg());
+ FunctionType *NFTy = FunctionType::get(F->getReturnType(), TP, F->isVarArg());
// Create the new function body and insert it into the module.
Function *NF = Function::Create(NFTy,
GlobalValue::InternalLinkage,
F->getName(), &M);
- DenseMap ValueMap;
+ ValueToValueMapTy ValueMap;
Function::arg_iterator NI = NF->arg_begin();
NI->setName("ret");
++NI;
@@ -87,7 +88,7 @@
}
// Perform the cloning.
SmallVector Returns;
- CloneFunctionInto(NF, F, ValueMap, Returns);
+ CloneFunctionInto(NF, F, ValueMap, false, Returns);
std::vector fargs;
for(Function::arg_iterator ai = NF->arg_begin(),
ae= NF->arg_end(); ai != ae; ++ai) {
@@ -109,7 +110,7 @@
for(Value::use_iterator ui = F->use_begin(), ue = F->use_end();
ui != ue; ) {
- CallInst *CI = dyn_cast(ui++);
+ CallInst *CI = dyn_cast(*ui++);
if(!CI)
continue;
if(CI->getCalledFunction() != F)
@@ -143,7 +144,7 @@
AttrListPtr NewCallPAL = AttrListPtr::get(AttributesVec.begin(),
AttributesVec.end());
- CallInst *CallI = CallInst::Create(NF, Args.begin(), Args.end(), "", CI);
+ CallInst *CallI = CallInst::Create(NF, Args, "", CI);
CallI->setCallingConv(CI->getCallingConv());
CallI->setAttributes(NewCallPAL);
LoadInst *LI = new LoadInst(AllocaNew, "", CI);
From stoklund at 2pi.dk Mon Aug 8 20:01:27 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Tue, 09 Aug 2011 01:01:27 -0000
Subject: [llvm-commits] [llvm] r137094 - in /llvm/trunk/lib/CodeGen:
RegisterCoalescer.cpp RegisterCoalescer.h
Message-ID: <20110809010127.C8DC32A6C12C@llvm.org>
Author: stoklund
Date: Mon Aug 8 20:01:27 2011
New Revision: 137094
URL: http://llvm.org/viewvc/llvm-project?rev=137094&view=rev
Log:
Rename member variables to follow coding standards.
No functional change.
Modified:
llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
llvm/trunk/lib/CodeGen/RegisterCoalescer.h
Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=137094&r1=137093&r2=137094&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Mon Aug 8 20:01:27 2011
@@ -78,14 +78,14 @@
namespace {
class RegisterCoalescer : public MachineFunctionPass {
- MachineFunction* mf_;
- MachineRegisterInfo* mri_;
- const TargetMachine* tm_;
- const TargetRegisterInfo* tri_;
- const TargetInstrInfo* tii_;
- LiveIntervals *li_;
- LiveDebugVariables *ldv_;
- const MachineLoopInfo* loopInfo;
+ MachineFunction* MF;
+ MachineRegisterInfo* MRI;
+ const TargetMachine* TM;
+ const TargetRegisterInfo* TRI;
+ const TargetInstrInfo* TII;
+ LiveIntervals *LIS;
+ LiveDebugVariables *LDV;
+ const MachineLoopInfo* Loops;
AliasAnalysis *AA;
RegisterClassInfo RegClassInfo;
@@ -240,14 +240,14 @@
}
bool CoalescerPair::setRegisters(const MachineInstr *MI) {
- srcReg_ = dstReg_ = subIdx_ = 0;
- newRC_ = 0;
- flipped_ = crossClass_ = false;
+ SrcReg = DstReg = SubIdx = 0;
+ NewRC = 0;
+ Flipped = CrossClass = false;
unsigned Src, Dst, SrcSub, DstSub;
- if (!isMoveInstr(tri_, MI, Src, Dst, SrcSub, DstSub))
+ if (!isMoveInstr(TRI, MI, Src, Dst, SrcSub, DstSub))
return false;
- partial_ = SrcSub || DstSub;
+ Partial = SrcSub || DstSub;
// If one register is a physreg, it must be Dst.
if (TargetRegisterInfo::isPhysicalRegister(Src)) {
@@ -255,7 +255,7 @@
return false;
std::swap(Src, Dst);
std::swap(SrcSub, DstSub);
- flipped_ = true;
+ Flipped = true;
}
const MachineRegisterInfo &MRI = MI->getParent()->getParent()->getRegInfo();
@@ -263,14 +263,14 @@
if (TargetRegisterInfo::isPhysicalRegister(Dst)) {
// Eliminate DstSub on a physreg.
if (DstSub) {
- Dst = tri_.getSubReg(Dst, DstSub);
+ Dst = TRI.getSubReg(Dst, DstSub);
if (!Dst) return false;
DstSub = 0;
}
// Eliminate SrcSub by picking a corresponding Dst superregister.
if (SrcSub) {
- Dst = tri_.getMatchingSuperReg(Dst, SrcSub, MRI.getRegClass(Src));
+ Dst = TRI.getMatchingSuperReg(Dst, SrcSub, MRI.getRegClass(Src));
if (!Dst) return false;
SrcSub = 0;
} else if (!MRI.getRegClass(Src)->contains(Dst)) {
@@ -298,36 +298,36 @@
std::swap(Src, Dst);
DstSub = SrcSub;
SrcSub = 0;
- assert(!flipped_ && "Unexpected flip");
- flipped_ = true;
+ assert(!Flipped && "Unexpected flip");
+ Flipped = true;
}
// Find the new register class.
const TargetRegisterClass *SrcRC = MRI.getRegClass(Src);
const TargetRegisterClass *DstRC = MRI.getRegClass(Dst);
if (DstSub)
- newRC_ = tri_.getMatchingSuperRegClass(DstRC, SrcRC, DstSub);
+ NewRC = TRI.getMatchingSuperRegClass(DstRC, SrcRC, DstSub);
else
- newRC_ = getCommonSubClass(DstRC, SrcRC);
- if (!newRC_)
+ NewRC = getCommonSubClass(DstRC, SrcRC);
+ if (!NewRC)
return false;
- crossClass_ = newRC_ != DstRC || newRC_ != SrcRC;
+ CrossClass = NewRC != DstRC || NewRC != SrcRC;
}
// Check our invariants
assert(TargetRegisterInfo::isVirtualRegister(Src) && "Src must be virtual");
assert(!(TargetRegisterInfo::isPhysicalRegister(Dst) && DstSub) &&
"Cannot have a physical SubIdx");
- srcReg_ = Src;
- dstReg_ = Dst;
- subIdx_ = DstSub;
+ SrcReg = Src;
+ DstReg = Dst;
+ SubIdx = DstSub;
return true;
}
bool CoalescerPair::flip() {
- if (subIdx_ || TargetRegisterInfo::isPhysicalRegister(dstReg_))
+ if (SubIdx || TargetRegisterInfo::isPhysicalRegister(DstReg))
return false;
- std::swap(srcReg_, dstReg_);
- flipped_ = !flipped_;
+ std::swap(SrcReg, DstReg);
+ Flipped = !Flipped;
return true;
}
@@ -335,36 +335,36 @@
if (!MI)
return false;
unsigned Src, Dst, SrcSub, DstSub;
- if (!isMoveInstr(tri_, MI, Src, Dst, SrcSub, DstSub))
+ if (!isMoveInstr(TRI, MI, Src, Dst, SrcSub, DstSub))
return false;
- // Find the virtual register that is srcReg_.
- if (Dst == srcReg_) {
+ // Find the virtual register that is SrcReg.
+ if (Dst == SrcReg) {
std::swap(Src, Dst);
std::swap(SrcSub, DstSub);
- } else if (Src != srcReg_) {
+ } else if (Src != SrcReg) {
return false;
}
- // Now check that Dst matches dstReg_.
- if (TargetRegisterInfo::isPhysicalRegister(dstReg_)) {
+ // Now check that Dst matches DstReg.
+ if (TargetRegisterInfo::isPhysicalRegister(DstReg)) {
if (!TargetRegisterInfo::isPhysicalRegister(Dst))
return false;
- assert(!subIdx_ && "Inconsistent CoalescerPair state.");
+ assert(!SubIdx && "Inconsistent CoalescerPair state.");
// DstSub could be set for a physreg from INSERT_SUBREG.
if (DstSub)
- Dst = tri_.getSubReg(Dst, DstSub);
+ Dst = TRI.getSubReg(Dst, DstSub);
// Full copy of Src.
if (!SrcSub)
- return dstReg_ == Dst;
+ return DstReg == Dst;
// This is a partial register copy. Check that the parts match.
- return tri_.getSubReg(dstReg_, SrcSub) == Dst;
+ return TRI.getSubReg(DstReg, SrcSub) == Dst;
} else {
- // dstReg_ is virtual.
- if (dstReg_ != Dst)
+ // DstReg is virtual.
+ if (DstReg != Dst)
return false;
// Registers match, do the subregisters line up?
- return compose(tri_, subIdx_, SrcSub) == DstSub;
+ return compose(TRI, SubIdx, SrcSub) == DstSub;
}
}
@@ -416,14 +416,14 @@
MachineInstr *CopyMI) {
// Bail if there is no dst interval - can happen when merging physical subreg
// operations.
- if (!li_->hasInterval(CP.getDstReg()))
+ if (!LIS->hasInterval(CP.getDstReg()))
return false;
LiveInterval &IntA =
- li_->getInterval(CP.isFlipped() ? CP.getDstReg() : CP.getSrcReg());
+ LIS->getInterval(CP.isFlipped() ? CP.getDstReg() : CP.getSrcReg());
LiveInterval &IntB =
- li_->getInterval(CP.isFlipped() ? CP.getSrcReg() : CP.getDstReg());
- SlotIndex CopyIdx = li_->getInstructionIndex(CopyMI).getDefIndex();
+ LIS->getInterval(CP.isFlipped() ? CP.getSrcReg() : CP.getDstReg());
+ SlotIndex CopyIdx = LIS->getInstructionIndex(CopyMI).getDefIndex();
// BValNo is a value number in B that is defined by a copy from A. 'B3' in
// the example above.
@@ -479,7 +479,7 @@
// Make sure that the end of the live range is inside the same block as
// CopyMI.
MachineInstr *ValLREndInst =
- li_->getInstructionFromIndex(ValLR->end.getPrevSlot());
+ LIS->getInstructionFromIndex(ValLR->end.getPrevSlot());
if (!ValLREndInst || ValLREndInst->getParent() != CopyMI->getParent())
return false;
@@ -492,11 +492,11 @@
// of its aliases is overlapping the live interval of the virtual register.
// If so, do not coalesce.
if (TargetRegisterInfo::isPhysicalRegister(IntB.reg)) {
- for (const unsigned *AS = tri_->getAliasSet(IntB.reg); *AS; ++AS)
- if (li_->hasInterval(*AS) && IntA.overlaps(li_->getInterval(*AS))) {
+ for (const unsigned *AS = TRI->getAliasSet(IntB.reg); *AS; ++AS)
+ if (LIS->hasInterval(*AS) && IntA.overlaps(LIS->getInterval(*AS))) {
DEBUG({
dbgs() << "\t\tInterfere with alias ";
- li_->getInterval(*AS).print(dbgs(), tri_);
+ LIS->getInterval(*AS).print(dbgs(), TRI);
});
return false;
}
@@ -504,7 +504,7 @@
DEBUG({
dbgs() << "Extending: ";
- IntB.print(dbgs(), tri_);
+ IntB.print(dbgs(), TRI);
});
SlotIndex FillerStart = ValLR->end, FillerEnd = BLR->start;
@@ -522,13 +522,13 @@
// If the IntB live range is assigned to a physical register, and if that
// physreg has sub-registers, update their live intervals as well.
if (TargetRegisterInfo::isPhysicalRegister(IntB.reg)) {
- for (const unsigned *SR = tri_->getSubRegisters(IntB.reg); *SR; ++SR) {
- if (!li_->hasInterval(*SR))
+ for (const unsigned *SR = TRI->getSubRegisters(IntB.reg); *SR; ++SR) {
+ if (!LIS->hasInterval(*SR))
continue;
- LiveInterval &SRLI = li_->getInterval(*SR);
+ LiveInterval &SRLI = LIS->getInterval(*SR);
SRLI.addRange(LiveRange(FillerStart, FillerEnd,
SRLI.getNextValue(FillerStart, 0,
- li_->getVNInfoAllocator())));
+ LIS->getVNInfoAllocator())));
}
}
@@ -543,7 +543,7 @@
}
DEBUG({
dbgs() << " result = ";
- IntB.print(dbgs(), tri_);
+ IntB.print(dbgs(), TRI);
dbgs() << "\n";
});
@@ -558,7 +558,7 @@
// merge, find the last use and trim the live range. That will also add the
// isKill marker.
if (ALR->end == CopyIdx)
- li_->shrinkToUses(&IntA);
+ LIS->shrinkToUses(&IntA);
++numExtends;
return true;
@@ -622,15 +622,15 @@
return false;
// Bail if there is no dst interval.
- if (!li_->hasInterval(CP.getDstReg()))
+ if (!LIS->hasInterval(CP.getDstReg()))
return false;
- SlotIndex CopyIdx = li_->getInstructionIndex(CopyMI).getDefIndex();
+ SlotIndex CopyIdx = LIS->getInstructionIndex(CopyMI).getDefIndex();
LiveInterval &IntA =
- li_->getInterval(CP.isFlipped() ? CP.getDstReg() : CP.getSrcReg());
+ LIS->getInterval(CP.isFlipped() ? CP.getDstReg() : CP.getSrcReg());
LiveInterval &IntB =
- li_->getInterval(CP.isFlipped() ? CP.getSrcReg() : CP.getDstReg());
+ LIS->getInterval(CP.isFlipped() ? CP.getSrcReg() : CP.getDstReg());
// BValNo is a value number in B that is defined by a copy from A. 'B3' in
// the example above.
@@ -648,7 +648,7 @@
// the optimization.
if (AValNo->isPHIDef() || AValNo->isUnused() || AValNo->hasPHIKill())
return false;
- MachineInstr *DefMI = li_->getInstructionFromIndex(AValNo->def);
+ MachineInstr *DefMI = LIS->getInstructionFromIndex(AValNo->def);
if (!DefMI)
return false;
const MCInstrDesc &MCID = DefMI->getDesc();
@@ -662,7 +662,7 @@
if (!DefMI->isRegTiedToUseOperand(DefIdx, &UseOpIdx))
return false;
unsigned Op1, Op2, NewDstIdx;
- if (!tii_->findCommutedOpIndices(DefMI, Op1, Op2))
+ if (!TII->findCommutedOpIndices(DefMI, Op1, Op2))
return false;
if (Op1 == UseOpIdx)
NewDstIdx = Op2;
@@ -684,18 +684,18 @@
// Abort if the aliases of IntB.reg have values that are not simply the
// clobbers from the superreg.
if (TargetRegisterInfo::isPhysicalRegister(IntB.reg))
- for (const unsigned *AS = tri_->getAliasSet(IntB.reg); *AS; ++AS)
- if (li_->hasInterval(*AS) &&
- HasOtherReachingDefs(IntA, li_->getInterval(*AS), AValNo, 0))
+ for (const unsigned *AS = TRI->getAliasSet(IntB.reg); *AS; ++AS)
+ if (LIS->hasInterval(*AS) &&
+ HasOtherReachingDefs(IntA, LIS->getInterval(*AS), AValNo, 0))
return false;
// If some of the uses of IntA.reg is already coalesced away, return false.
// It's not possible to determine whether it's safe to perform the coalescing.
for (MachineRegisterInfo::use_nodbg_iterator UI =
- mri_->use_nodbg_begin(IntA.reg),
- UE = mri_->use_nodbg_end(); UI != UE; ++UI) {
+ MRI->use_nodbg_begin(IntA.reg),
+ UE = MRI->use_nodbg_end(); UI != UE; ++UI) {
MachineInstr *UseMI = &*UI;
- SlotIndex UseIdx = li_->getInstructionIndex(UseMI);
+ SlotIndex UseIdx = LIS->getInstructionIndex(UseMI);
LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx);
if (ULR == IntA.end())
continue;
@@ -709,15 +709,15 @@
// At this point we have decided that it is legal to do this
// transformation. Start by commuting the instruction.
MachineBasicBlock *MBB = DefMI->getParent();
- MachineInstr *NewMI = tii_->commuteInstruction(DefMI);
+ MachineInstr *NewMI = TII->commuteInstruction(DefMI);
if (!NewMI)
return false;
if (TargetRegisterInfo::isVirtualRegister(IntA.reg) &&
TargetRegisterInfo::isVirtualRegister(IntB.reg) &&
- !mri_->constrainRegClass(IntB.reg, mri_->getRegClass(IntA.reg)))
+ !MRI->constrainRegClass(IntB.reg, MRI->getRegClass(IntA.reg)))
return false;
if (NewMI != DefMI) {
- li_->ReplaceMachineInstrInMaps(DefMI, NewMI);
+ LIS->ReplaceMachineInstrInMaps(DefMI, NewMI);
MBB->insert(DefMI, NewMI);
MBB->erase(DefMI);
}
@@ -734,8 +734,8 @@
// = B
// Update uses of IntA of the specific Val# with IntB.
- for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(IntA.reg),
- UE = mri_->use_end(); UI != UE;) {
+ for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(IntA.reg),
+ UE = MRI->use_end(); UI != UE;) {
MachineOperand &UseMO = UI.getOperand();
MachineInstr *UseMI = &*UI;
++UI;
@@ -747,12 +747,12 @@
UseMO.setReg(NewReg);
continue;
}
- SlotIndex UseIdx = li_->getInstructionIndex(UseMI).getUseIndex();
+ SlotIndex UseIdx = LIS->getInstructionIndex(UseMI).getUseIndex();
LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx);
if (ULR == IntA.end() || ULR->valno != AValNo)
continue;
if (TargetRegisterInfo::isPhysicalRegister(NewReg))
- UseMO.substPhysReg(NewReg, *tri_);
+ UseMO.substPhysReg(NewReg, *TRI);
else
UseMO.setReg(NewReg);
if (UseMI == CopyMI)
@@ -800,7 +800,7 @@
unsigned DstReg,
unsigned DstSubIdx,
MachineInstr *CopyMI) {
- SlotIndex CopyIdx = li_->getInstructionIndex(CopyMI).getUseIndex();
+ SlotIndex CopyIdx = LIS->getInstructionIndex(CopyMI).getUseIndex();
LiveInterval::iterator SrcLR = SrcInt.FindLiveRangeContaining(CopyIdx);
assert(SrcLR != SrcInt.end() && "Live range not found!");
VNInfo *ValNo = SrcLR->valno;
@@ -808,17 +808,17 @@
// the optimization.
if (ValNo->isPHIDef() || ValNo->isUnused() || ValNo->hasPHIKill())
return false;
- MachineInstr *DefMI = li_->getInstructionFromIndex(ValNo->def);
+ MachineInstr *DefMI = LIS->getInstructionFromIndex(ValNo->def);
if (!DefMI)
return false;
assert(DefMI && "Defining instruction disappeared");
const MCInstrDesc &MCID = DefMI->getDesc();
if (!MCID.isAsCheapAsAMove())
return false;
- if (!tii_->isTriviallyReMaterializable(DefMI, AA))
+ if (!TII->isTriviallyReMaterializable(DefMI, AA))
return false;
bool SawStore = false;
- if (!DefMI->isSafeToMove(tii_, AA, SawStore))
+ if (!DefMI->isSafeToMove(TII, AA, SawStore))
return false;
if (MCID.getNumDefs() != 1)
return false;
@@ -826,9 +826,9 @@
// Make sure the copy destination register class fits the instruction
// definition register class. The mismatch can happen as a result of earlier
// extract_subreg, insert_subreg, subreg_to_reg coalescing.
- const TargetRegisterClass *RC = tii_->getRegClass(MCID, 0, tri_);
+ const TargetRegisterClass *RC = TII->getRegClass(MCID, 0, TRI);
if (TargetRegisterInfo::isVirtualRegister(DstReg)) {
- if (mri_->getRegClass(DstReg) != RC)
+ if (MRI->getRegClass(DstReg) != RC)
return false;
} else if (!RC->contains(DstReg))
return false;
@@ -840,10 +840,10 @@
const MCInstrDesc &MCID = DefMI->getDesc();
if (MCID.getNumDefs() != 1)
return false;
- const TargetRegisterClass *DstRC = mri_->getRegClass(DstReg);
+ const TargetRegisterClass *DstRC = MRI->getRegClass(DstReg);
const TargetRegisterClass *DstSubRC =
DstRC->getSubRegisterRegClass(DstSubIdx);
- const TargetRegisterClass *DefRC = tii_->getRegClass(MCID, 0, tri_);
+ const TargetRegisterClass *DefRC = TII->getRegClass(MCID, 0, TRI);
if (DefRC == DstRC)
DstSubIdx = 0;
else if (DefRC != DstSubRC)
@@ -855,7 +855,7 @@
MachineBasicBlock *MBB = CopyMI->getParent();
MachineBasicBlock::iterator MII =
llvm::next(MachineBasicBlock::iterator(CopyMI));
- tii_->reMaterialize(*MBB, MII, DstReg, DstSubIdx, DefMI, *tri_);
+ TII->reMaterialize(*MBB, MII, DstReg, DstSubIdx, DefMI, *TRI);
MachineInstr *NewMI = prior(MII);
// CopyMI may have implicit operands, transfer them over to the newly
@@ -870,7 +870,7 @@
}
NewMI->copyImplicitOps(CopyMI);
- li_->ReplaceMachineInstrInMaps(CopyMI, NewMI);
+ LIS->ReplaceMachineInstrInMaps(CopyMI, NewMI);
CopyMI->eraseFromParent();
ReMatCopies.insert(CopyMI);
ReMatDefs.insert(DefMI);
@@ -879,7 +879,7 @@
// The source interval can become smaller because we removed a use.
if (preserveSrcInt)
- li_->shrinkToUses(&SrcInt);
+ LIS->shrinkToUses(&SrcInt);
return true;
}
@@ -893,11 +893,11 @@
/// Any uses of that value number are marked as .
bool RegisterCoalescer::eliminateUndefCopy(MachineInstr *CopyMI,
const CoalescerPair &CP) {
- SlotIndex Idx = li_->getInstructionIndex(CopyMI);
- LiveInterval *SrcInt = &li_->getInterval(CP.getSrcReg());
+ SlotIndex Idx = LIS->getInstructionIndex(CopyMI);
+ LiveInterval *SrcInt = &LIS->getInterval(CP.getSrcReg());
if (SrcInt->liveAt(Idx))
return false;
- LiveInterval *DstInt = &li_->getInterval(CP.getDstReg());
+ LiveInterval *DstInt = &LIS->getInterval(CP.getDstReg());
if (DstInt->liveAt(Idx))
return false;
@@ -912,13 +912,13 @@
// Find new undef uses.
for (MachineRegisterInfo::reg_nodbg_iterator
- I = mri_->reg_nodbg_begin(DstInt->reg), E = mri_->reg_nodbg_end();
+ I = MRI->reg_nodbg_begin(DstInt->reg), E = MRI->reg_nodbg_end();
I != E; ++I) {
MachineOperand &MO = I.getOperand();
if (MO.isDef() || MO.isUndef())
continue;
MachineInstr *MI = MO.getParent();
- SlotIndex Idx = li_->getInstructionIndex(MI);
+ SlotIndex Idx = LIS->getInstructionIndex(MI);
if (DstInt->liveAt(Idx))
continue;
MO.setIsUndef(true);
@@ -940,9 +940,9 @@
unsigned SubIdx = CP.getSubIdx();
// Update LiveDebugVariables.
- ldv_->renameRegister(SrcReg, DstReg, SubIdx);
+ LDV->renameRegister(SrcReg, DstReg, SubIdx);
- for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg);
+ for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(SrcReg);
MachineInstr *UseMI = I.skipInstruction();) {
// A PhysReg copy that won't be coalesced can perhaps be rematerialized
// instead.
@@ -954,7 +954,7 @@
UseMI->getOperand(0).getReg() != SrcReg &&
UseMI->getOperand(0).getReg() != DstReg &&
!JoinedCopies.count(UseMI) &&
- ReMaterializeTrivialDef(li_->getInterval(SrcReg), false,
+ ReMaterializeTrivialDef(LIS->getInterval(SrcReg), false,
UseMI->getOperand(0).getReg(), 0, UseMI))
continue;
}
@@ -971,9 +971,9 @@
Deads |= MO.isDead();
if (DstIsPhys)
- MO.substPhysReg(DstReg, *tri_);
+ MO.substPhysReg(DstReg, *TRI);
else
- MO.substVirtReg(DstReg, SubIdx, *tri_);
+ MO.substVirtReg(DstReg, SubIdx, *TRI);
}
// This instruction is a copy that will be removed.
@@ -984,19 +984,19 @@
// If UseMI was a simple SrcReg def, make sure we didn't turn it into a
// read-modify-write of DstReg.
if (Deads)
- UseMI->addRegisterDead(DstReg, tri_);
+ UseMI->addRegisterDead(DstReg, TRI);
else if (!Reads && Writes)
- UseMI->addRegisterDefined(DstReg, tri_);
+ UseMI->addRegisterDefined(DstReg, TRI);
// Kill flags apply to the whole physical register.
if (DstIsPhys && Kills)
- UseMI->addRegisterKilled(DstReg, tri_);
+ UseMI->addRegisterKilled(DstReg, TRI);
}
DEBUG({
dbgs() << "\t\tupdated: ";
if (!UseMI->isDebugValue())
- dbgs() << li_->getInstructionIndex(UseMI) << "\t";
+ dbgs() << LIS->getInstructionIndex(UseMI) << "\t";
dbgs() << *UseMI;
});
}
@@ -1005,18 +1005,18 @@
/// removeIntervalIfEmpty - Check if the live interval of a physical register
/// is empty, if so remove it and also remove the empty intervals of its
/// sub-registers. Return true if live interval is removed.
-static bool removeIntervalIfEmpty(LiveInterval &li, LiveIntervals *li_,
- const TargetRegisterInfo *tri_) {
+static bool removeIntervalIfEmpty(LiveInterval &li, LiveIntervals *LIS,
+ const TargetRegisterInfo *TRI) {
if (li.empty()) {
if (TargetRegisterInfo::isPhysicalRegister(li.reg))
- for (const unsigned* SR = tri_->getSubRegisters(li.reg); *SR; ++SR) {
- if (!li_->hasInterval(*SR))
+ for (const unsigned* SR = TRI->getSubRegisters(li.reg); *SR; ++SR) {
+ if (!LIS->hasInterval(*SR))
continue;
- LiveInterval &sli = li_->getInterval(*SR);
+ LiveInterval &sli = LIS->getInterval(*SR);
if (sli.empty())
- li_->removeInterval(*SR);
+ LIS->removeInterval(*SR);
}
- li_->removeInterval(li.reg);
+ LIS->removeInterval(li.reg);
return true;
}
return false;
@@ -1026,29 +1026,29 @@
/// the val# it defines. If the live interval becomes empty, remove it as well.
bool RegisterCoalescer::RemoveDeadDef(LiveInterval &li,
MachineInstr *DefMI) {
- SlotIndex DefIdx = li_->getInstructionIndex(DefMI).getDefIndex();
+ SlotIndex DefIdx = LIS->getInstructionIndex(DefMI).getDefIndex();
LiveInterval::iterator MLR = li.FindLiveRangeContaining(DefIdx);
if (DefIdx != MLR->valno->def)
return false;
li.removeValNo(MLR->valno);
- return removeIntervalIfEmpty(li, li_, tri_);
+ return removeIntervalIfEmpty(li, LIS, TRI);
}
void RegisterCoalescer::RemoveCopyFlag(unsigned DstReg,
const MachineInstr *CopyMI) {
- SlotIndex DefIdx = li_->getInstructionIndex(CopyMI).getDefIndex();
- if (li_->hasInterval(DstReg)) {
- LiveInterval &LI = li_->getInterval(DstReg);
+ SlotIndex DefIdx = LIS->getInstructionIndex(CopyMI).getDefIndex();
+ if (LIS->hasInterval(DstReg)) {
+ LiveInterval &LI = LIS->getInterval(DstReg);
if (const LiveRange *LR = LI.getLiveRangeContaining(DefIdx))
if (LR->valno->def == DefIdx)
LR->valno->setCopy(0);
}
if (!TargetRegisterInfo::isPhysicalRegister(DstReg))
return;
- for (const unsigned* AS = tri_->getAliasSet(DstReg); *AS; ++AS) {
- if (!li_->hasInterval(*AS))
+ for (const unsigned* AS = TRI->getAliasSet(DstReg); *AS; ++AS) {
+ if (!LIS->hasInterval(*AS))
continue;
- LiveInterval &LI = li_->getInterval(*AS);
+ LiveInterval &LI = LIS->getInterval(*AS);
if (const LiveRange *LR = LI.getLiveRangeContaining(DefIdx))
if (LR->valno->def == DefIdx)
LR->valno->setCopy(0);
@@ -1061,8 +1061,8 @@
/// are not spillable! If the destination interval uses are far away, think
/// twice about coalescing them!
bool RegisterCoalescer::shouldJoinPhys(CoalescerPair &CP) {
- bool Allocatable = li_->isAllocatable(CP.getDstReg());
- LiveInterval &JoinVInt = li_->getInterval(CP.getSrcReg());
+ bool Allocatable = LIS->isAllocatable(CP.getDstReg());
+ LiveInterval &JoinVInt = LIS->getInterval(CP.getSrcReg());
/// Always join simple intervals that are defined by a single copy from a
/// reserved register. This doesn't increase register pressure, so it is
@@ -1085,8 +1085,8 @@
// Don't join with physregs that have a ridiculous number of live
// ranges. The data structure performance is really bad when that
// happens.
- if (li_->hasInterval(CP.getDstReg()) &&
- li_->getInterval(CP.getDstReg()).ranges.size() > 1000) {
+ if (LIS->hasInterval(CP.getDstReg()) &&
+ LIS->getInterval(CP.getDstReg()).ranges.size() > 1000) {
++numAborts;
DEBUG(dbgs()
<< "\tPhysical register live interval too complicated, abort!\n");
@@ -1096,9 +1096,9 @@
// FIXME: Why are we skipping this test for partial copies?
// CodeGen/X86/phys_subreg_coalesce-3.ll needs it.
if (!CP.isPartial()) {
- const TargetRegisterClass *RC = mri_->getRegClass(CP.getSrcReg());
+ const TargetRegisterClass *RC = MRI->getRegClass(CP.getSrcReg());
unsigned Threshold = RegClassInfo.getNumAllocatableRegs(RC) * 2;
- unsigned Length = li_->getApproximateInstructionCount(JoinVInt);
+ unsigned Length = LIS->getApproximateInstructionCount(JoinVInt);
if (Length > Threshold) {
++numAborts;
DEBUG(dbgs() << "\tMay tie down a physical register, abort!\n");
@@ -1124,12 +1124,12 @@
// Early exit if the function is fairly small, coalesce aggressively if
// that's the case. For really special register classes with 3 or
// fewer registers, be a bit more careful.
- (li_->getFuncInstructionCount() / NewRCCount) < 8)
+ (LIS->getFuncInstructionCount() / NewRCCount) < 8)
return true;
- LiveInterval &SrcInt = li_->getInterval(SrcReg);
- LiveInterval &DstInt = li_->getInterval(DstReg);
- unsigned SrcSize = li_->getApproximateInstructionCount(SrcInt);
- unsigned DstSize = li_->getApproximateInstructionCount(DstInt);
+ LiveInterval &SrcInt = LIS->getInterval(SrcReg);
+ LiveInterval &DstInt = LIS->getInterval(DstReg);
+ unsigned SrcSize = LIS->getApproximateInstructionCount(SrcInt);
+ unsigned DstSize = LIS->getApproximateInstructionCount(DstInt);
// Coalesce aggressively if the intervals are small compared to the number of
// registers in the new class. The number 4 is fairly arbitrary, chosen to be
@@ -1139,10 +1139,10 @@
return true;
// Estimate *register use density*. If it doubles or more, abort.
- unsigned SrcUses = std::distance(mri_->use_nodbg_begin(SrcReg),
- mri_->use_nodbg_end());
- unsigned DstUses = std::distance(mri_->use_nodbg_begin(DstReg),
- mri_->use_nodbg_end());
+ unsigned SrcUses = std::distance(MRI->use_nodbg_begin(SrcReg),
+ MRI->use_nodbg_end());
+ unsigned DstUses = std::distance(MRI->use_nodbg_begin(DstReg),
+ MRI->use_nodbg_end());
unsigned NewUses = SrcUses + DstUses;
unsigned NewSize = SrcSize + DstSize;
if (SrcRC != NewRC && SrcSize > ThresSize) {
@@ -1170,9 +1170,9 @@
if (JoinedCopies.count(CopyMI) || ReMatCopies.count(CopyMI))
return false; // Already done.
- DEBUG(dbgs() << li_->getInstructionIndex(CopyMI) << '\t' << *CopyMI);
+ DEBUG(dbgs() << LIS->getInstructionIndex(CopyMI) << '\t' << *CopyMI);
- CoalescerPair CP(*tii_, *tri_);
+ CoalescerPair CP(*TII, *TRI);
if (!CP.setRegisters(CopyMI)) {
DEBUG(dbgs() << "\tNot coalescable.\n");
return false;
@@ -1192,8 +1192,8 @@
return false; // Not coalescable.
}
- DEBUG(dbgs() << "\tConsidering merging " << PrintReg(CP.getSrcReg(), tri_)
- << " with " << PrintReg(CP.getDstReg(), tri_, CP.getSubIdx())
+ DEBUG(dbgs() << "\tConsidering merging " << PrintReg(CP.getSrcReg(), TRI)
+ << " with " << PrintReg(CP.getDstReg(), TRI, CP.getSubIdx())
<< "\n");
// Enforce policies.
@@ -1202,7 +1202,7 @@
// Before giving up coalescing, if definition of source is defined by
// trivial computation, try rematerializing it.
if (!CP.isFlipped() &&
- ReMaterializeTrivialDef(li_->getInterval(CP.getSrcReg()), true,
+ ReMaterializeTrivialDef(LIS->getInterval(CP.getSrcReg()), true,
CP.getDstReg(), 0, CopyMI))
return true;
return false;
@@ -1216,8 +1216,8 @@
return false;
}
if (!isWinToJoinCrossClass(CP.getSrcReg(), CP.getDstReg(),
- mri_->getRegClass(CP.getSrcReg()),
- mri_->getRegClass(CP.getDstReg()),
+ MRI->getRegClass(CP.getSrcReg()),
+ MRI->getRegClass(CP.getDstReg()),
CP.getNewRC())) {
DEBUG(dbgs() << "\tAvoid coalescing to constrained register class.\n");
Again = true; // May be possible to coalesce later.
@@ -1226,8 +1226,8 @@
}
// When possible, let DstReg be the larger interval.
- if (!CP.getSubIdx() && li_->getInterval(CP.getSrcReg()).ranges.size() >
- li_->getInterval(CP.getDstReg()).ranges.size())
+ if (!CP.getSubIdx() && LIS->getInterval(CP.getSrcReg()).ranges.size() >
+ LIS->getInterval(CP.getDstReg()).ranges.size())
CP.flip();
}
@@ -1241,7 +1241,7 @@
// If definition of source is defined by trivial computation, try
// rematerializing it.
if (!CP.isFlipped() &&
- ReMaterializeTrivialDef(li_->getInterval(CP.getSrcReg()), true,
+ ReMaterializeTrivialDef(LIS->getInterval(CP.getSrcReg()), true,
CP.getDstReg(), 0, CopyMI))
return true;
@@ -1265,7 +1265,7 @@
// other. Make sure the resulting register is set to the right register class.
if (CP.isCrossClass()) {
++numCrossRCs;
- mri_->setRegClass(CP.getDstReg(), CP.getNewRC());
+ MRI->setRegClass(CP.getDstReg(), CP.getNewRC());
}
// Remember to delete the copy instruction.
@@ -1279,10 +1279,10 @@
SmallVector BlockSeq;
// JoinIntervals invalidates the VNInfos in SrcInt, but we only need the
// ranges for this, and they are preserved.
- LiveInterval &SrcInt = li_->getInterval(CP.getSrcReg());
+ LiveInterval &SrcInt = LIS->getInterval(CP.getSrcReg());
for (LiveInterval::const_iterator I = SrcInt.begin(), E = SrcInt.end();
I != E; ++I ) {
- li_->findLiveInMBBs(I->start, I->end, BlockSeq);
+ LIS->findLiveInMBBs(I->start, I->end, BlockSeq);
for (unsigned idx = 0, size = BlockSeq.size(); idx != size; ++idx) {
MachineBasicBlock &block = *BlockSeq[idx];
if (!block.isLiveIn(CP.getDstReg()))
@@ -1294,15 +1294,15 @@
// SrcReg is guarateed to be the register whose live interval that is
// being merged.
- li_->removeInterval(CP.getSrcReg());
+ LIS->removeInterval(CP.getSrcReg());
// Update regalloc hint.
- tri_->UpdateRegAllocHint(CP.getSrcReg(), CP.getDstReg(), *mf_);
+ TRI->UpdateRegAllocHint(CP.getSrcReg(), CP.getDstReg(), *MF);
DEBUG({
- LiveInterval &DstInt = li_->getInterval(CP.getDstReg());
+ LiveInterval &DstInt = LIS->getInterval(CP.getDstReg());
dbgs() << "\tJoined. Result = ";
- DstInt.print(dbgs(), tri_);
+ DstInt.print(dbgs(), TRI);
dbgs() << "\n";
});
@@ -1433,18 +1433,18 @@
/// JoinIntervals - Attempt to join these two intervals. On failure, this
/// returns false.
bool RegisterCoalescer::JoinIntervals(CoalescerPair &CP) {
- LiveInterval &RHS = li_->getInterval(CP.getSrcReg());
- DEBUG({ dbgs() << "\t\tRHS = "; RHS.print(dbgs(), tri_); dbgs() << "\n"; });
+ LiveInterval &RHS = LIS->getInterval(CP.getSrcReg());
+ DEBUG({ dbgs() << "\t\tRHS = "; RHS.print(dbgs(), TRI); dbgs() << "\n"; });
// If a live interval is a physical register, check for interference with any
// aliases. The interference check implemented here is a bit more conservative
// than the full interfeence check below. We allow overlapping live ranges
// only when one is a copy of the other.
if (CP.isPhys()) {
- for (const unsigned *AS = tri_->getAliasSet(CP.getDstReg()); *AS; ++AS){
- if (!li_->hasInterval(*AS))
+ for (const unsigned *AS = TRI->getAliasSet(CP.getDstReg()); *AS; ++AS){
+ if (!LIS->hasInterval(*AS))
continue;
- const LiveInterval &LHS = li_->getInterval(*AS);
+ const LiveInterval &LHS = LIS->getInterval(*AS);
LiveInterval::const_iterator LI = LHS.begin();
for (LiveInterval::const_iterator RI = RHS.begin(), RE = RHS.end();
RI != RE; ++RI) {
@@ -1452,10 +1452,10 @@
// Does LHS have an overlapping live range starting before RI?
if ((LI != LHS.begin() && LI[-1].end > RI->start) &&
(RI->start != RI->valno->def ||
- !CP.isCoalescable(li_->getInstructionFromIndex(RI->start)))) {
+ !CP.isCoalescable(LIS->getInstructionFromIndex(RI->start)))) {
DEBUG({
dbgs() << "\t\tInterference from alias: ";
- LHS.print(dbgs(), tri_);
+ LHS.print(dbgs(), TRI);
dbgs() << "\n\t\tOverlap at " << RI->start << " and no copy.\n";
});
return false;
@@ -1464,10 +1464,10 @@
// Check that LHS ranges beginning in this range are copies.
for (; LI != LHS.end() && LI->start < RI->end; ++LI) {
if (LI->start != LI->valno->def ||
- !CP.isCoalescable(li_->getInstructionFromIndex(LI->start))) {
+ !CP.isCoalescable(LIS->getInstructionFromIndex(LI->start))) {
DEBUG({
dbgs() << "\t\tInterference from alias: ";
- LHS.print(dbgs(), tri_);
+ LHS.print(dbgs(), TRI);
dbgs() << "\n\t\tDef at " << LI->start << " is not a copy.\n";
});
return false;
@@ -1487,8 +1487,8 @@
SmallVector DupCopies;
- LiveInterval &LHS = li_->getOrCreateInterval(CP.getDstReg());
- DEBUG({ dbgs() << "\t\tLHS = "; LHS.print(dbgs(), tri_); dbgs() << "\n"; });
+ LiveInterval &LHS = LIS->getOrCreateInterval(CP.getDstReg());
+ DEBUG({ dbgs() << "\t\tLHS = "; LHS.print(dbgs(), TRI); dbgs() << "\n"; });
// Loop over the value numbers of the LHS, seeing if any are defined from
// the RHS.
@@ -1511,7 +1511,7 @@
// from the RHS interval, we can use its value #.
MachineInstr *MI = VNI->getCopy();
if (!CP.isCoalescable(MI) &&
- !RegistersDefinedFromSameValue(*li_, *tri_, CP, VNI, lr, DupCopies))
+ !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, lr, DupCopies))
continue;
LHSValsDefinedFromRHS[VNI] = lr->valno;
@@ -1538,7 +1538,7 @@
// from the LHS interval, we can use its value #.
MachineInstr *MI = VNI->getCopy();
if (!CP.isCoalescable(MI) &&
- !RegistersDefinedFromSameValue(*li_, *tri_, CP, VNI, lr, DupCopies))
+ !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, lr, DupCopies))
continue;
RHSValsDefinedFromLHS[VNI] = lr->valno;
@@ -1660,7 +1660,7 @@
// and mark the X as coalesced to keep the illusion.
unsigned Src = MI->getOperand(1).getReg();
SourceRegisters.push_back(Src);
- MI->getOperand(0).substVirtReg(Src, 0, *tri_);
+ MI->getOperand(0).substVirtReg(Src, 0, *TRI);
markAsJoined(MI);
}
@@ -1669,13 +1669,13 @@
// that B = X is gone.
for (SmallVector::iterator I = SourceRegisters.begin(),
E = SourceRegisters.end(); I != E; ++I) {
- li_->shrinkToUses(&li_->getInterval(*I));
+ LIS->shrinkToUses(&LIS->getInterval(*I));
}
// If we get here, we know that we can coalesce the live ranges. Ask the
// intervals to coalesce themselves now.
LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], NewVNInfo,
- mri_);
+ MRI);
return true;
}
@@ -1726,7 +1726,7 @@
bool SrcIsPhys = TargetRegisterInfo::isPhysicalRegister(SrcReg);
bool DstIsPhys = TargetRegisterInfo::isPhysicalRegister(DstReg);
- if (li_->hasInterval(SrcReg) && li_->getInterval(SrcReg).empty())
+ if (LIS->hasInterval(SrcReg) && LIS->getInterval(SrcReg).empty())
ImpDefCopies.push_back(Inst);
else if (SrcIsPhys || DstIsPhys)
PhysCopies.push_back(Inst);
@@ -1764,9 +1764,9 @@
DEBUG(dbgs() << "********** JOINING INTERVALS ***********\n");
std::vector TryAgainList;
- if (loopInfo->empty()) {
+ if (Loops->empty()) {
// If there are no loops in the function, join intervals in function order.
- for (MachineFunction::iterator I = mf_->begin(), E = mf_->end();
+ for (MachineFunction::iterator I = MF->begin(), E = MF->end();
I != E; ++I)
CopyCoalesceInMBB(I, TryAgainList);
} else {
@@ -1777,9 +1777,9 @@
// Join intervals in the function prolog first. We want to join physical
// registers with virtual registers before the intervals got too long.
std::vector > MBBs;
- for (MachineFunction::iterator I = mf_->begin(), E = mf_->end();I != E;++I){
+ for (MachineFunction::iterator I = MF->begin(), E = MF->end();I != E;++I){
MachineBasicBlock *MBB = I;
- MBBs.push_back(std::make_pair(loopInfo->getLoopDepth(MBB), I));
+ MBBs.push_back(std::make_pair(Loops->getLoopDepth(MBB), I));
}
// Sort by loop depth.
@@ -1818,22 +1818,22 @@
}
bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) {
- mf_ = &fn;
- mri_ = &fn.getRegInfo();
- tm_ = &fn.getTarget();
- tri_ = tm_->getRegisterInfo();
- tii_ = tm_->getInstrInfo();
- li_ = &getAnalysis();
- ldv_ = &getAnalysis();
+ MF = &fn;
+ MRI = &fn.getRegInfo();
+ TM = &fn.getTarget();
+ TRI = TM->getRegisterInfo();
+ TII = TM->getInstrInfo();
+ LIS = &getAnalysis();
+ LDV = &getAnalysis();
AA = &getAnalysis();
- loopInfo = &getAnalysis();
+ Loops = &getAnalysis();
DEBUG(dbgs() << "********** SIMPLE REGISTER COALESCING **********\n"
<< "********** Function: "
- << ((Value*)mf_->getFunction())->getName() << '\n');
+ << ((Value*)MF->getFunction())->getName() << '\n');
if (VerifyCoalescing)
- mf_->verify(this, "Before register coalescing");
+ MF->verify(this, "Before register coalescing");
RegClassInfo.runOnMachineFunction(fn);
@@ -1842,9 +1842,9 @@
joinIntervals();
DEBUG({
dbgs() << "********** INTERVALS POST JOINING **********\n";
- for (LiveIntervals::iterator I = li_->begin(), E = li_->end();
+ for (LiveIntervals::iterator I = LIS->begin(), E = LIS->end();
I != E; ++I){
- I->second->print(dbgs(), tri_);
+ I->second->print(dbgs(), TRI);
dbgs() << "\n";
}
});
@@ -1853,7 +1853,7 @@
// Perform a final pass over the instructions and compute spill weights
// and remove identity moves.
SmallVector DeadDefs;
- for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();
+ for (MachineFunction::iterator mbbi = MF->begin(), mbbe = MF->end();
mbbi != mbbe; ++mbbi) {
MachineBasicBlock* mbb = mbbi;
for (MachineBasicBlock::iterator mii = mbb->begin(), mie = mbb->end();
@@ -1875,8 +1875,8 @@
if (MI->allDefsAreDead()) {
if (TargetRegisterInfo::isVirtualRegister(SrcReg) &&
- li_->hasInterval(SrcReg))
- li_->shrinkToUses(&li_->getInterval(SrcReg));
+ LIS->hasInterval(SrcReg))
+ LIS->shrinkToUses(&LIS->getInterval(SrcReg));
DoDelete = true;
}
if (!DoDelete) {
@@ -1885,10 +1885,10 @@
MI->RemoveOperand(3);
MI->RemoveOperand(1);
}
- MI->setDesc(tii_->get(TargetOpcode::KILL));
+ MI->setDesc(TII->get(TargetOpcode::KILL));
mii = llvm::next(mii);
} else {
- li_->RemoveMachineInstrFromMaps(MI);
+ LIS->RemoveMachineInstrFromMaps(MI);
mii = mbbi->erase(mii);
++numPeep;
}
@@ -1910,7 +1910,7 @@
if (MO.isDead())
continue;
if (TargetRegisterInfo::isPhysicalRegister(Reg) ||
- !mri_->use_nodbg_empty(Reg)) {
+ !MRI->use_nodbg_empty(Reg)) {
isDead = false;
break;
}
@@ -1919,9 +1919,9 @@
while (!DeadDefs.empty()) {
unsigned DeadDef = DeadDefs.back();
DeadDefs.pop_back();
- RemoveDeadDef(li_->getInterval(DeadDef), MI);
+ RemoveDeadDef(LIS->getInterval(DeadDef), MI);
}
- li_->RemoveMachineInstrFromMaps(mii);
+ LIS->RemoveMachineInstrFromMaps(mii);
mii = mbbi->erase(mii);
continue;
} else
@@ -1931,14 +1931,14 @@
++mii;
// Check for now unnecessary kill flags.
- if (li_->isNotInMIMap(MI)) continue;
- SlotIndex DefIdx = li_->getInstructionIndex(MI).getDefIndex();
+ if (LIS->isNotInMIMap(MI)) continue;
+ SlotIndex DefIdx = LIS->getInstructionIndex(MI).getDefIndex();
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI->getOperand(i);
if (!MO.isReg() || !MO.isKill()) continue;
unsigned reg = MO.getReg();
- if (!reg || !li_->hasInterval(reg)) continue;
- if (!li_->getInterval(reg).killedAt(DefIdx)) {
+ if (!reg || !LIS->hasInterval(reg)) continue;
+ if (!LIS->getInterval(reg).killedAt(DefIdx)) {
MO.setIsKill(false);
continue;
}
@@ -1946,22 +1946,22 @@
// remain alive.
if (!TargetRegisterInfo::isPhysicalRegister(reg))
continue;
- for (const unsigned *SR = tri_->getSubRegisters(reg);
+ for (const unsigned *SR = TRI->getSubRegisters(reg);
unsigned S = *SR; ++SR)
- if (li_->hasInterval(S) && li_->getInterval(S).liveAt(DefIdx))
- MI->addRegisterDefined(S, tri_);
+ if (LIS->hasInterval(S) && LIS->getInterval(S).liveAt(DefIdx))
+ MI->addRegisterDefined(S, TRI);
}
}
}
DEBUG(dump());
- DEBUG(ldv_->dump());
+ DEBUG(LDV->dump());
if (VerifyCoalescing)
- mf_->verify(this, "After register coalescing");
+ MF->verify(this, "After register coalescing");
return true;
}
/// print - Implement the dump method.
void RegisterCoalescer::print(raw_ostream &O, const Module* m) const {
- li_->print(O, m);
+ LIS->print(O, m);
}
Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.h?rev=137094&r1=137093&r2=137094&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.h (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.h Mon Aug 8 20:01:27 2011
@@ -26,46 +26,46 @@
/// two registers can be coalesced, CoalescerPair can determine if a copy
/// instruction would become an identity copy after coalescing.
class CoalescerPair {
- const TargetInstrInfo &tii_;
- const TargetRegisterInfo &tri_;
+ const TargetInstrInfo &TII;
+ const TargetRegisterInfo &TRI;
- /// dstReg_ - The register that will be left after coalescing. It can be a
+ /// DstReg - The register that will be left after coalescing. It can be a
/// virtual or physical register.
- unsigned dstReg_;
+ unsigned DstReg;
- /// srcReg_ - the virtual register that will be coalesced into dstReg.
- unsigned srcReg_;
+ /// SrcReg - the virtual register that will be coalesced into dstReg.
+ unsigned SrcReg;
- /// subReg_ - The subregister index of srcReg in dstReg_. It is possible the
- /// coalesce srcReg_ into a subreg of the larger dstReg_ when dstReg_ is a
+ /// subReg_ - The subregister index of srcReg in DstReg. It is possible the
+ /// coalesce SrcReg into a subreg of the larger DstReg when DstReg is a
/// virtual register.
- unsigned subIdx_;
+ unsigned SubIdx;
- /// partial_ - True when the original copy was a partial subregister copy.
- bool partial_;
+ /// Partial - True when the original copy was a partial subregister copy.
+ bool Partial;
- /// crossClass_ - True when both regs are virtual, and newRC is constrained.
- bool crossClass_;
+ /// CrossClass - True when both regs are virtual, and newRC is constrained.
+ bool CrossClass;
- /// flipped_ - True when DstReg and SrcReg are reversed from the oriignal copy
- /// instruction.
- bool flipped_;
+ /// Flipped - True when DstReg and SrcReg are reversed from the oriignal
+ /// copy instruction.
+ bool Flipped;
- /// newRC_ - The register class of the coalesced register, or NULL if dstReg_
+ /// NewRC - The register class of the coalesced register, or NULL if DstReg
/// is a physreg.
- const TargetRegisterClass *newRC_;
+ const TargetRegisterClass *NewRC;
public:
CoalescerPair(const TargetInstrInfo &tii, const TargetRegisterInfo &tri)
- : tii_(tii), tri_(tri), dstReg_(0), srcReg_(0), subIdx_(0),
- partial_(false), crossClass_(false), flipped_(false), newRC_(0) {}
+ : TII(tii), TRI(tri), DstReg(0), SrcReg(0), SubIdx(0),
+ Partial(false), CrossClass(false), Flipped(false), NewRC(0) {}
/// setRegisters - set registers to match the copy instruction MI. Return
/// false if MI is not a coalescable copy instruction.
bool setRegisters(const MachineInstr*);
- /// flip - Swap srcReg_ and dstReg_. Return false if swapping is impossible
- /// because dstReg_ is a physical register, or subIdx_ is set.
+ /// flip - Swap SrcReg and DstReg. Return false if swapping is impossible
+ /// because DstReg is a physical register, or SubIdx is set.
bool flip();
/// isCoalescable - Return true if MI is a copy instruction that will become
@@ -73,32 +73,33 @@
bool isCoalescable(const MachineInstr*) const;
/// isPhys - Return true if DstReg is a physical register.
- bool isPhys() const { return !newRC_; }
+ bool isPhys() const { return !NewRC; }
- /// isPartial - Return true if the original copy instruction did not copy the
- /// full register, but was a subreg operation.
- bool isPartial() const { return partial_; }
-
- /// isCrossClass - Return true if DstReg is virtual and NewRC is a smaller register class than DstReg's.
- bool isCrossClass() const { return crossClass_; }
+ /// isPartial - Return true if the original copy instruction did not copy
+ /// the full register, but was a subreg operation.
+ bool isPartial() const { return Partial; }
+
+ /// isCrossClass - Return true if DstReg is virtual and NewRC is a smaller
+ /// register class than DstReg's.
+ bool isCrossClass() const { return CrossClass; }
/// isFlipped - Return true when getSrcReg is the register being defined by
/// the original copy instruction.
- bool isFlipped() const { return flipped_; }
+ bool isFlipped() const { return Flipped; }
/// getDstReg - Return the register (virtual or physical) that will remain
/// after coalescing.
- unsigned getDstReg() const { return dstReg_; }
+ unsigned getDstReg() const { return DstReg; }
/// getSrcReg - Return the virtual register that will be coalesced away.
- unsigned getSrcReg() const { return srcReg_; }
+ unsigned getSrcReg() const { return SrcReg; }
/// getSubIdx - Return the subregister index in DstReg that SrcReg will be
/// coalesced into, or 0.
- unsigned getSubIdx() const { return subIdx_; }
+ unsigned getSubIdx() const { return SubIdx; }
/// getNewRC - Return the register class of the coalesced register.
- const TargetRegisterClass *getNewRC() const { return newRC_; }
+ const TargetRegisterClass *getNewRC() const { return NewRC; }
};
} // End llvm namespace
From dpatel at apple.com Mon Aug 8 20:03:14 2011
From: dpatel at apple.com (Devang Patel)
Date: Tue, 09 Aug 2011 01:03:14 -0000
Subject: [llvm-commits] [llvm] r137095 - in /llvm/trunk:
include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp
Message-ID: <20110809010314.E05552A6C12C@llvm.org>
Author: dpatel
Date: Mon Aug 8 20:03:14 2011
New Revision: 137095
URL: http://llvm.org/viewvc/llvm-project?rev=137095&view=rev
Log:
Provide method to print variable's extended name which includes inline location.
Modified:
llvm/trunk/include/llvm/Analysis/DebugInfo.h
llvm/trunk/lib/Analysis/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=137095&r1=137094&r2=137095&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 8 20:03:14 2011
@@ -615,7 +615,7 @@
}
/// getInlinedAt - If this variable is inlined then return inline location.
- MDNode *getInlinedAt();
+ MDNode *getInlinedAt() const;
/// Verify - Verify that a variable descriptor is well formed.
bool Verify() const;
@@ -648,6 +648,8 @@
/// print - print variable.
void print(raw_ostream &OS) const;
+ void printExtendedName(raw_ostream &OS) const;
+
/// dump - print variable to dbgs() with a newline.
void dump() const;
};
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=137095&r1=137094&r2=137095&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 8 20:03:14 2011
@@ -117,7 +117,7 @@
}
/// getInlinedAt - If this variable is inlined then return inline location.
-MDNode *DIVariable::getInlinedAt() {
+MDNode *DIVariable::getInlinedAt() const {
if (getVersion() <= llvm::LLVMDebugVersion9)
return NULL;
return dyn_cast_or_null(DbgNode->getOperand(7));
@@ -674,6 +674,42 @@
OS << "]\n";
}
+static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
+ const LLVMContext &Ctx) {
+ if (!DL.isUnknown()) { // Print source line info.
+ DIScope Scope(DL.getScope(Ctx));
+ // Omit the directory, because it's likely to be long and uninteresting.
+ if (Scope.Verify())
+ CommentOS << Scope.getFilename();
+ else
+ CommentOS << "";
+ CommentOS << ':' << DL.getLine();
+ if (DL.getCol() != 0)
+ CommentOS << ':' << DL.getCol();
+ DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx));
+ if (!InlinedAtDL.isUnknown()) {
+ CommentOS << " @[ ";
+ printDebugLoc(InlinedAtDL, CommentOS, Ctx);
+ CommentOS << " ]";
+ }
+ }
+}
+
+void DIVariable::printExtendedName(raw_ostream &OS) const {
+ const LLVMContext &Ctx = DbgNode->getContext();
+ StringRef Res = getName();
+ if (!Res.empty())
+ OS << Res << "," << getLineNumber();
+ if (MDNode *InlinedAt = getInlinedAt()) {
+ DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(InlinedAt);
+ if (!InlinedAtDL.isUnknown()) {
+ OS << " @[";
+ printDebugLoc(InlinedAtDL, OS, Ctx);
+ OS << "]";
+ }
+ }
+}
+
/// print - Print variable.
void DIVariable::print(raw_ostream &OS) const {
StringRef Res = getName();
From dpatel at apple.com Mon Aug 8 20:03:35 2011
From: dpatel at apple.com (Devang Patel)
Date: Tue, 09 Aug 2011 01:03:35 -0000
Subject: [llvm-commits] [llvm] r137096 -
/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
Message-ID: <20110809010335.8B8F82A6C12C@llvm.org>
Author: dpatel
Date: Mon Aug 8 20:03:35 2011
New Revision: 137096
URL: http://llvm.org/viewvc/llvm-project?rev=137096&view=rev
Log:
Print variable's inline location in debug output.
Modified:
llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=137096&r1=137095&r2=137096&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Mon Aug 8 20:03:35 2011
@@ -25,6 +25,7 @@
#include "llvm/Constants.h"
#include "llvm/Metadata.h"
#include "llvm/Value.h"
+#include "llvm/Analysis/DebugInfo.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
@@ -317,8 +318,10 @@
} // namespace
void UserValue::print(raw_ostream &OS, const TargetMachine *TM) {
- if (const MDString *MDS = dyn_cast(variable->getOperand(2)))
- OS << "!\"" << MDS->getString() << "\"\t";
+ DIVariable DV(variable);
+ OS << "!\"";
+ DV.printExtendedName(OS);
+ OS << "\"\t";
if (offset)
OS << '+' << offset;
for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I) {
From isanbard at gmail.com Mon Aug 8 20:09:22 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 09 Aug 2011 01:09:22 -0000
Subject: [llvm-commits] [llvm] r137098 -
/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
Message-ID: <20110809010922.21DE72A6C12C@llvm.org>
Author: void
Date: Mon Aug 8 20:09:21 2011
New Revision: 137098
URL: http://llvm.org/viewvc/llvm-project?rev=137098&view=rev
Log:
Remove an instance where the 'unwind' instruction was created.
The 'unwind' instruction was acting essentially as a placeholder, because it
would be replaced at the end of this function by a branch to the "unwind
handler". The 'unwind' instruction is going away, so use 'unreachable' instead,
which serves the same purpose as a placeholder.
Modified:
llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=137098&r1=137097&r2=137098&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Mon Aug 8 20:09:21 2011
@@ -406,6 +406,7 @@
SmallVector Returns;
SmallVector Unwinds;
SmallVector Invokes;
+ SmallVector Unreachables;
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
if (ReturnInst *RI = dyn_cast(BB->getTerminator())) {
@@ -486,9 +487,10 @@
// Insert a load in the Catch block, and a switch on its value. By default,
// we go to a block that just does an unwind (which is the correct action
- // for a standard call).
+ // for a standard call). We insert an unreachable instruction here and
+ // modify the block to jump to the correct unwinding pad later.
BasicBlock *UnwindBB = BasicBlock::Create(F.getContext(), "unwindbb", &F);
- Unwinds.push_back(new UnwindInst(F.getContext(), UnwindBB));
+ Unreachables.push_back(new UnreachableInst(F.getContext(), UnwindBB));
Value *CatchLoad = new LoadInst(InvokeNum, "invoke.num", true, CatchBB);
SwitchInst *CatchSwitch =
@@ -577,6 +579,12 @@
Unwinds[i]->eraseFromParent();
}
+ // Replace all inserted unreachables with a branch to the unwind handler.
+ for (unsigned i = 0, e = Unreachables.size(); i != e; ++i) {
+ BranchInst::Create(UnwindHandler, Unreachables[i]);
+ Unreachables[i]->eraseFromParent();
+ }
+
// Finally, for any returns from this function, if this function contains an
// invoke, restore the old jmpbuf pointer to its input value.
if (OldJmpBufPtr) {
From isanbard at gmail.com Mon Aug 8 20:17:10 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 09 Aug 2011 01:17:10 -0000
Subject: [llvm-commits] [llvm] r137099 -
/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
Message-ID: <20110809011710.CEB002A6C12C@llvm.org>
Author: void
Date: Mon Aug 8 20:17:10 2011
New Revision: 137099
URL: http://llvm.org/viewvc/llvm-project?rev=137099&view=rev
Log:
There is only one instance of this placeholder being created. Just use that
instead of a vector.
Modified:
llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=137099&r1=137098&r2=137099&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Mon Aug 8 20:17:10 2011
@@ -406,7 +406,7 @@
SmallVector Returns;
SmallVector Unwinds;
SmallVector Invokes;
- SmallVector Unreachables;
+ UnreachableInst* UnreachablePlaceholder = 0;
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
if (ReturnInst *RI = dyn_cast(BB->getTerminator())) {
@@ -490,7 +490,7 @@
// for a standard call). We insert an unreachable instruction here and
// modify the block to jump to the correct unwinding pad later.
BasicBlock *UnwindBB = BasicBlock::Create(F.getContext(), "unwindbb", &F);
- Unreachables.push_back(new UnreachableInst(F.getContext(), UnwindBB));
+ UnreachablePlaceholder = new UnreachableInst(F.getContext(), UnwindBB);
Value *CatchLoad = new LoadInst(InvokeNum, "invoke.num", true, CatchBB);
SwitchInst *CatchSwitch =
@@ -579,10 +579,10 @@
Unwinds[i]->eraseFromParent();
}
- // Replace all inserted unreachables with a branch to the unwind handler.
- for (unsigned i = 0, e = Unreachables.size(); i != e; ++i) {
- BranchInst::Create(UnwindHandler, Unreachables[i]);
- Unreachables[i]->eraseFromParent();
+ // Replace the inserted unreachable with a branch to the unwind handler.
+ if (UnreachablePlaceholder) {
+ BranchInst::Create(UnwindHandler, UnreachablePlaceholder);
+ UnreachablePlaceholder->eraseFromParent();
}
// Finally, for any returns from this function, if this function contains an
From bruno.cardoso at gmail.com Mon Aug 8 20:43:09 2011
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Tue, 09 Aug 2011 01:43:09 -0000
Subject: [llvm-commits] [llvm] r137100 - in /llvm/trunk:
lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/avx-load-store.ll
Message-ID: <20110809014309.E7DAD2A6C12C@llvm.org>
Author: bruno
Date: Mon Aug 8 20:43:09 2011
New Revision: 137100
URL: http://llvm.org/viewvc/llvm-project?rev=137100&view=rev
Log:
Add two patterns to match special vmovss and vmovsd cases. Also fix
the patterns already there to be more strict regarding the predicate.
This fixes PR10558
Modified:
llvm/trunk/lib/Target/X86/X86InstrSSE.td
llvm/trunk/test/CodeGen/X86/avx-load-store.ll
Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=137100&r1=137099&r2=137100&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Aug 8 20:43:09 2011
@@ -186,26 +186,61 @@
(INSERT_SUBREG (v4f64 (IMPLICIT_DEF)), FR64:$src, sub_sd)>;
let AddedComplexity = 20 in {
+let Predicates = [HasSSE1] in {
+ // MOVSSrm zeros the high parts of the register; represent this
+ // with SUBREG_TO_REG.
+ def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector (loadf32 addr:$src))))),
+ (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), sub_ss)>;
+ def : Pat<(v4f32 (scalar_to_vector (loadf32 addr:$src))),
+ (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), sub_ss)>;
+ def : Pat<(v4f32 (X86vzmovl (loadv4f32 addr:$src))),
+ (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), sub_ss)>;
+}
+let Predicates = [HasSSE2] in {
+ // MOVSDrm zeros the high parts of the register; represent this
+ // with SUBREG_TO_REG.
+ def : Pat<(v2f64 (X86vzmovl (v2f64 (scalar_to_vector (loadf64 addr:$src))))),
+ (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ def : Pat<(v2f64 (scalar_to_vector (loadf64 addr:$src))),
+ (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ def : Pat<(v2f64 (X86vzmovl (loadv2f64 addr:$src))),
+ (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ def : Pat<(v2f64 (X86vzmovl (bc_v2f64 (loadv4f32 addr:$src)))),
+ (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ def : Pat<(v2f64 (X86vzload addr:$src)),
+ (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+}
+}
+
+let AddedComplexity = 20, Predicates = [HasAVX] in {
// MOVSSrm zeros the high parts of the register; represent this
-// with SUBREG_TO_REG.
+// with SUBREG_TO_REG. The AVX versions also write: DST[255:128] <- 0
def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector (loadf32 addr:$src))))),
- (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), sub_ss)>;
+ (SUBREG_TO_REG (i32 0), (VMOVSSrm addr:$src), sub_ss)>;
def : Pat<(v4f32 (scalar_to_vector (loadf32 addr:$src))),
- (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), sub_ss)>;
+ (SUBREG_TO_REG (i32 0), (VMOVSSrm addr:$src), sub_ss)>;
def : Pat<(v4f32 (X86vzmovl (loadv4f32 addr:$src))),
- (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), sub_ss)>;
+ (SUBREG_TO_REG (i32 0), (VMOVSSrm addr:$src), sub_ss)>;
// MOVSDrm zeros the high parts of the register; represent this
-// with SUBREG_TO_REG.
+// with SUBREG_TO_REG. The AVX versions also write: DST[255:128] <- 0
def : Pat<(v2f64 (X86vzmovl (v2f64 (scalar_to_vector (loadf64 addr:$src))))),
- (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ (SUBREG_TO_REG (i64 0), (VMOVSDrm addr:$src), sub_sd)>;
def : Pat<(v2f64 (scalar_to_vector (loadf64 addr:$src))),
- (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ (SUBREG_TO_REG (i64 0), (VMOVSDrm addr:$src), sub_sd)>;
def : Pat<(v2f64 (X86vzmovl (loadv2f64 addr:$src))),
- (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ (SUBREG_TO_REG (i64 0), (VMOVSDrm addr:$src), sub_sd)>;
def : Pat<(v2f64 (X86vzmovl (bc_v2f64 (loadv4f32 addr:$src)))),
- (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ (SUBREG_TO_REG (i64 0), (VMOVSDrm addr:$src), sub_sd)>;
def : Pat<(v2f64 (X86vzload addr:$src)),
- (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), sub_sd)>;
+ (SUBREG_TO_REG (i64 0), (VMOVSDrm addr:$src), sub_sd)>;
+// Represent the same patterns above but in the form they appear for
+// 256-bit types
+def : Pat<(v8f32 (X86vzmovl (insert_subvector undef,
+ (v4f32 (scalar_to_vector (loadf32 addr:$src))), (i32 0)))),
+ (SUBREG_TO_REG (i32 0), (VMOVSSrm addr:$src), sub_ss)>;
+def : Pat<(v4f64 (X86vzmovl (insert_subvector undef,
+ (v2f64 (scalar_to_vector (loadf64 addr:$src))), (i32 0)))),
+ (SUBREG_TO_REG (i32 0), (VMOVSDrm addr:$src), sub_sd)>;
}
// Store scalar value to memory.
Modified: llvm/trunk/test/CodeGen/X86/avx-load-store.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-load-store.ll?rev=137100&r1=137099&r2=137100&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-load-store.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-load-store.ll Mon Aug 8 20:43:09 2011
@@ -22,3 +22,21 @@
declare void @dummy(<4 x double>, <8 x float>, <4 x i64>)
+;;
+;; The two tests below check that we must fold load + scalar_to_vector
+;; + ins_subvec+ zext into only a single vmovss or vmovsd
+
+; CHECK: vmovss (%
+define <8 x float> @mov00(<8 x float> %v, float * %ptr) nounwind {
+ %val = load float* %ptr
+ %i0 = insertelement <8 x float> zeroinitializer, float %val, i32 0
+ ret <8 x float> %i0
+}
+
+; CHECK: vmovsd (%
+define <4 x double> @mov01(<4 x double> %v, double * %ptr) nounwind {
+ %val = load double* %ptr
+ %i0 = insertelement <4 x double> zeroinitializer, double %val, i32 0
+ ret <4 x double> %i0
+}
+
From bruno.cardoso at gmail.com Mon Aug 8 22:04:23 2011
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Tue, 09 Aug 2011 03:04:23 -0000
Subject: [llvm-commits] [llvm] r137103 - in /llvm/trunk/test/CodeGen/X86:
avx-128.ll avx-256-arith.ll avx-256-cmp.ll avx-256-cvt.ll avx-256-logic.ll
avx-256-movdup.ll avx-256-splat.ll avx-256-unpack.ll avx-256.ll
avx-arith.ll avx-basic.ll avx-cmp-fp.ll avx-cmp.ll avx-cvt.ll avx-logic.ll
avx-movdup.ll avx-splat.ll avx-unpack.ll
Message-ID: <20110809030423.83C3F2A6C12C@llvm.org>
Author: bruno
Date: Mon Aug 8 22:04:23 2011
New Revision: 137103
URL: http://llvm.org/viewvc/llvm-project?rev=137103&view=rev
Log:
Rename and tidy up tests
Added:
llvm/trunk/test/CodeGen/X86/avx-arith.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-256-arith.ll
llvm/trunk/test/CodeGen/X86/avx-basic.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-256.ll
llvm/trunk/test/CodeGen/X86/avx-cmp.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-cmp-fp.ll
llvm/trunk/test/CodeGen/X86/avx-cvt.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-128.ll
llvm/trunk/test/CodeGen/X86/avx-logic.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-256-logic.ll
llvm/trunk/test/CodeGen/X86/avx-movdup.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-256-movdup.ll
llvm/trunk/test/CodeGen/X86/avx-splat.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-256-splat.ll
llvm/trunk/test/CodeGen/X86/avx-unpack.ll
- copied, changed from r137100, llvm/trunk/test/CodeGen/X86/avx-256-unpack.ll
Removed:
llvm/trunk/test/CodeGen/X86/avx-128.ll
llvm/trunk/test/CodeGen/X86/avx-256-arith.ll
llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll
llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll
llvm/trunk/test/CodeGen/X86/avx-256-logic.ll
llvm/trunk/test/CodeGen/X86/avx-256-movdup.ll
llvm/trunk/test/CodeGen/X86/avx-256-splat.ll
llvm/trunk/test/CodeGen/X86/avx-256-unpack.ll
llvm/trunk/test/CodeGen/X86/avx-256.ll
llvm/trunk/test/CodeGen/X86/avx-cmp-fp.ll
Removed: llvm/trunk/test/CodeGen/X86/avx-128.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-128.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-128.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-128.ll (removed)
@@ -1,72 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
- at z = common global <4 x float> zeroinitializer, align 16
-
-define void @zero() nounwind ssp {
-entry:
- ; CHECK: vxorps
- ; CHECK: vmovaps
- store <4 x float> zeroinitializer, <4 x float>* @z, align 16
- ret void
-}
-
-define void @fpext() nounwind uwtable {
-entry:
- %f = alloca float, align 4
- %d = alloca double, align 8
- %tmp = load float* %f, align 4
- ; CHECK: vcvtss2sd
- %conv = fpext float %tmp to double
- store double %conv, double* %d, align 8
- ret void
-}
-
-; CHECK: vcvtsi2sdq (%
-define double @funcA(i64* nocapture %e) nounwind uwtable readonly ssp {
-entry:
- %tmp1 = load i64* %e, align 8
- %conv = sitofp i64 %tmp1 to double
- ret double %conv
-}
-
-; CHECK: vcvtsi2sd (%
-define double @funcB(i32* nocapture %e) nounwind uwtable readonly ssp {
-entry:
- %tmp1 = load i32* %e, align 4
- %conv = sitofp i32 %tmp1 to double
- ret double %conv
-}
-
-; CHECK: vcvtsi2ss (%
-define float @funcC(i32* nocapture %e) nounwind uwtable readonly ssp {
-entry:
- %tmp1 = load i32* %e, align 4
- %conv = sitofp i32 %tmp1 to float
- ret float %conv
-}
-
-; CHECK: vcvtsi2ssq (%
-define float @funcD(i64* nocapture %e) nounwind uwtable readonly ssp {
-entry:
- %tmp1 = load i64* %e, align 8
- %conv = sitofp i64 %tmp1 to float
- ret float %conv
-}
-
-; CHECK: vsqrtss
-define float @sqrtA(float %a) nounwind uwtable readnone ssp {
-entry:
- %conv1 = tail call float @sqrtf(float %a) nounwind readnone
- ret float %conv1
-}
-
-declare double @sqrt(double) readnone
-
-; CHECK: vsqrtsd
-define double @sqrtB(double %a) nounwind uwtable readnone ssp {
-entry:
- %call = tail call double @sqrt(double %a) nounwind readnone
- ret double %call
-}
-
-declare float @sqrtf(float) readnone
Removed: llvm/trunk/test/CodeGen/X86/avx-256-arith.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-arith.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-arith.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-256-arith.ll (removed)
@@ -1,116 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
-; CHECK: vaddpd
-define <4 x double> @addpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %add.i = fadd <4 x double> %x, %y
- ret <4 x double> %add.i
-}
-
-; CHECK: vaddpd LCP{{.*}}(%rip)
-define <4 x double> @addpd256fold(<4 x double> %y) nounwind uwtable readnone ssp {
-entry:
- %add.i = fadd <4 x double> %y,
- ret <4 x double> %add.i
-}
-
-; CHECK: vaddps
-define <8 x float> @addps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %add.i = fadd <8 x float> %x, %y
- ret <8 x float> %add.i
-}
-
-; CHECK: vaddps LCP{{.*}}(%rip)
-define <8 x float> @addps256fold(<8 x float> %y) nounwind uwtable readnone ssp {
-entry:
- %add.i = fadd <8 x float> %y,
- ret <8 x float> %add.i
-}
-
-; CHECK: vsubpd
-define <4 x double> @subpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %sub.i = fsub <4 x double> %x, %y
- ret <4 x double> %sub.i
-}
-
-; CHECK: vsubpd (%
-define <4 x double> @subpd256fold(<4 x double> %y, <4 x double>* nocapture %x) nounwind uwtable readonly ssp {
-entry:
- %tmp2 = load <4 x double>* %x, align 32
- %sub.i = fsub <4 x double> %y, %tmp2
- ret <4 x double> %sub.i
-}
-
-; CHECK: vsubps
-define <8 x float> @subps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %sub.i = fsub <8 x float> %x, %y
- ret <8 x float> %sub.i
-}
-
-; CHECK: vsubps (%
-define <8 x float> @subps256fold(<8 x float> %y, <8 x float>* nocapture %x) nounwind uwtable readonly ssp {
-entry:
- %tmp2 = load <8 x float>* %x, align 32
- %sub.i = fsub <8 x float> %y, %tmp2
- ret <8 x float> %sub.i
-}
-
-; CHECK: vmulpd
-define <4 x double> @mulpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %mul.i = fmul <4 x double> %x, %y
- ret <4 x double> %mul.i
-}
-
-; CHECK: vmulpd LCP{{.*}}(%rip)
-define <4 x double> @mulpd256fold(<4 x double> %y) nounwind uwtable readnone ssp {
-entry:
- %mul.i = fmul <4 x double> %y,
- ret <4 x double> %mul.i
-}
-
-; CHECK: vmulps
-define <8 x float> @mulps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %mul.i = fmul <8 x float> %x, %y
- ret <8 x float> %mul.i
-}
-
-; CHECK: vmulps LCP{{.*}}(%rip)
-define <8 x float> @mulps256fold(<8 x float> %y) nounwind uwtable readnone ssp {
-entry:
- %mul.i = fmul <8 x float> %y,
- ret <8 x float> %mul.i
-}
-
-; CHECK: vdivpd
-define <4 x double> @divpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %div.i = fdiv <4 x double> %x, %y
- ret <4 x double> %div.i
-}
-
-; CHECK: vdivpd LCP{{.*}}(%rip)
-define <4 x double> @divpd256fold(<4 x double> %y) nounwind uwtable readnone ssp {
-entry:
- %div.i = fdiv <4 x double> %y,
- ret <4 x double> %div.i
-}
-
-; CHECK: vdivps
-define <8 x float> @divps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %div.i = fdiv <8 x float> %x, %y
- ret <8 x float> %div.i
-}
-
-; CHECK: vdivps LCP{{.*}}(%rip)
-define <8 x float> @divps256fold(<8 x float> %y) nounwind uwtable readnone ssp {
-entry:
- %div.i = fdiv <8 x float> %y,
- ret <8 x float> %div.i
-}
-
Removed: llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-256-cmp.ll (removed)
@@ -1,18 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
-; CHECK: vcmpltps %ymm
-; CHECK-NOT: vucomiss
-define <8 x i32> @cmp00(<8 x float> %a, <8 x float> %b) nounwind readnone {
- %bincmp = fcmp olt <8 x float> %a, %b
- %s = sext <8 x i1> %bincmp to <8 x i32>
- ret <8 x i32> %s
-}
-
-; CHECK: vcmpltpd %ymm
-; CHECK-NOT: vucomisd
-define <4 x i64> @cmp01(<4 x double> %a, <4 x double> %b) nounwind readnone {
- %bincmp = fcmp olt <4 x double> %a, %b
- %s = sext <4 x i1> %bincmp to <4 x i64>
- ret <4 x i64> %s
-}
-
Removed: llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll (removed)
@@ -1,21 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
-; CHECK: vcvtdq2ps %ymm
-define <8 x float> @funcA(<8 x i32> %a) nounwind {
- %b = sitofp <8 x i32> %a to <8 x float>
- ret <8 x float> %b
-}
-
-; CHECK: vcvttps2dq %ymm
-define <8 x i32> @funcB(<8 x float> %a) nounwind {
- %b = fptosi <8 x float> %a to <8 x i32>
- ret <8 x i32> %b
-}
-
-; CHECK: vcvtpd2psy %ymm
-; CHECK-NEXT: vcvtpd2psy %ymm
-; CHECK-NEXT: vinsertf128 $1
-define <8 x float> @funcC(<8 x double> %b) nounwind {
- %a = fptrunc <8 x double> %b to <8 x float>
- ret <8 x float> %a
-}
Removed: llvm/trunk/test/CodeGen/X86/avx-256-logic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-logic.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-logic.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-256-logic.ll (removed)
@@ -1,161 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
-; CHECK: vandpd
-define <4 x double> @andpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x double> %x to <4 x i64>
- %1 = bitcast <4 x double> %y to <4 x i64>
- %and.i = and <4 x i64> %0, %1
- %2 = bitcast <4 x i64> %and.i to <4 x double>
- ret <4 x double> %2
-}
-
-; CHECK: vandpd LCP{{.*}}(%rip)
-define <4 x double> @andpd256fold(<4 x double> %y) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x double> %y to <4 x i64>
- %and.i = and <4 x i64> %0,
- %1 = bitcast <4 x i64> %and.i to <4 x double>
- ret <4 x double> %1
-}
-
-; CHECK: vandps
-define <8 x float> @andps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <8 x float> %x to <8 x i32>
- %1 = bitcast <8 x float> %y to <8 x i32>
- %and.i = and <8 x i32> %0, %1
- %2 = bitcast <8 x i32> %and.i to <8 x float>
- ret <8 x float> %2
-}
-
-; CHECK: vandps LCP{{.*}}(%rip)
-define <8 x float> @andps256fold(<8 x float> %y) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <8 x float> %y to <8 x i32>
- %and.i = and <8 x i32> %0,
- %1 = bitcast <8 x i32> %and.i to <8 x float>
- ret <8 x float> %1
-}
-
-; CHECK: vxorpd
-define <4 x double> @xorpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x double> %x to <4 x i64>
- %1 = bitcast <4 x double> %y to <4 x i64>
- %xor.i = xor <4 x i64> %0, %1
- %2 = bitcast <4 x i64> %xor.i to <4 x double>
- ret <4 x double> %2
-}
-
-; CHECK: vxorpd LCP{{.*}}(%rip)
-define <4 x double> @xorpd256fold(<4 x double> %y) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x double> %y to <4 x i64>
- %xor.i = xor <4 x i64> %0,
- %1 = bitcast <4 x i64> %xor.i to <4 x double>
- ret <4 x double> %1
-}
-
-; CHECK: vxorps
-define <8 x float> @xorps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <8 x float> %x to <8 x i32>
- %1 = bitcast <8 x float> %y to <8 x i32>
- %xor.i = xor <8 x i32> %0, %1
- %2 = bitcast <8 x i32> %xor.i to <8 x float>
- ret <8 x float> %2
-}
-
-; CHECK: vxorps LCP{{.*}}(%rip)
-define <8 x float> @xorps256fold(<8 x float> %y) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <8 x float> %y to <8 x i32>
- %xor.i = xor <8 x i32> %0,
- %1 = bitcast <8 x i32> %xor.i to <8 x float>
- ret <8 x float> %1
-}
-
-; CHECK: vorpd
-define <4 x double> @orpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x double> %x to <4 x i64>
- %1 = bitcast <4 x double> %y to <4 x i64>
- %or.i = or <4 x i64> %0, %1
- %2 = bitcast <4 x i64> %or.i to <4 x double>
- ret <4 x double> %2
-}
-
-; CHECK: vorpd LCP{{.*}}(%rip)
-define <4 x double> @orpd256fold(<4 x double> %y) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x double> %y to <4 x i64>
- %or.i = or <4 x i64> %0,
- %1 = bitcast <4 x i64> %or.i to <4 x double>
- ret <4 x double> %1
-}
-
-; CHECK: vorps
-define <8 x float> @orps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <8 x float> %x to <8 x i32>
- %1 = bitcast <8 x float> %y to <8 x i32>
- %or.i = or <8 x i32> %0, %1
- %2 = bitcast <8 x i32> %or.i to <8 x float>
- ret <8 x float> %2
-}
-
-; CHECK: vorps LCP{{.*}}(%rip)
-define <8 x float> @orps256fold(<8 x float> %y) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <8 x float> %y to <8 x i32>
- %or.i = or <8 x i32> %0,
- %1 = bitcast <8 x i32> %or.i to <8 x float>
- ret <8 x float> %1
-}
-
-; CHECK: vandnpd
-define <4 x double> @andnotpd256(<4 x double> %y, <4 x double> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x double> %x to <4 x i64>
- %neg.i = xor <4 x i64> %0,
- %1 = bitcast <4 x double> %y to <4 x i64>
- %and.i = and <4 x i64> %1, %neg.i
- %2 = bitcast <4 x i64> %and.i to <4 x double>
- ret <4 x double> %2
-}
-
-; CHECK: vandnpd (%
-define <4 x double> @andnotpd256fold(<4 x double> %y, <4 x double>* nocapture %x) nounwind uwtable readonly ssp {
-entry:
- %tmp2 = load <4 x double>* %x, align 32
- %0 = bitcast <4 x double> %y to <4 x i64>
- %neg.i = xor <4 x i64> %0,
- %1 = bitcast <4 x double> %tmp2 to <4 x i64>
- %and.i = and <4 x i64> %1, %neg.i
- %2 = bitcast <4 x i64> %and.i to <4 x double>
- ret <4 x double> %2
-}
-
-; CHECK: vandnps
-define <8 x float> @andnotps256(<8 x float> %y, <8 x float> %x) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <8 x float> %x to <8 x i32>
- %neg.i = xor <8 x i32> %0,
- %1 = bitcast <8 x float> %y to <8 x i32>
- %and.i = and <8 x i32> %1, %neg.i
- %2 = bitcast <8 x i32> %and.i to <8 x float>
- ret <8 x float> %2
-}
-
-; CHECK: vandnps (%
-define <8 x float> @andnotps256fold(<8 x float> %y, <8 x float>* nocapture %x) nounwind uwtable readonly ssp {
-entry:
- %tmp2 = load <8 x float>* %x, align 32
- %0 = bitcast <8 x float> %y to <8 x i32>
- %neg.i = xor <8 x i32> %0,
- %1 = bitcast <8 x float> %tmp2 to <8 x i32>
- %and.i = and <8 x i32> %1, %neg.i
- %2 = bitcast <8 x i32> %and.i to <8 x float>
- ret <8 x float> %2
-}
Removed: llvm/trunk/test/CodeGen/X86/avx-256-movdup.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-movdup.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-movdup.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-256-movdup.ll (removed)
@@ -1,34 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
-; CHECK: vmovsldup
-define <8 x float> @movdupA(<8 x float> %src) nounwind uwtable readnone ssp {
-entry:
- %shuffle.i = shufflevector <8 x float> %src, <8 x float> undef, <8 x i32>
- ret <8 x float> %shuffle.i
-}
-
-; CHECK: vmovshdup
-define <8 x float> @movdupB(<8 x float> %src) nounwind uwtable readnone ssp {
-entry:
- %shuffle.i = shufflevector <8 x float> %src, <8 x float> undef, <8 x i32>
- ret <8 x float> %shuffle.i
-}
-
-; CHECK: vmovsldup
-define <4 x i64> @movdupC(<4 x i64> %src) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x i64> %src to <8 x float>
- %shuffle.i = shufflevector <8 x float> %0, <8 x float> undef, <8 x i32>
- %1 = bitcast <8 x float> %shuffle.i to <4 x i64>
- ret <4 x i64> %1
-}
-
-; CHECK: vmovshdup
-define <4 x i64> @movdupD(<4 x i64> %src) nounwind uwtable readnone ssp {
-entry:
- %0 = bitcast <4 x i64> %src to <8 x float>
- %shuffle.i = shufflevector <8 x float> %0, <8 x float> undef, <8 x i32>
- %1 = bitcast <8 x float> %shuffle.i to <4 x i64>
- ret <4 x i64> %1
-}
-
Removed: llvm/trunk/test/CodeGen/X86/avx-256-splat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-splat.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-splat.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-256-splat.ll (removed)
@@ -1,79 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
-; FIXME: use avx versions for punpcklbw, punpckhbw and punpckhwd
-
-; CHECK: vextractf128 $0
-; CHECK-NEXT: punpcklbw
-; CHECK-NEXT: punpckhbw
-; CHECK-NEXT: vinsertf128 $1
-; CHECK-NEXT: vpermilps $85
-define <32 x i8> @funcA(<32 x i8> %a) nounwind uwtable readnone ssp {
-entry:
- %shuffle = shufflevector <32 x i8> %a, <32 x i8> undef, <32 x i32>
- ret <32 x i8> %shuffle
-}
-
-; CHECK: vextractf128 $0
-; CHECK-NEXT: punpckhwd
-; CHECK-NEXT: vinsertf128 $1
-; CHECK-NEXT: vpermilps $85
-define <16 x i16> @funcB(<16 x i16> %a) nounwind uwtable readnone ssp {
-entry:
- %shuffle = shufflevector <16 x i16> %a, <16 x i16> undef, <16 x i32>
- ret <16 x i16> %shuffle
-}
-
-; CHECK: vmovd
-; CHECK-NEXT: movlhps
-; CHECK-NEXT: vinsertf128 $1
-define <4 x i64> @funcC(i64 %q) nounwind uwtable readnone ssp {
-entry:
- %vecinit.i = insertelement <4 x i64> undef, i64 %q, i32 0
- %vecinit2.i = insertelement <4 x i64> %vecinit.i, i64 %q, i32 1
- %vecinit4.i = insertelement <4 x i64> %vecinit2.i, i64 %q, i32 2
- %vecinit6.i = insertelement <4 x i64> %vecinit4.i, i64 %q, i32 3
- ret <4 x i64> %vecinit6.i
-}
-
-; CHECK: vshufpd
-; CHECK-NEXT: vinsertf128 $1
-define <4 x double> @funcD(double %q) nounwind uwtable readnone ssp {
-entry:
- %vecinit.i = insertelement <4 x double> undef, double %q, i32 0
- %vecinit2.i = insertelement <4 x double> %vecinit.i, double %q, i32 1
- %vecinit4.i = insertelement <4 x double> %vecinit2.i, double %q, i32 2
- %vecinit6.i = insertelement <4 x double> %vecinit4.i, double %q, i32 3
- ret <4 x double> %vecinit6.i
-}
-
-; Test this simple opt:
-; shuffle (scalar_to_vector (load (ptr + 4))), undef, <0, 0, 0, 0>
-; To:
-; shuffle (vload ptr)), undef, <1, 1, 1, 1>
-; CHECK: vmovaps
-; CHECK-NEXT: vpextrd
-define void @funcE() nounwind {
-allocas:
- %udx495 = alloca [18 x [18 x float]], align 32
- br label %for_test505.preheader
-
-for_test505.preheader: ; preds = %for_test505.preheader, %allocas
- br i1 undef, label %for_exit499, label %for_test505.preheader
-
-for_exit499: ; preds = %for_test505.preheader
- br i1 undef, label %__load_and_broadcast_32.exit1249, label %load.i1247
-
-load.i1247: ; preds = %for_exit499
- %ptr1227 = getelementptr [18 x [18 x float]]* %udx495, i64 0, i64 1, i64 1
- %ptr.i1237 = bitcast float* %ptr1227 to i32*
- %val.i1238 = load i32* %ptr.i1237, align 4
- %ret6.i1245 = insertelement <8 x i32> undef, i32 %val.i1238, i32 6
- %ret7.i1246 = insertelement <8 x i32> %ret6.i1245, i32 %val.i1238, i32 7
- %phitmp = bitcast <8 x i32> %ret7.i1246 to <8 x float>
- br label %__load_and_broadcast_32.exit1249
-
-__load_and_broadcast_32.exit1249: ; preds = %load.i1247, %for_exit499
- %load_broadcast12281250 = phi <8 x float> [ %phitmp, %load.i1247 ], [ undef, %for_exit499 ]
- ret void
-}
-
Removed: llvm/trunk/test/CodeGen/X86/avx-256-unpack.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-unpack.ll?rev=137102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-256-unpack.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-256-unpack.ll (removed)
@@ -1,58 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
-
-; CHECK: vunpckhps
-define <8 x float> @unpackhips(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp {
-entry:
- %shuffle.i = shufflevector <8 x float> %src1, <8 x float> %src2, <8 x i32>
- ret <8 x float> %shuffle.i
-}
-
-; CHECK: vunpckhpd
-define <4 x double> @unpackhipd(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp {
-entry:
- %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32>