From nadav.rotem at intel.com Mon Dec 5 00:29:10 2011
From: nadav.rotem at intel.com (Nadav Rotem)
Date: Mon, 05 Dec 2011 06:29:10 -0000
Subject: [llvm-commits] [llvm] r145801 - in /llvm/trunk: docs/ include/llvm/
include/llvm/Target/ lib/Analysis/ lib/AsmParser/ lib/CodeGen/SelectionDAG/
lib/Transforms/InstCombine/ lib/Transforms/Scalar/ lib/VMCore/
test/CodeGen/X86/ test/Feature/ test/Transforms/InstCombine/
test/Transforms/InstSimplify/ unittests/VMCore/
Message-ID: <20111205062911.265551BE003@llvm.org>
Author: nadav
Date: Mon Dec 5 00:29:09 2011
New Revision: 145801
URL: http://llvm.org/viewvc/llvm-project?rev=145801&view=rev
Log:
Add support for vectors of pointers.
Added:
llvm/trunk/test/CodeGen/X86/pointer-vector.ll
llvm/trunk/test/CodeGen/X86/vector-gep.ll
llvm/trunk/test/Feature/const_pv.ll
llvm/trunk/test/Feature/global_pv.ll
llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll
llvm/trunk/test/Transforms/InstSimplify/vector_gep.ll
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/include/llvm/DerivedTypes.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/Operator.h
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/include/llvm/Type.h
llvm/trunk/lib/Analysis/ConstantFolding.cpp
llvm/trunk/lib/Analysis/InstructionSimplify.cpp
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
llvm/trunk/lib/VMCore/Type.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
llvm/trunk/unittests/VMCore/InstructionsTest.cpp
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Dec 5 00:29:09 2011
@@ -2189,8 +2189,8 @@
The number of elements is a constant integer value larger than 0; elementtype
- may be any integer or floating point type. Vectors of size zero are not
- allowed, and pointers are not allowed as the element type.
+ may be any integer or floating point type, or a pointer to these types.
+ Vectors of size zero are not allowed.
@@ -5077,7 +5082,8 @@
It performs address calculation only and does not access memory.
Arguments:
-
The first argument is always a pointer, and forms the basis of the
+
The first argument is always a pointer or a vector of pointers,
+ and forms the basis of the
calculation. The remaining arguments are indices that indicate which of the
elements of the aggregate object are indexed. The interpretation of each
index is dependent on the type being indexed into. The first index always
@@ -5162,7 +5168,9 @@
precise signed arithmetic are not an in bounds address of that
allocated object. The in bounds addresses for an allocated object
are all the addresses that point into the object, plus the address one
- byte past the end.
+ byte past the end.
+ In cases where the base is a vector of pointers the inbounds keyword
+ applies to each of the computations element-wise.
If the inbounds keyword is not present, the offsets are added to
the base address with silently-wrapping two's complement arithmetic. If the
@@ -5189,6 +5197,13 @@
%iptr = getelementptr [10 x i32]* @arr, i16 0, i16 0
+
In cases where the pointer argument is a vector of pointers, only a
+ single index may be used, and the number of vector elements has to be
+ the same. For example:
+
+ %A = getelementptr <4 x i8*> %ptrs, <4 x i64> %offsets,
+
+
@@ -5561,13 +5576,16 @@
Overview:
-
The 'ptrtoint' instruction converts the pointer value to
- the integer type ty2.
+
The 'ptrtoint' instruction converts the pointer or a vector of
+ pointers value to
+ the integer (or vector of integers) type ty2.
Arguments:
The 'ptrtoint' instruction takes a value to cast, which
- must be a pointer value, and a type to cast it to
- ty2, which must be an integer type.
+ must be a a value of type pointer or a vector of
+ pointers, and a type to cast it to
+ ty2, which must be an integer or a vector
+ of integers type.
Semantics:
The 'ptrtoint' instruction converts value to integer type
@@ -5580,8 +5598,9 @@
Example:
- %X = ptrtoint i32* %X to i8 ; yields truncation on 32-bit architecture
- %Y = ptrtoint i32* %x to i64 ; yields zero extension on 32-bit architecture
+ %X = ptrtoint i32* %P to i8 ; yields truncation on 32-bit architecture
+ %Y = ptrtoint i32* %P to i64 ; yields zero extension on 32-bit architecture
+ %Z = ptrtoint <4 x i32*> %P to <4 x i64>; yields vector zero extension for a vector of addresses on 32-bit architecture
@@ -5620,6 +5639,7 @@
%X = inttoptr i32 255 to i32* ; yields zero extension on 64-bit architecture
%Y = inttoptr i32 255 to i32* ; yields no-op on 32-bit architecture
%Z = inttoptr i64 0 to i32* ; yields truncation on 32-bit architecture
+ %Z = inttoptr <4 x i32> %G to <4 x i8*>; yields truncation of vector G to four pointers
@@ -5654,8 +5674,9 @@
The 'bitcast' instruction converts value to type
ty2. It is always a no-op cast because no bits change with
this conversion. The conversion is done as if the value had been
- stored to memory and read back as type ty2. Pointer types may only
- be converted to other pointer types with this instruction. To convert
+ stored to memory and read back as type ty2.
+ Pointer (or vector of pointers) types may only be converted to other pointer
+ (or vector of pointers) types with this instruction. To convert
pointers to other types, use the inttoptr or
ptrtoint instructions first.
@@ -5663,7 +5684,8 @@
%X = bitcast i8 255 to i8 ; yields i8 :-1
%Y = bitcast i32* %x to sint* ; yields sint*:%x
- %Z = bitcast <2 x int> %V to i64; ; yields i64: %V
+ %Z = bitcast <2 x int> %V to i64; ; yields i64: %V
+ %Z = bitcast <2 x i32*> %V to <2 x i64*> ; yields <2 x i64*>
@@ -5694,8 +5716,8 @@
Overview:
The 'icmp' instruction returns a boolean value or a vector of
- boolean values based on comparison of its two integer, integer vector, or
- pointer operands.
+ boolean values based on comparison of its two integer, integer vector,
+ pointer, or pointer vector operands.
Arguments:
The 'icmp' instruction takes three operands. The first operand is
Modified: llvm/trunk/include/llvm/DerivedTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DerivedTypes.h (original)
+++ llvm/trunk/include/llvm/DerivedTypes.h Mon Dec 5 00:29:09 2011
@@ -374,6 +374,7 @@
///
static VectorType *getInteger(VectorType *VTy) {
unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
+ assert(EltBits && "Element size must be of a non-zero size");
Type *EltTy = IntegerType::get(VTy->getContext(), EltBits);
return VectorType::get(EltTy, VTy->getNumElements());
}
@@ -408,6 +409,7 @@
unsigned getNumElements() const { return NumElements; }
/// @brief Return the number of bits in the Vector type.
+ /// Returns zero when the vector is a vector of pointers.
unsigned getBitWidth() const {
return NumElements * getElementType()->getPrimitiveSizeInBits();
}
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon Dec 5 00:29:09 2011
@@ -776,6 +776,10 @@
static Type *getIndexedType(Type *Ptr, ArrayRef IdxList);
static Type *getIndexedType(Type *Ptr, ArrayRef IdxList);
+ /// getIndexedType - Returns the address space used by the GEP pointer.
+ ///
+ static unsigned getAddressSpace(Value *Ptr);
+
inline op_iterator idx_begin() { return op_begin()+1; }
inline const_op_iterator idx_begin() const { return op_begin()+1; }
inline op_iterator idx_end() { return op_end(); }
@@ -788,7 +792,7 @@
return getOperand(0);
}
static unsigned getPointerOperandIndex() {
- return 0U; // get index for modifying correct operand
+ return 0U; // get index for modifying correct operand.
}
unsigned getPointerAddressSpace() const {
@@ -797,10 +801,25 @@
/// getPointerOperandType - Method to return the pointer operand as a
/// PointerType.
- PointerType *getPointerOperandType() const {
- return reinterpret_cast(getPointerOperand()->getType());
+ Type *getPointerOperandType() const {
+ return getPointerOperand()->getType();
}
+ /// GetGEPReturnType - Returns the pointer type returned by the GEP
+ /// instruction, which may be a vector of pointers.
+ static Type *getGEPReturnType(Value *Ptr, ArrayRef IdxList) {
+ Type *PtrTy = PointerType::get(checkGEPType(
+ getIndexedType(Ptr->getType(), IdxList)),
+ getAddressSpace(Ptr));
+ // Vector GEP
+ if (Ptr->getType()->isVectorTy()) {
+ unsigned NumElem = cast(Ptr->getType())->getNumElements();
+ return VectorType::get(PtrTy, NumElem);
+ }
+
+ // Scalar GEP
+ return PtrTy;
+ }
unsigned getNumIndices() const { // Note: always non-negative
return getNumOperands() - 1;
@@ -847,10 +866,7 @@
unsigned Values,
const Twine &NameStr,
Instruction *InsertBefore)
- : Instruction(PointerType::get(checkGEPType(
- getIndexedType(Ptr->getType(), IdxList)),
- cast(Ptr->getType())
- ->getAddressSpace()),
+ : Instruction(getGEPReturnType(Ptr, IdxList),
GetElementPtr,
OperandTraits::op_end(this) - Values,
Values, InsertBefore) {
@@ -861,10 +877,7 @@
unsigned Values,
const Twine &NameStr,
BasicBlock *InsertAtEnd)
- : Instruction(PointerType::get(checkGEPType(
- getIndexedType(Ptr->getType(), IdxList)),
- cast(Ptr->getType())
- ->getAddressSpace()),
+ : Instruction(getGEPReturnType(Ptr, IdxList),
GetElementPtr,
OperandTraits::op_end(this) - Values,
Values, InsertAtEnd) {
@@ -905,7 +918,7 @@
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
- getOperand(0)->getType()->isPointerTy()) &&
+ getOperand(0)->getType()->getScalarType()->isPointerTy()) &&
"Invalid operand types for ICmp instruction");
}
@@ -945,7 +958,7 @@
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
- getOperand(0)->getType()->isPointerTy()) &&
+ getOperand(0)->getType()->getScalarType()->isPointerTy()) &&
"Invalid operand types for ICmp instruction");
}
Modified: llvm/trunk/include/llvm/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Operator.h (original)
+++ llvm/trunk/include/llvm/Operator.h Mon Dec 5 00:29:09 2011
@@ -261,8 +261,8 @@
/// getPointerOperandType - Method to return the pointer operand as a
/// PointerType.
- PointerType *getPointerOperandType() const {
- return reinterpret_cast(getPointerOperand()->getType());
+ Type *getPointerOperandType() const {
+ return getPointerOperand()->getType();
}
unsigned getNumIndices() const { // Note: always non-negative
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Dec 5 00:29:09 2011
@@ -520,8 +520,19 @@
/// AllowUnknown is true, this will return MVT::Other for types with no EVT
/// counterpart (e.g. structs), otherwise it will assert.
EVT getValueType(Type *Ty, bool AllowUnknown = false) const {
- EVT VT = EVT::getEVT(Ty, AllowUnknown);
- return VT == MVT::iPTR ? PointerTy : VT;
+ // Lower scalar pointers to native pointer types.
+ if (Ty->isPointerTy()) return PointerTy;
+
+ if (Ty->isVectorTy()) {
+ VectorType *VTy = cast(Ty);
+ Type *Elm = VTy->getElementType();
+ // Lower vectors of pointers to native pointer types.
+ if (Elm->isPointerTy())
+ Elm = EVT(PointerTy).getTypeForEVT(Ty->getContext());
+ return EVT::getVectorVT(Ty->getContext(), EVT::getEVT(Elm, false),
+ VTy->getNumElements());
+ }
+ return EVT::getEVT(Ty, AllowUnknown);
}
/// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Mon Dec 5 00:29:09 2011
@@ -273,6 +273,10 @@
/// otherwise return 'this'.
Type *getScalarType();
+ /// getNumElements - If this is a vector type, return the number of elements,
+ /// otherwise return zero.
+ unsigned getNumElements();
+
//===--------------------------------------------------------------------===//
// Type Iteration support.
//
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Dec 5 00:29:09 2011
@@ -580,7 +580,8 @@
Type *ResultTy, const TargetData *TD,
const TargetLibraryInfo *TLI) {
Constant *Ptr = Ops[0];
- if (!TD || !cast(Ptr->getType())->getElementType()->isSized())
+ if (!TD || !cast(Ptr->getType())->getElementType()->isSized() ||
+ !Ptr->getType()->isPointerTy())
return 0;
Type *IntPtrTy = TD->getIntPtrType(Ptr->getContext());
Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Mon Dec 5 00:29:09 2011
@@ -1764,7 +1764,7 @@
// also a case of comparing two zero-extended values.
if (RExt == CI && MaxRecurse)
if (Value *V = SimplifyICmpInst(ICmpInst::getUnsignedPredicate(Pred),
- SrcOp, Trunc, TD, TLI, DT, MaxRecurse-1))
+ SrcOp, Trunc, TD, TLI, DT, MaxRecurse-1))
return V;
// Otherwise the upper bits of LHS are zero while RHS has a non-zero bit
@@ -2359,7 +2359,10 @@
Value *llvm::SimplifyGEPInst(ArrayRef Ops, const TargetData *TD,
const DominatorTree *) {
// The type of the GEP pointer operand.
- PointerType *PtrTy = cast(Ops[0]->getType());
+ PointerType *PtrTy = dyn_cast(Ops[0]->getType());
+ // The GEP pointer operand is not a pointer, it's a vector of pointers.
+ if (!PtrTy)
+ return 0;
// getelementptr P -> P.
if (Ops.size() == 1)
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Dec 5 00:29:09 2011
@@ -63,13 +63,14 @@
assert(V && "No Value?");
assert(Depth <= MaxDepth && "Limit Search Depth");
unsigned BitWidth = Mask.getBitWidth();
- assert((V->getType()->isIntOrIntVectorTy() || V->getType()->isPointerTy())
- && "Not integer or pointer type!");
+ assert((V->getType()->isIntOrIntVectorTy() ||
+ V->getType()->getScalarType()->isPointerTy()) &&
+ "Not integer or pointer type!");
assert((!TD ||
TD->getTypeSizeInBits(V->getType()->getScalarType()) == BitWidth) &&
(!V->getType()->isIntOrIntVectorTy() ||
V->getType()->getScalarSizeInBits() == BitWidth) &&
- KnownZero.getBitWidth() == BitWidth &&
+ KnownZero.getBitWidth() == BitWidth &&
KnownOne.getBitWidth() == BitWidth &&
"V, Mask, KnownOne and KnownZero should have same BitWidth");
@@ -1557,7 +1558,8 @@
Value *llvm::GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset,
const TargetData &TD) {
Operator *PtrOp = dyn_cast(Ptr);
- if (PtrOp == 0) return Ptr;
+ if (PtrOp == 0 || Ptr->getType()->isVectorTy())
+ return Ptr;
// Just look through bitcasts.
if (PtrOp->getOpcode() == Instruction::BitCast)
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Dec 5 00:29:09 2011
@@ -1607,7 +1607,8 @@
if ((unsigned)Size != Size)
return Error(SizeLoc, "size too large for vector");
if (!VectorType::isValidElementType(EltTy))
- return Error(TypeLoc, "vector element type must be fp or integer");
+ return Error(TypeLoc,
+ "vector element type must be fp, integer or a pointer to these types");
Result = VectorType::get(EltTy, unsigned(Size));
} else {
if (!ArrayType::isValidElementType(EltTy))
@@ -1966,9 +1967,10 @@
return Error(ID.Loc, "constant vector must not be empty");
if (!Elts[0]->getType()->isIntegerTy() &&
- !Elts[0]->getType()->isFloatingPointTy())
+ !Elts[0]->getType()->isFloatingPointTy() &&
+ !Elts[0]->getType()->isPointerTy())
return Error(FirstEltLoc,
- "vector elements must have integer or floating point type");
+ "vector elements must have integer, pointer or floating point type");
// Verify that all the vector elements have the same type.
for (unsigned i = 1, e = Elts.size(); i != e; ++i)
@@ -2160,7 +2162,7 @@
} else {
assert(Opc == Instruction::ICmp && "Unexpected opcode for CmpInst!");
if (!Val0->getType()->isIntOrIntVectorTy() &&
- !Val0->getType()->isPointerTy())
+ !Val0->getType()->getScalarType()->isPointerTy())
return Error(ID.Loc, "icmp requires pointer or integer operands");
ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1);
}
@@ -2294,7 +2296,8 @@
return true;
if (Opc == Instruction::GetElementPtr) {
- if (Elts.size() == 0 || !Elts[0]->getType()->isPointerTy())
+ if (Elts.size() == 0 ||
+ !Elts[0]->getType()->getScalarType()->isPointerTy())
return Error(ID.Loc, "getelementptr requires pointer operand");
ArrayRef Indices(Elts.begin() + 1, Elts.end());
@@ -3329,7 +3332,7 @@
} else {
assert(Opc == Instruction::ICmp && "Unknown opcode for CmpInst!");
if (!LHS->getType()->isIntOrIntVectorTy() &&
- !LHS->getType()->isPointerTy())
+ !LHS->getType()->getScalarType()->isPointerTy())
return Error(Loc, "icmp requires integer operands");
Inst = new ICmpInst(CmpInst::Predicate(Pred), LHS, RHS);
}
@@ -3877,13 +3880,15 @@
/// ParseGetElementPtr
/// ::= 'getelementptr' 'inbounds'? TypeAndValue (',' TypeAndValue)*
int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
- Value *Ptr, *Val; LocTy Loc, EltLoc;
+ Value *Ptr = 0;
+ Value *Val = 0;
+ LocTy Loc, EltLoc;
bool InBounds = EatIfPresent(lltok::kw_inbounds);
if (ParseTypeAndValue(Ptr, Loc, PFS)) return true;
- if (!Ptr->getType()->isPointerTy())
+ if (!Ptr->getType()->getScalarType()->isPointerTy())
return Error(Loc, "base of getelementptr must be a pointer");
SmallVector Indices;
@@ -3894,11 +3899,23 @@
break;
}
if (ParseTypeAndValue(Val, EltLoc, PFS)) return true;
- if (!Val->getType()->isIntegerTy())
+ if (!Val->getType()->getScalarType()->isIntegerTy())
return Error(EltLoc, "getelementptr index must be an integer");
+ if (Val->getType()->isVectorTy() != Ptr->getType()->isVectorTy())
+ return Error(EltLoc, "getelementptr index type missmatch");
+ if (Val->getType()->isVectorTy()) {
+ unsigned ValNumEl = cast(Val->getType())->getNumElements();
+ unsigned PtrNumEl = cast(Ptr->getType())->getNumElements();
+ if (ValNumEl != PtrNumEl)
+ return Error(EltLoc,
+ "getelementptr vector index has a wrong number of elements");
+ }
Indices.push_back(Val);
}
+ if (Val && Val->getType()->isVectorTy() && Indices.size() != 1)
+ return Error(EltLoc, "vector getelementptrs must have a single index");
+
if (!GetElementPtrInst::getIndexedType(Ptr->getType(), Indices))
return Error(Loc, "invalid getelementptr indices");
Inst = GetElementPtrInst::Create(Ptr, Indices);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 5 00:29:09 2011
@@ -3099,7 +3099,7 @@
unsigned Amt = ElementSize.logBase2();
IdxN = DAG.getNode(ISD::SHL, getCurDebugLoc(),
N.getValueType(), IdxN,
- DAG.getConstant(Amt, TLI.getPointerTy()));
+ DAG.getConstant(Amt, IdxN.getValueType()));
} else {
SDValue Scale = DAG.getConstant(ElementSize, TLI.getPointerTy());
IdxN = DAG.getNode(ISD::MUL, getCurDebugLoc(),
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Mon Dec 5 00:29:09 2011
@@ -265,6 +265,8 @@
// Get the current byte offset into the thing. Use the original
// operand in case we're looking through a bitcast.
SmallVector Ops(GEP->idx_begin(), GEP->idx_end());
+ if (!GEP->getPointerOperandType()->isPointerTy())
+ return 0;
Offset = TD->getIndexedOffset(GEP->getPointerOperandType(), Ops);
Op1 = GEP->getPointerOperand()->stripPointerCasts();
Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Mon Dec 5 00:29:09 2011
@@ -831,7 +831,8 @@
MadeChange = true;
}
- if ((*I)->getType() != IntPtrTy) {
+ Type *IndexTy = (*I)->getType();
+ if (IndexTy != IntPtrTy && !IndexTy->isVectorTy()) {
// If we are using a wider index than needed for this platform, shrink
// it to what we need. If narrower, sign-extend it to what we need.
// This explicit cast can make subsequent optimizations more obvious.
@@ -914,7 +915,11 @@
// Handle gep(bitcast x) and gep(gep x, 0, 0, 0).
Value *StrippedPtr = PtrOp->stripPointerCasts();
- PointerType *StrippedPtrTy =cast(StrippedPtr->getType());
+ PointerType *StrippedPtrTy = dyn_cast(StrippedPtr->getType());
+ // We do not handle pointer-vector geps here
+ if (!StrippedPtr)
+ return 0;
+
if (StrippedPtr != PtrOp &&
StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace()) {
Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Dec 5 00:29:09 2011
@@ -178,6 +178,11 @@
// base of a recurrence. This handles the case in which SCEV expansion
// converts a pointer type recurrence into a nonrecurrent pointer base
// indexed by an integer recurrence.
+
+ // If the GEP base pointer is a vector of pointers, abort.
+ if (!FromPtr->getType()->isPointerTy() || !ToPtr->getType()->isPointerTy())
+ return false;
+
const SCEV *FromBase = SE->getPointerBase(SE->getSCEV(FromPtr));
const SCEV *ToBase = SE->getPointerBase(SE->getSCEV(ToPtr));
if (FromBase == ToBase)
Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Dec 5 00:29:09 2011
@@ -453,6 +453,8 @@
// Compute the offset that this GEP adds to the pointer.
SmallVector Indices(GEP->op_begin()+1, GEP->op_end());
+ if (!GEP->getPointerOperandType()->isPointerTy())
+ return false;
uint64_t GEPOffset = TD.getIndexedOffset(GEP->getPointerOperandType(),
Indices);
// See if all uses can be converted.
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Dec 5 00:29:09 2011
@@ -1398,14 +1398,22 @@
}
Constant *ConstantExpr::getPtrToInt(Constant *C, Type *DstTy) {
- assert(C->getType()->isPointerTy() && "PtrToInt source must be pointer");
- assert(DstTy->isIntegerTy() && "PtrToInt destination must be integral");
+ assert(C->getType()->getScalarType()->isPointerTy() &&
+ "PtrToInt source must be pointer or pointer vector");
+ assert(DstTy->getScalarType()->isIntegerTy() &&
+ "PtrToInt destination must be integer or integer vector");
+ assert(C->getType()->getNumElements() == DstTy->getNumElements() &&
+ "Invalid cast between a different number of vector elements");
return getFoldedCast(Instruction::PtrToInt, C, DstTy);
}
Constant *ConstantExpr::getIntToPtr(Constant *C, Type *DstTy) {
- assert(C->getType()->isIntegerTy() && "IntToPtr source must be integral");
- assert(DstTy->isPointerTy() && "IntToPtr destination must be a pointer");
+ assert(C->getType()->getScalarType()->isIntegerTy() &&
+ "IntToPtr source must be integer or integer vector");
+ assert(DstTy->getScalarType()->isPointerTy() &&
+ "IntToPtr destination must be a pointer or pointer vector");
+ assert(C->getType()->getNumElements() == DstTy->getNumElements() &&
+ "Invalid cast between a different number of vector elements");
return getFoldedCast(Instruction::IntToPtr, C, DstTy);
}
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Dec 5 00:29:09 2011
@@ -1359,6 +1359,15 @@
///
template
static Type *getIndexedTypeInternal(Type *Ptr, ArrayRef IdxList) {
+ if (Ptr->isVectorTy()) {
+ assert(IdxList.size() == 1 &&
+ "GEP with vector pointers must have a single index");
+ PointerType *PTy = dyn_cast(
+ cast(Ptr)->getElementType());
+ assert(PTy && "Gep with invalid vector pointer found");
+ return PTy->getElementType();
+ }
+
PointerType *PTy = dyn_cast(Ptr);
if (!PTy) return 0; // Type isn't a pointer type!
Type *Agg = PTy->getElementType();
@@ -1366,7 +1375,7 @@
// Handle the special case of the empty set index set, which is always valid.
if (IdxList.empty())
return Agg;
-
+
// If there is at least one index, the top level type must be sized, otherwise
// it cannot be 'stepped over'.
if (!Agg->isSized())
@@ -1396,6 +1405,19 @@
return getIndexedTypeInternal(Ptr, IdxList);
}
+unsigned GetElementPtrInst::getAddressSpace(Value *Ptr) {
+ Type *Ty = Ptr->getType();
+
+ if (VectorType *VTy = dyn_cast(Ty))
+ Ty = VTy->getElementType();
+
+ if (PointerType *PTy = dyn_cast(Ty))
+ return PTy->getAddressSpace();
+
+ assert(false && "Invalid GEP pointer type");
+ return 0;
+}
+
/// hasAllZeroIndices - Return true if all of the indices of this GEP are
/// zeros. If so, the result pointer and the first operand have the same
/// value, just potentially different types.
@@ -2654,9 +2676,15 @@
return SrcTy->isFPOrFPVectorTy() && DstTy->isIntOrIntVectorTy() &&
SrcLength == DstLength;
case Instruction::PtrToInt:
- return SrcTy->isPointerTy() && DstTy->isIntegerTy();
+ if (SrcTy->getNumElements() != DstTy->getNumElements())
+ return false;
+ return SrcTy->getScalarType()->isPointerTy() &&
+ DstTy->getScalarType()->isIntegerTy();
case Instruction::IntToPtr:
- return SrcTy->isIntegerTy() && DstTy->isPointerTy();
+ if (SrcTy->getNumElements() != DstTy->getNumElements())
+ return false;
+ return SrcTy->getScalarType()->isIntegerTy() &&
+ DstTy->getScalarType()->isPointerTy();
case Instruction::BitCast:
// BitCast implies a no-op cast of type only. No bits change.
// However, you can't cast pointers to anything but pointers.
Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Mon Dec 5 00:29:09 2011
@@ -46,6 +46,14 @@
return this;
}
+/// getNumElements - If this is a vector type, return the number of elements,
+/// otherwise return zero.
+unsigned Type::getNumElements() {
+ if (VectorType *VTy = dyn_cast(this))
+ return VTy->getNumElements();
+ return 0;
+}
+
/// isIntegerTy - Return true if this is an IntegerType of the specified width.
bool Type::isIntegerTy(unsigned Bitwidth) const {
return isIntegerTy() && cast(this)->getBitWidth() == Bitwidth;
@@ -664,6 +672,8 @@
}
bool VectorType::isValidElementType(Type *ElemTy) {
+ if (PointerType *PTy = dyn_cast(ElemTy))
+ ElemTy = PTy->getElementType();
return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy();
}
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Mon Dec 5 00:29:09 2011
@@ -1035,8 +1035,19 @@
Type *SrcTy = I.getOperand(0)->getType();
Type *DestTy = I.getType();
- Assert1(SrcTy->isPointerTy(), "PtrToInt source must be pointer", &I);
- Assert1(DestTy->isIntegerTy(), "PtrToInt result must be integral", &I);
+ Assert1(SrcTy->getScalarType()->isPointerTy(),
+ "PtrToInt source must be pointer", &I);
+ Assert1(DestTy->getScalarType()->isIntegerTy(),
+ "PtrToInt result must be integral", &I);
+ Assert1(SrcTy->isVectorTy() == DestTy->isVectorTy(),
+ "PtrToInt type mismatch", &I);
+
+ if (SrcTy->isVectorTy()) {
+ VectorType *VSrc = dyn_cast(SrcTy);
+ VectorType *VDest = dyn_cast(DestTy);
+ Assert1(VSrc->getNumElements() == VDest->getNumElements(),
+ "PtrToInt Vector width mismatch", &I);
+ }
visitInstruction(I);
}
@@ -1046,9 +1057,18 @@
Type *SrcTy = I.getOperand(0)->getType();
Type *DestTy = I.getType();
- Assert1(SrcTy->isIntegerTy(), "IntToPtr source must be an integral", &I);
- Assert1(DestTy->isPointerTy(), "IntToPtr result must be a pointer",&I);
-
+ Assert1(SrcTy->getScalarType()->isIntegerTy(),
+ "IntToPtr source must be an integral", &I);
+ Assert1(DestTy->getScalarType()->isPointerTy(),
+ "IntToPtr result must be a pointer",&I);
+ Assert1(SrcTy->isVectorTy() == DestTy->isVectorTy(),
+ "IntToPtr type mismatch", &I);
+ if (SrcTy->isVectorTy()) {
+ VectorType *VSrc = dyn_cast(SrcTy);
+ VectorType *VDest = dyn_cast(DestTy);
+ Assert1(VSrc->getNumElements() == VDest->getNumElements(),
+ "IntToPtr Vector width mismatch", &I);
+ }
visitInstruction(I);
}
@@ -1245,7 +1265,7 @@
Assert1(Op0Ty == Op1Ty,
"Both operands to ICmp instruction are not of the same type!", &IC);
// Check that the operands are the right type
- Assert1(Op0Ty->isIntOrIntVectorTy() || Op0Ty->isPointerTy(),
+ Assert1(Op0Ty->isIntOrIntVectorTy() || Op0Ty->getScalarType()->isPointerTy(),
"Invalid operand types for ICmp instruction", &IC);
// Check that the predicate is valid.
Assert1(IC.getPredicate() >= CmpInst::FIRST_ICMP_PREDICATE &&
@@ -1295,17 +1315,43 @@
}
void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
- Assert1(cast(GEP.getOperand(0)->getType())
- ->getElementType()->isSized(),
+ Type *TargetTy = GEP.getPointerOperandType();
+ if (VectorType *VTy = dyn_cast(TargetTy))
+ TargetTy = VTy->getElementType();
+
+ Assert1(dyn_cast(TargetTy),
+ "GEP base pointer is not a vector or a vector of pointers", &GEP);
+ Assert1(cast(TargetTy)->getElementType()->isSized(),
"GEP into unsized type!", &GEP);
-
+
SmallVector Idxs(GEP.idx_begin(), GEP.idx_end());
Type *ElTy =
- GetElementPtrInst::getIndexedType(GEP.getOperand(0)->getType(), Idxs);
+ GetElementPtrInst::getIndexedType(GEP.getPointerOperandType(), Idxs);
Assert1(ElTy, "Invalid indices for GEP pointer type!", &GEP);
- Assert2(GEP.getType()->isPointerTy() &&
- cast(GEP.getType())->getElementType() == ElTy,
- "GEP is not of right type for indices!", &GEP, ElTy);
+
+ if (GEP.getPointerOperandType()->isPointerTy()) {
+ // Validate GEPs with scalar indices.
+ Assert2(GEP.getType()->isPointerTy() &&
+ cast(GEP.getType())->getElementType() == ElTy,
+ "GEP is not of right type for indices!", &GEP, ElTy);
+ } else {
+ // Validate GEPs with a vector index.
+ Assert1(Idxs.size() == 1, "Invalid number of indices!", &GEP);
+ Value *Index = Idxs[0];
+ Type *IndexTy = Index->getType();
+ Assert1(IndexTy->isVectorTy(),
+ "Vector GEP must have vector indices!", &GEP);
+ Assert1(GEP.getType()->isVectorTy(),
+ "Vector GEP must return a vector value", &GEP);
+ Type *ElemPtr = cast(GEP.getType())->getElementType();
+ Assert1(ElemPtr->isPointerTy(),
+ "Vector GEP pointer operand is not a pointer!", &GEP);
+ unsigned IndexWidth = cast(IndexTy)->getNumElements();
+ unsigned GepWidth = cast(GEP.getType())->getNumElements();
+ Assert1(IndexWidth == GepWidth, "Invalid GEP index vector width", &GEP);
+ Assert1(ElTy == cast(ElemPtr)->getElementType(),
+ "Vector GEP type does not match pointer type!", &GEP);
+ }
visitInstruction(GEP);
}
Added: llvm/trunk/test/CodeGen/X86/pointer-vector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pointer-vector.ll?rev=145801&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pointer-vector.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pointer-vector.ll Mon Dec 5 00:29:09 2011
@@ -0,0 +1,138 @@
+; RUN: llc < %s -march=x86 -mcpu=corei7 | FileCheck %s
+; RUN: opt -instsimplify %s -disable-output
+
+;CHECK: SHUFF0
+define <8 x i32*> @SHUFF0(<4 x i32*> %ptrv) nounwind {
+entry:
+ %G = shufflevector <4 x i32*> %ptrv, <4 x i32*> %ptrv, <8 x i32>
+;CHECK: pshufd
+ ret <8 x i32*> %G
+;CHECK: ret
+}
+
+;CHECK: SHUFF1
+define <4 x i32*> @SHUFF1(<4 x i32*> %ptrv) nounwind {
+entry:
+ %G = shufflevector <4 x i32*> %ptrv, <4 x i32*> %ptrv, <4 x i32>
+;CHECK: pshufd
+ ret <4 x i32*> %G
+;CHECK: ret
+}
+
+;CHECK: SHUFF3
+define <4 x i8*> @SHUFF3(<4 x i8*> %ptrv) nounwind {
+entry:
+ %G = shufflevector <4 x i8*> %ptrv, <4 x i8*> undef, <4 x i32>
+;CHECK: pshufd
+ ret <4 x i8*> %G
+;CHECK: ret
+}
+
+;CHECK: LOAD0
+define <4 x i8*> @LOAD0(<4 x i8*>* %p) nounwind {
+entry:
+ %G = load <4 x i8*>* %p
+;CHECK: movaps
+ ret <4 x i8*> %G
+;CHECK: ret
+}
+
+;CHECK: LOAD1
+define <4 x i8*> @LOAD1(<4 x i8*>* %p) nounwind {
+entry:
+ %G = load <4 x i8*>* %p
+;CHECK: movdqa
+;CHECK: pshufd
+;CHECK: movdqa
+ %T = shufflevector <4 x i8*> %G, <4 x i8*> %G, <4 x i32>
+ store <4 x i8*> %T, <4 x i8*>* %p
+ ret <4 x i8*> %G
+;CHECK: ret
+}
+
+;CHECK: LOAD2
+define <4 x i8*> @LOAD2(<4 x i8*>* %p) nounwind {
+entry:
+ %I = alloca <4 x i8*>
+;CHECK: sub
+ %G = load <4 x i8*>* %p
+;CHECK: movaps
+ store <4 x i8*> %G, <4 x i8*>* %I
+;CHECK: movaps
+ %Z = load <4 x i8*>* %I
+ ret <4 x i8*> %Z
+;CHECK: add
+;CHECK: ret
+}
+
+;CHECK: INT2PTR0
+define <4 x i32> @INT2PTR0(<4 x i8*>* %p) nounwind {
+entry:
+ %G = load <4 x i8*>* %p
+;CHECK: movl
+;CHECK: movaps
+ %K = ptrtoint <4 x i8*> %G to <4 x i32>
+;CHECK: ret
+ ret <4 x i32> %K
+}
+
+;CHECK: INT2PTR1
+define <4 x i32*> @INT2PTR1(<4 x i8>* %p) nounwind {
+entry:
+ %G = load <4 x i8>* %p
+;CHECK: movl
+;CHECK: movd
+;CHECK: pshufb
+;CHECK: pand
+ %K = inttoptr <4 x i8> %G to <4 x i32*>
+;CHECK: ret
+ ret <4 x i32*> %K
+}
+
+;CHECK: BITCAST0
+define <4 x i32*> @BITCAST0(<4 x i8*>* %p) nounwind {
+entry:
+ %G = load <4 x i8*>* %p
+;CHECK: movl
+ %T = bitcast <4 x i8*> %G to <4 x i32*>
+;CHECK: movaps
+;CHECK: ret
+ ret <4 x i32*> %T
+}
+
+;CHECK: BITCAST1
+define <2 x i32*> @BITCAST1(<2 x i8*>* %p) nounwind {
+entry:
+ %G = load <2 x i8*>* %p
+;CHECK: movl
+;CHECK: movd
+;CHECK: pinsrd
+ %T = bitcast <2 x i8*> %G to <2 x i32*>
+;CHECK: ret
+ ret <2 x i32*> %T
+}
+
+;CHECK: ICMP0
+define <4 x i32> @ICMP0(<4 x i8*>* %p0, <4 x i8*>* %p1) nounwind {
+entry:
+ %g0 = load <4 x i8*>* %p0
+ %g1 = load <4 x i8*>* %p1
+ %k = icmp sgt <4 x i8*> %g0, %g1
+ ;CHECK: pcmpgtd
+ %j = select <4 x i1> %k, <4 x i32> , <4 x i32>
+ ret <4 x i32> %j
+ ;CHECK: ret
+}
+
+;CHECK: ICMP1
+define <4 x i32> @ICMP1(<4 x i8*>* %p0, <4 x i8*>* %p1) nounwind {
+entry:
+ %g0 = load <4 x i8*>* %p0
+ %g1 = load <4 x i8*>* %p1
+ %k = icmp eq <4 x i8*> %g0, %g1
+ ;CHECK: pcmpeqd
+ %j = select <4 x i1> %k, <4 x i32> , <4 x i32>
+ ret <4 x i32> %j
+ ;CHECK: ret
+}
+
Added: llvm/trunk/test/CodeGen/X86/vector-gep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-gep.ll?rev=145801&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-gep.ll (added)
+++ llvm/trunk/test/CodeGen/X86/vector-gep.ll Mon Dec 5 00:29:09 2011
@@ -0,0 +1,77 @@
+; RUN: llc < %s -march=x86 -mcpu=corei7-avx | FileCheck %s
+; RUN: opt -instsimplify %s -disable-output
+
+;CHECK: AGEP0
+define <4 x i32*> @AGEP0(i32* %ptr) nounwind {
+entry:
+ %vecinit.i = insertelement <4 x i32*> undef, i32* %ptr, i32 0
+ %vecinit2.i = insertelement <4 x i32*> %vecinit.i, i32* %ptr, i32 1
+ %vecinit4.i = insertelement <4 x i32*> %vecinit2.i, i32* %ptr, i32 2
+ %vecinit6.i = insertelement <4 x i32*> %vecinit4.i, i32* %ptr, i32 3
+;CHECK: pslld
+;CHECK: padd
+ %A2 = getelementptr <4 x i32*> %vecinit6.i, <4 x i32>
+;CHECK: pslld
+;CHECK: padd
+ %A3 = getelementptr <4 x i32*> %A2, <4 x i32>
+ ret <4 x i32*> %A3
+;CHECK: ret
+}
+
+;CHECK: AGEP1
+define i32 @AGEP1(<4 x i32*> %param) nounwind {
+entry:
+;CHECK: pslld
+;CHECK: padd
+ %A2 = getelementptr <4 x i32*> %param, <4 x i32>
+ %k = extractelement <4 x i32*> %A2, i32 3
+ %v = load i32* %k
+ ret i32 %v
+;CHECK: ret
+}
+
+;CHECK: AGEP2
+define i32 @AGEP2(<4 x i32*> %param, <4 x i32> %off) nounwind {
+entry:
+;CHECK: pslld
+;CHECK: padd
+ %A2 = getelementptr <4 x i32*> %param, <4 x i32> %off
+ %k = extractelement <4 x i32*> %A2, i32 3
+ %v = load i32* %k
+ ret i32 %v
+;CHECK: ret
+}
+
+;CHECK: AGEP3
+define <4 x i32*> @AGEP3(<4 x i32*> %param, <4 x i32> %off) nounwind {
+entry:
+;CHECK: pslld
+;CHECK: padd
+ %A2 = getelementptr <4 x i32*> %param, <4 x i32> %off
+ %v = alloca i32
+ %k = insertelement <4 x i32*> %A2, i32* %v, i32 3
+ ret <4 x i32*> %k
+;CHECK: ret
+}
+
+;CHECK: AGEP4
+define <4 x i8*> @AGEP4(<4 x i8*> %param, <4 x i32> %off) nounwind {
+entry:
+;CHECK: pslld
+;CHECK: padd
+ %A = getelementptr <4 x i8*> %param, <4 x i32> %off
+ ret <4 x i8*> %A
+;CHECK: ret
+}
+
+;CHECK: AGEP5
+define <4 x i8*> @AGEP5(<4 x i8*> %param, <4 x i8> %off) nounwind {
+entry:
+;CHECK: pslld
+;CHECK: padd
+ %A = getelementptr <4 x i8*> %param, <4 x i8> %off
+ ret <4 x i8*> %A
+;CHECK: ret
+}
+
+
Added: llvm/trunk/test/Feature/const_pv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/const_pv.ll?rev=145801&view=auto
==============================================================================
--- llvm/trunk/test/Feature/const_pv.ll (added)
+++ llvm/trunk/test/Feature/const_pv.ll Mon Dec 5 00:29:09 2011
@@ -0,0 +1,8 @@
+; RUN: llvm-as %s -disable-output
+ at G = constant <3 x i64> ptrtoint (<3 x i8*> to <3 x i64>)
+
+ at G1 = global i8 zeroinitializer
+ at g = constant <2 x i8*> getelementptr (<2 x i8*> , <2 x i32> )
+
+ at t = constant <2 x i1> icmp ((<2 x i32> ptrtoint (<2 x i8*> zeroinitializer to <2 x i32>), <2 x i32> zeroinitializer )
+
Added: llvm/trunk/test/Feature/global_pv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/global_pv.ll?rev=145801&view=auto
==============================================================================
--- llvm/trunk/test/Feature/global_pv.ll (added)
+++ llvm/trunk/test/Feature/global_pv.ll Mon Dec 5 00:29:09 2011
@@ -0,0 +1,14 @@
+; RUN: opt -instcombine -S -o - %s | llvm-as
+; RUN: opt -instcombine -globalopt -S -o - %s | llvm-as
+ at G1 = global i32 zeroinitializer
+ at G2 = global i32 zeroinitializer
+ at g = global <2 x i32*> zeroinitializer
+%0 = type { i32, void ()* }
+ at llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @test }]
+define internal void @test() {
+ %A = insertelement <2 x i32*> undef, i32* @G1, i32 0
+ %B = insertelement <2 x i32*> %A, i32* @G2, i32 1
+ store <2 x i32*> %B, <2 x i32*>* @g
+ ret void
+}
+
Added: llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll?rev=145801&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll Mon Dec 5 00:29:09 2011
@@ -0,0 +1,37 @@
+; RUN: opt -instcombine %s -disable-output
+; RUN: opt -instsimplify %s -disable-output
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+ at G1 = global i8 zeroinitializer
+
+define <2 x i1> @test(<2 x i8*> %a, <2 x i8*> %b) {
+ %A = icmp eq <2 x i8*> %a, %b
+ ret <2 x i1> %A
+}
+
+define <2 x i1> @test2(<2 x i8*> %a) {
+ %A = inttoptr <2 x i32> to <2 x i8*>
+ %B = icmp ult <2 x i8*> %A, zeroinitializer
+ ret <2 x i1> %B
+}
+
+define <2 x i1> @test3(<2 x i8*> %a) {
+ %g = getelementptr <2 x i8*> %a, <2 x i32>
+ %B = icmp ult <2 x i8*> %g, zeroinitializer
+ ret <2 x i1> %B
+}
+
+define <1 x i1> @test4(<1 x i8*> %a) {
+ %g = getelementptr <1 x i8*> %a, <1 x i32>
+ %B = icmp ult <1 x i8*> %g, zeroinitializer
+ ret <1 x i1> %B
+}
+
+define <2 x i1> @test5(<2 x i8*> %a) {
+ %w = getelementptr <2 x i8*> %a, <2 x i32> zeroinitializer
+ %e = getelementptr <2 x i8*> %w, <2 x i32>
+ %g = getelementptr <2 x i8*> %e, <2 x i32>
+ %B = icmp ult <2 x i8*> %g, zeroinitializer
+ ret <2 x i1> %B
+}
Added: llvm/trunk/test/Transforms/InstSimplify/vector_gep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/vector_gep.ll?rev=145801&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/vector_gep.ll (added)
+++ llvm/trunk/test/Transforms/InstSimplify/vector_gep.ll Mon Dec 5 00:29:09 2011
@@ -0,0 +1,8 @@
+;RUN: opt -instsimplify %s -disable-output
+declare void @helper(<2 x i8*>)
+define void @test(<2 x i8*> %a) {
+ %A = getelementptr <2 x i8*> %a, <2 x i32>
+ call void @helper(<2 x i8*> %A)
+ ret void
+}
+
Modified: llvm/trunk/unittests/VMCore/InstructionsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/InstructionsTest.cpp?rev=145801&r1=145800&r2=145801&view=diff
==============================================================================
--- llvm/trunk/unittests/VMCore/InstructionsTest.cpp (original)
+++ llvm/trunk/unittests/VMCore/InstructionsTest.cpp Mon Dec 5 00:29:09 2011
@@ -13,6 +13,8 @@
#include "llvm/DerivedTypes.h"
#include "llvm/LLVMContext.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/Target/TargetData.h"
#include "gtest/gtest.h"
namespace llvm {
@@ -129,5 +131,100 @@
EXPECT_EQ(CastInst::SExt, CastInst::getCastOpcode(c8, true, V8x64Ty, true));
}
+
+
+TEST(InstructionsTest, VectorGep) {
+ LLVMContext &C(getGlobalContext());
+
+ // Type Definitions
+ PointerType *Ptri8Ty = PointerType::get(IntegerType::get(C, 8), 0);
+ PointerType *Ptri32Ty = PointerType::get(IntegerType::get(C, 8), 0);
+
+ VectorType *V2xi8PTy = VectorType::get(Ptri8Ty, 2);
+ VectorType *V2xi32PTy = VectorType::get(Ptri32Ty, 2);
+
+ // Test different aspects of the vector-of-pointers type
+ // and GEPs which use this type.
+ ConstantInt *Ci32a = ConstantInt::get(C, APInt(32, 1492));
+ ConstantInt *Ci32b = ConstantInt::get(C, APInt(32, 1948));
+ std::vector ConstVa(2, Ci32a);
+ std::vector ConstVb(2, Ci32b);
+ Constant *C2xi32a = ConstantVector::get(ConstVa);
+ Constant *C2xi32b = ConstantVector::get(ConstVb);
+
+ CastInst *PtrVecA = new IntToPtrInst(C2xi32a, V2xi32PTy);
+ CastInst *PtrVecB = new IntToPtrInst(C2xi32b, V2xi32PTy);
+
+ ICmpInst *ICmp0 = new ICmpInst(ICmpInst::ICMP_SGT, PtrVecA, PtrVecB);
+ ICmpInst *ICmp1 = new ICmpInst(ICmpInst::ICMP_ULT, PtrVecA, PtrVecB);
+ EXPECT_NE(ICmp0, ICmp1); // suppress warning.
+
+ GetElementPtrInst *Gep0 = GetElementPtrInst::Create(PtrVecA, C2xi32a);
+ GetElementPtrInst *Gep1 = GetElementPtrInst::Create(PtrVecA, C2xi32b);
+ GetElementPtrInst *Gep2 = GetElementPtrInst::Create(PtrVecB, C2xi32a);
+ GetElementPtrInst *Gep3 = GetElementPtrInst::Create(PtrVecB, C2xi32b);
+
+ CastInst *BTC0 = new BitCastInst(Gep0, V2xi8PTy);
+ CastInst *BTC1 = new BitCastInst(Gep1, V2xi8PTy);
+ CastInst *BTC2 = new BitCastInst(Gep2, V2xi8PTy);
+ CastInst *BTC3 = new BitCastInst(Gep3, V2xi8PTy);
+
+ Value *S0 = BTC0->stripPointerCasts();
+ Value *S1 = BTC1->stripPointerCasts();
+ Value *S2 = BTC2->stripPointerCasts();
+ Value *S3 = BTC3->stripPointerCasts();
+
+ EXPECT_NE(S0, Gep0);
+ EXPECT_NE(S1, Gep1);
+ EXPECT_NE(S2, Gep2);
+ EXPECT_NE(S3, Gep3);
+
+ int64_t Offset;
+ TargetData TD("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3"
+ "2:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80"
+ ":128:128-n8:16:32:64-S128");
+ // Make sure we don't crash
+ GetPointerBaseWithConstantOffset(Gep0, Offset, TD);
+ GetPointerBaseWithConstantOffset(Gep1, Offset, TD);
+ GetPointerBaseWithConstantOffset(Gep2, Offset, TD);
+ GetPointerBaseWithConstantOffset(Gep3, Offset, TD);
+
+ // Gep of Geps
+ GetElementPtrInst *GepII0 = GetElementPtrInst::Create(Gep0, C2xi32b);
+ GetElementPtrInst *GepII1 = GetElementPtrInst::Create(Gep1, C2xi32a);
+ GetElementPtrInst *GepII2 = GetElementPtrInst::Create(Gep2, C2xi32b);
+ GetElementPtrInst *GepII3 = GetElementPtrInst::Create(Gep3, C2xi32a);
+
+ EXPECT_EQ(GepII0->getNumIndices(), 1u);
+ EXPECT_EQ(GepII1->getNumIndices(), 1u);
+ EXPECT_EQ(GepII2->getNumIndices(), 1u);
+ EXPECT_EQ(GepII3->getNumIndices(), 1u);
+
+ EXPECT_FALSE(GepII0->hasAllZeroIndices());
+ EXPECT_FALSE(GepII1->hasAllZeroIndices());
+ EXPECT_FALSE(GepII2->hasAllZeroIndices());
+ EXPECT_FALSE(GepII3->hasAllZeroIndices());
+
+ delete GepII0;
+ delete GepII1;
+ delete GepII2;
+ delete GepII3;
+
+ delete BTC0;
+ delete BTC1;
+ delete BTC2;
+ delete BTC3;
+
+ delete Gep0;
+ delete Gep1;
+ delete Gep2;
+ delete Gep3;
+
+ delete ICmp0;
+ delete ICmp1;
+ delete PtrVecA;
+ delete PtrVecB;
+}
+
} // end anonymous namespace
} // end namespace llvm
From craig.topper at gmail.com Mon Dec 5 00:56:46 2011
From: craig.topper at gmail.com (Craig Topper)
Date: Mon, 05 Dec 2011 06:56:46 -0000
Subject: [llvm-commits] [llvm] r145803 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <20111205065646.B71721BE003@llvm.org>
Author: ctopper
Date: Mon Dec 5 00:56:46 2011
New Revision: 145803
URL: http://llvm.org/viewvc/llvm-project?rev=145803&view=rev
Log:
Clean up and optimizations to the X86 shuffle lowering code. No functional change.
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=145803&r1=145802&r2=145803&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Dec 5 00:56:46 2011
@@ -3323,11 +3323,9 @@
/// the reverse of what x86 shuffles want. x86 shuffles requires the lower
/// half elements to come from vector 1 (which would equal the dest.) and
/// the upper half to come from vector 2.
-static bool isCommutedVSHUFPY(ShuffleVectorSDNode *N, bool HasAVX) {
- EVT VT = N->getValueType(0);
+static bool isCommutedVSHUFPYMask(const SmallVectorImpl &Mask, EVT VT,
+ bool HasAVX) {
int NumElems = VT.getVectorNumElements();
- SmallVector Mask;
- N->getMask(Mask);
if (!HasAVX || VT.getSizeInBits() != 256)
return false;
@@ -3423,8 +3421,8 @@
/// CommuteVectorShuffleMask - Change values in a shuffle permute mask assuming
/// the two vector operands have swapped position.
-static void CommuteVectorShuffleMask(SmallVectorImpl &Mask, EVT VT) {
- unsigned NumElems = VT.getVectorNumElements();
+static void CommuteVectorShuffleMask(SmallVectorImpl &Mask,
+ unsigned NumElems) {
for (unsigned i = 0; i != NumElems; ++i) {
int idx = Mask[i];
if (idx < 0)
@@ -3485,12 +3483,6 @@
return true;
}
-static bool isCommutedSHUFP(ShuffleVectorSDNode *N) {
- SmallVector M;
- N->getMask(M);
- return isCommutedSHUFPMask(M, N->getValueType(0));
-}
-
/// isMOVHLPSMask - Return true if the specified VECTOR_SHUFFLE operand
/// specifies a shuffle of elements that is suitable for input to MOVHLPS.
bool X86::isMOVHLPSMask(ShuffleVectorSDNode *N) {
@@ -3975,21 +3967,18 @@
/// isMOVDDUPYMask - Return true if the specified VECTOR_SHUFFLE operand
/// specifies a shuffle of elements that is suitable for input to 256-bit
/// version of MOVDDUP.
-static bool isMOVDDUPYMask(ShuffleVectorSDNode *N,
- const X86Subtarget *Subtarget) {
- EVT VT = N->getValueType(0);
+static bool isMOVDDUPYMask(const SmallVectorImpl &Mask, EVT VT,
+ bool HasAVX) {
int NumElts = VT.getVectorNumElements();
- bool V2IsUndef = N->getOperand(1).getOpcode() == ISD::UNDEF;
- if (!Subtarget->hasAVX() || VT.getSizeInBits() != 256 ||
- !V2IsUndef || NumElts != 4)
+ if (!HasAVX || VT.getSizeInBits() != 256 || NumElts != 4)
return false;
for (int i = 0; i != NumElts/2; ++i)
- if (!isUndefOrEqual(N->getMaskElt(i), 0))
+ if (!isUndefOrEqual(Mask[i], 0))
return false;
for (int i = NumElts/2; i != NumElts; ++i)
- if (!isUndefOrEqual(N->getMaskElt(i), NumElts/2))
+ if (!isUndefOrEqual(Mask[i], NumElts/2))
return false;
return true;
}
@@ -6172,7 +6161,7 @@
// from X.
if (NumHi == 3) {
// Normalize it so the 3 elements come from V1.
- CommuteVectorShuffleMask(PermMask, VT);
+ CommuteVectorShuffleMask(PermMask, 4);
std::swap(V1, V2);
}
@@ -6603,6 +6592,7 @@
bool V1IsSplat = false;
bool V2IsSplat = false;
bool HasXMMInt = Subtarget->hasXMMInt();
+ bool HasAVX = Subtarget->hasAVX();
bool HasAVX2 = Subtarget->hasAVX2();
MachineFunction &MF = DAG.getMachineFunction();
bool OptForSize = MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize);
@@ -6738,7 +6728,10 @@
Commuted = true;
}
- if (isCommutedMOVL(SVOp, V2IsSplat, V2IsUndef)) {
+ SmallVector M;
+ SVOp->getMask(M);
+
+ if (isCommutedMOVLMask(M, VT, V2IsSplat, V2IsUndef)) {
// Shuffling low element of v1 into undef, just return v1.
if (V2IsUndef)
return V1;
@@ -6748,11 +6741,11 @@
return getMOVL(DAG, dl, VT, V2, V1);
}
- if (X86::isUNPCKLMask(SVOp, HasAVX2))
+ if (isUNPCKLMask(M, VT, HasAVX2))
return getTargetShuffleNode(getUNPCKLOpcode(VT, HasAVX2), dl, VT, V1, V2,
DAG);
- if (X86::isUNPCKHMask(SVOp, HasAVX2))
+ if (isUNPCKHMask(M, VT, HasAVX2))
return getTargetShuffleNode(getUNPCKHOpcode(VT, HasAVX2), dl, VT, V1, V2,
DAG);
@@ -6787,15 +6780,13 @@
}
// Normalize the node to match x86 shuffle ops if needed
- if (!V2IsUndef && (isCommutedSHUFP(SVOp) ||
- isCommutedVSHUFPY(SVOp, Subtarget->hasAVX())))
+ if (!V2IsUndef && (isCommutedSHUFPMask(M, VT) ||
+ isCommutedVSHUFPYMask(M, VT, HasAVX)))
return CommuteVectorShuffle(SVOp, DAG);
// The checks below are all present in isShuffleMaskLegal, but they are
// inlined here right now to enable us to directly emit target specific
// nodes, and remove one by one until they don't return Op anymore.
- SmallVector M;
- SVOp->getMask(M);
if (isPALIGNRMask(M, VT, Subtarget->hasSSSE3orAVX()))
return getTargetShuffleNode(X86ISD::PALIGN, dl, VT, V1, V2,
@@ -6804,10 +6795,9 @@
if (ShuffleVectorSDNode::isSplatMask(&M[0], VT) &&
SVOp->getSplatIndex() == 0 && V2IsUndef) {
- if (VT == MVT::v2f64)
- return getTargetShuffleNode(X86ISD::UNPCKLP, dl, VT, V1, V1, DAG);
- if (VT == MVT::v2i64)
- return getTargetShuffleNode(X86ISD::PUNPCKL, dl, VT, V1, V1, DAG);
+ if (VT == MVT::v2f64 || VT == MVT::v2i64)
+ return getTargetShuffleNode(getUNPCKLOpcode(VT, HasAVX2), dl, VT, V1, V1,
+ DAG);
}
if (isPSHUFHWMask(M, VT))
@@ -6824,10 +6814,10 @@
return getTargetShuffleNode(getSHUFPOpcode(VT), dl, VT, V1, V2,
X86::getShuffleSHUFImmediate(SVOp), DAG);
- if (X86::isUNPCKL_v_undef_Mask(SVOp))
+ if (isUNPCKL_v_undef_Mask(M, VT))
return getTargetShuffleNode(getUNPCKLOpcode(VT, HasAVX2), dl, VT, V1, V1,
DAG);
- if (X86::isUNPCKH_v_undef_Mask(SVOp))
+ if (isUNPCKH_v_undef_Mask(M, VT))
return getTargetShuffleNode(getUNPCKHOpcode(VT, HasAVX2), dl, VT, V1, V1,
DAG);
@@ -6837,21 +6827,21 @@
//
// Handle VMOVDDUPY permutations
- if (isMOVDDUPYMask(SVOp, Subtarget))
+ if (V2IsUndef && isMOVDDUPYMask(M, VT, HasAVX))
return getTargetShuffleNode(X86ISD::MOVDDUP, dl, VT, V1, DAG);
// Handle VPERMILPS/D* permutations
- if (isVPERMILPMask(M, VT, Subtarget->hasAVX()))
+ if (isVPERMILPMask(M, VT, HasAVX))
return getTargetShuffleNode(X86ISD::VPERMILP, dl, VT, V1,
getShuffleVPERMILPImmediate(SVOp), DAG);
// Handle VPERM2F128/VPERM2I128 permutations
- if (isVPERM2X128Mask(M, VT, Subtarget->hasAVX()))
+ if (isVPERM2X128Mask(M, VT, HasAVX))
return getTargetShuffleNode(X86ISD::VPERM2X128, dl, VT, V1,
V2, getShuffleVPERM2X128Immediate(SVOp), DAG);
// Handle VSHUFPS/DY permutations
- if (isVSHUFPYMask(M, VT, Subtarget->hasAVX()))
+ if (isVSHUFPYMask(M, VT, HasAVX))
return getTargetShuffleNode(getSHUFPOpcode(VT), dl, VT, V1, V2,
getShuffleVSHUFPYImmediate(SVOp), DAG);
@@ -14321,7 +14311,7 @@
/// set to A, RHS to B, and the routine returns 'true'.
/// Note that the binary operation should have the property that if one of the
/// operands is UNDEF then the result is UNDEF.
-static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool isCommutative) {
+static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool IsCommutative) {
// Look for the following pattern: if
// A = < float a0, float a1, float a2, float a3 >
// B = < float b0, float b1, float b2, float b3 >
@@ -14399,34 +14389,28 @@
// If A and B occur in reverse order in RHS, then "swap" them (which means
// rewriting the mask).
if (A != C)
- for (unsigned i = 0; i != NumElts; ++i) {
- unsigned Idx = RMask[i];
- if (Idx < NumElts)
- RMask[i] += NumElts;
- else if (Idx < 2*NumElts)
- RMask[i] -= NumElts;
- }
+ CommuteVectorShuffleMask(RMask, NumElts);
// At this point LHS and RHS are equivalent to
// LHS = VECTOR_SHUFFLE A, B, LMask
// RHS = VECTOR_SHUFFLE A, B, RMask
// Check that the masks correspond to performing a horizontal operation.
for (unsigned i = 0; i != NumElts; ++i) {
- unsigned LIdx = LMask[i], RIdx = RMask[i];
+ int LIdx = LMask[i], RIdx = RMask[i];
// Ignore any UNDEF components.
- if (LIdx >= 2*NumElts || RIdx >= 2*NumElts ||
- (!A.getNode() && (LIdx < NumElts || RIdx < NumElts)) ||
- (!B.getNode() && (LIdx >= NumElts || RIdx >= NumElts)))
+ if (LIdx < 0 || RIdx < 0 ||
+ (!A.getNode() && (LIdx < (int)NumElts || RIdx < (int)NumElts)) ||
+ (!B.getNode() && (LIdx >= (int)NumElts || RIdx >= (int)NumElts)))
continue;
// Check that successive elements are being operated on. If not, this is
// not a horizontal operation.
unsigned Src = (i/HalfLaneElts) % 2; // each lane is split between srcs
unsigned LaneStart = (i/NumLaneElts) * NumLaneElts;
- unsigned Index = 2*(i%HalfLaneElts) + NumElts*Src + LaneStart;
+ int Index = 2*(i%HalfLaneElts) + NumElts*Src + LaneStart;
if (!(LIdx == Index && RIdx == Index + 1) &&
- !(isCommutative && LIdx == Index + 1 && RIdx == Index))
+ !(IsCommutative && LIdx == Index + 1 && RIdx == Index))
return false;
}
From craig.topper at gmail.com Mon Dec 5 01:27:14 2011
From: craig.topper at gmail.com (Craig Topper)
Date: Mon, 05 Dec 2011 07:27:14 -0000
Subject: [llvm-commits] [llvm] r145804 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <20111205072714.AA6741BE003@llvm.org>
Author: ctopper
Date: Mon Dec 5 01:27:14 2011
New Revision: 145804
URL: http://llvm.org/viewvc/llvm-project?rev=145804&view=rev
Log:
Remove some leftover remnants that once tried to create 64-bit MMX PALIGNR instructions.
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=145804&r1=145803&r2=145804&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Dec 5 01:27:14 2011
@@ -3217,7 +3217,7 @@
static bool isPALIGNRMask(const SmallVectorImpl &Mask, EVT VT,
bool hasSSSE3OrAVX) {
int i, e = VT.getVectorNumElements();
- if (VT.getSizeInBits() != 128 && VT.getSizeInBits() != 64)
+ if (VT.getSizeInBits() != 128)
return false;
// Do not handle v2i64 / v2f64 shuffles with palignr.
@@ -11244,7 +11244,7 @@
EVT VT) const {
// Very little shuffling can be done for 64-bit vectors right now.
if (VT.getSizeInBits() == 64)
- return isPALIGNRMask(M, VT, Subtarget->hasSSSE3orAVX());
+ return false;
// FIXME: pshufb, blends, shifts.
return (VT.getVectorNumElements() == 2 ||
From geek4civic at gmail.com Mon Dec 5 01:54:57 2011
From: geek4civic at gmail.com (NAKAMURA Takumi)
Date: Mon, 05 Dec 2011 07:54:57 -0000
Subject: [llvm-commits] [llvm] r145805 -
/llvm/trunk/test/CodeGen/X86/pointer-vector.ll
Message-ID: <20111205075457.E52F91BE003@llvm.org>
Author: chapuni
Date: Mon Dec 5 01:54:57 2011
New Revision: 145805
URL: http://llvm.org/viewvc/llvm-project?rev=145805&view=rev
Log:
test/CodeGen/X86/pointer-vector.ll: Add explicit -mtriple=i686-linux.
Modified:
llvm/trunk/test/CodeGen/X86/pointer-vector.ll
Modified: llvm/trunk/test/CodeGen/X86/pointer-vector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pointer-vector.ll?rev=145805&r1=145804&r2=145805&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pointer-vector.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pointer-vector.ll Mon Dec 5 01:54:57 2011
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=x86 -mcpu=corei7 | FileCheck %s
+; RUN: llc < %s -mtriple=i686-linux -mcpu=corei7 | FileCheck %s
; RUN: opt -instsimplify %s -disable-output
;CHECK: SHUFF0
From samsonov at google.com Mon Dec 5 05:11:45 2011
From: samsonov at google.com (samsonov at google.com)
Date: Mon, 05 Dec 2011 11:11:45 +0000
Subject: [llvm-commits] Cleanup in ASan interceptors (issue 5437128)
Message-ID: <20cf3074d322550fdb04b3566286@google.com>
Reviewers: kcc, ramosian.glider,
http://codereview.appspot.com/5437128/diff/1/Makefile.old
File Makefile.old (right):
http://codereview.appspot.com/5437128/diff/1/Makefile.old#newcode162
Makefile.old:162: ASAN_LD_TAIL=$(LIBASAN_A)
On 2011/12/04 01:20:31, kcc wrote:
> We should not need it.
> If we still need it (what's the case?), the fix should go to clang
driver. (This
> might work as a temporary fix though since the makefile should die
anyway)
Hm-m, let it be a temporary fix then. Without this change, changes in
asan rtl are not reflected when we rebuild the tests (or I'm doing smth
completely wrong).
http://codereview.appspot.com/5437128/diff/1/asan_interceptors.cc
File asan_interceptors.cc (right):
http://codereview.appspot.com/5437128/diff/1/asan_interceptors.cc#newcode96
asan_interceptors.cc:96: #define ENSURE_ASAN_INITED do { \
On 2011/12/04 01:20:31, kcc wrote:
> make it ENSURE_ASAN_INITED() (here and below)
Done.
http://codereview.appspot.com/5437128/diff/1/asan_interceptors.cc#newcode101
asan_interceptors.cc:101: } while (0);
On 2011/12/04 01:20:31, kcc wrote:
> remove ';'
Done (for all macro in this file).
Please review this at http://codereview.appspot.com/5437128/
Affected files:
M Makefile.old
M asan_interceptors.cc
Index: Makefile.old
===================================================================
--- Makefile.old (revision 145805)
+++ Makefile.old (working copy)
@@ -159,7 +159,7 @@
ifeq ($(ASAN_COMPILER), clang)
ASAN_CXX=$(CLANG_ASAN_CXX)
ASAN_LD=$(CLANG_ASAN_LD)
- ASAN_LD_TAIL=
+ ASAN_LD_TAIL=$(LIBASAN_A)
endif
ifeq ($(ASAN_COMPILER), gcc)
Index: asan_interceptors.cc
===================================================================
--- asan_interceptors.cc (revision 145805)
+++ asan_interceptors.cc (working copy)
@@ -62,15 +62,15 @@
AccessAddress(ptr, isWrite); \
AccessAddress(ptr + (size) - 1, isWrite); \
} \
-} while (0);
+} while (0)
#define ASAN_READ_RANGE(offset, size) do { \
ACCESS_MEMORY_RANGE(offset, size, false); \
-} while (0);
+} while (0)
#define ASAN_WRITE_RANGE(offset, size) do { \
ACCESS_MEMORY_RANGE(offset, size, true); \
-} while (0);
+} while (0)
// Behavior of functions like "memcpy" or "strcpy" is undefined
// if memory intervals overlap. We report error in this case.
@@ -90,16 +90,15 @@
PRINT_CURRENT_STACK(); \
ShowStatsAndAbort(); \
} \
-} while (0);
+} while (0)
-static inline void ensure_asan_inited() {
- CHECK(!asan_init_is_running);
- if (!asan_inited) {
- __asan_init();
- }
-}
+#define ENSURE_ASAN_INITED() do { \
+ CHECK(!asan_init_is_running); \
+ if (!asan_inited) { \
+ __asan_init(); \
+ } \
+} while (0)
-
size_t internal_strlen(const char *s) {
size_t i = 0;
while (s[i]) i++;
@@ -121,15 +120,9 @@
#else
OVERRIDE_FUNCTION(index, WRAP(strchr));
#endif
-#ifndef __APPLE__
INTERCEPT_FUNCTION(memcpy);
INTERCEPT_FUNCTION(memmove);
INTERCEPT_FUNCTION(memset);
-#else
- real_memcpy = memcpy;
- real_memmove = memmove;
- real_memset = memset;
-#endif
INTERCEPT_FUNCTION(strchr);
INTERCEPT_FUNCTION(strcmp);
INTERCEPT_FUNCTION(strcpy); // NOLINT
@@ -156,7 +149,7 @@
if (asan_init_is_running) {
return real_memcpy(to, from, size);
}
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_intrin) {
CHECK_RANGES_OVERLAP(to, from, size);
ASAN_WRITE_RANGE(from, size);
@@ -166,7 +159,7 @@
}
void *WRAP(memmove)(void *to, const void *from, size_t size) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_intrin) {
ASAN_WRITE_RANGE(from, size);
ASAN_READ_RANGE(to, size);
@@ -175,7 +168,11 @@
}
void *WRAP(memset)(void *block, int c, size_t size) {
- ensure_asan_inited();
+ // memset is called inside INTERCEPT_FUNCTION on Mac.
+ if (asan_init_is_running) {
+ return real_memset(block, c, size);
+ }
+ ENSURE_ASAN_INITED();
if (FLAG_replace_intrin) {
ASAN_WRITE_RANGE(block, size);
}
@@ -192,7 +189,7 @@
#endif
char *WRAP(strchr)(const char *str, int c) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
char *result = real_strchr(str, c);
if (FLAG_replace_str) {
size_t bytes_read = (result ? result - str : real_strlen(str)) + 1;
@@ -229,7 +226,7 @@
if (asan_init_is_running) {
return real_strcpy(to, from);
}
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_str) {
size_t from_size = real_strlen(from) + 1;
CHECK_RANGES_OVERLAP(to, from, from_size);
@@ -240,7 +237,7 @@
}
char *WRAP(strdup)(const char *s) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_str) {
size_t length = real_strlen(s);
ASAN_READ_RANGE(s, length + 1);
@@ -254,7 +251,7 @@
if (asan_init_is_running) {
return real_strlen(s);
}
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
size_t length = real_strlen(s);
if (FLAG_replace_str) {
ASAN_READ_RANGE(s, length + 1);
@@ -281,7 +278,7 @@
}
char *WRAP(strncpy)(char *to, const char *from, size_t size) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_str) {
size_t from_size = Min(size, internal_strnlen(from, size) + 1);
CHECK_RANGES_OVERLAP(to, from, from_size);
@@ -293,7 +290,7 @@
#ifndef __APPLE__
size_t WRAP(strnlen)(const char *s, size_t maxlen) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
size_t length = real_strnlen(s, maxlen);
if (FLAG_replace_str) {
ASAN_READ_RANGE(s, Min(length + 1, maxlen));
From scanon at apple.com Mon Dec 5 05:37:22 2011
From: scanon at apple.com (Stephen Canon)
Date: Mon, 05 Dec 2011 06:37:22 -0500
Subject: [llvm-commits] PATCH: Initial patches for changing the
semantics of llvm.cttz and llvm.ctlz
In-Reply-To: <2DBA1282-CC2C-430B-9A62-5694D5ABAD4B@apple.com>
References:
<2DBA1282-CC2C-430B-9A62-5694D5ABAD4B@apple.com>
Message-ID: <986B8FE1-E724-446E-B0DB-465FF1595247@apple.com>
On Dec 1, 2011, at 2:20 PM, Dan Gohman wrote:
> The "old" semantics really are more desirable though, in general. The only
> reason I know of for the "new" semantics is to cater to x86's old bsf and
> bsr instructions. But x86 admits its own deficiency, and has since introduced
> the lzcnt and tzcnt instructions, which behave properly. It seems unfortunate
> to require people who want the sane semantics to use a branch (even if
> CodeGen is clever and can eliminate it).
Agreed. The x86 ISA semantics of BSR/BSF are nuts (and not followed by any other mainstream architecture with which I am familiar). Surely there's some way to give llvm the hint it needs to optimize this particular case on x86 without making the semantics of llvm ir similarly broken.
- Steve
From stpworld at narod.ru Mon Dec 5 07:03:50 2011
From: stpworld at narod.ru (Stepan Dyatkovskiy)
Date: Mon, 05 Dec 2011 17:03:50 +0400
Subject: [llvm-commits] [LLVM, loop-unswitch,
bugfix for #11429] Wrong behaviour for switches.
In-Reply-To:
References: <4ECF4A5A.9030607@narod.ru> <4ED36D99.1080306@narod.ru>
<4ED51EEC.6050000@narod.ru> <4ED749D0.8030101@narod.ru>
<4ED88CDF.2020104@narod.ru>
Message-ID: <4EDCC136.1040903@narod.ru>
Hi Dan. This bug is described in details (with examples) here:
http://llvm.org/bugs/show_bug.cgi?id=11429
Regarding to your questions..
> It's even possible that this bug is
> accidentally helping the code by preventing it from unswitching too
> much in the presence of switches.
> Do you have an idea on what impact
> this patch has on code size, and performance, in general?
Happily this bug helps to keep the code size small. But
LoopUnswitch::UnswitchIfProfitable method already controls the produced
code size. Please, see LoopUnswitch.cpp, string #446 for more details. I
think that if we need to improve the "restrictioning" of produced code
size we need to implement this improvement instead of keeping some
strange code.
About impact on code size.
For switch with N cases (+ 1 default) we got N new loops. If you wish I
can present the .ll code that should be produced after optimization.
Impact on performance.
The main purpose of this optimization is to move out of loop the
switches. Each unswitched case increases the performance.
About releaseMemory and CloneUnswitchedVals.
This methods the part of unswitch info cloning for new loops. It is also
described in bug #11429.
> CloneUnswitchedVals doesn't actually need to iterate over the
> instructions in the block to find the SwitchInst. If there's a
> SwitchInst present, it'll be the Terminator instruction.
OK. You're right. Please find the fixed patch.
Thanks!
-Stepan.
>
> Thanks,
>
> Dan
>
> On Dec 2, 2011, at 12:31 AM, Stepan Dyatkovskiy wrote:
>
>>
>> ping.
>>
>> -Stepan.
>> Stepan Dyatkovskiy wrote:
>>> ping.
>>>
>>> -Stepan.
>>>
>>> Stepan Dyatkovskiy wrote:
>>>> ping.
>>>>
>>>> -Stepan.
>>>>
>>>> Stepan Dyatkovskiy wrote:
>>>>> ping.
>>>>>
>>>>> -Stepan
>>>>>
>>>>> Stepan Dyatkovskiy wrote:
>>>>>> Hi all. Please find the patch in attachment for review. Regression tests
>>>>>> are attached in separated patch.
>>>>>>
>>>>>> Short tests description:
>>>>>>
>>>>>> 2011-11-18-SimpleSwitch.ll
>>>>>> Check simple that simple switch will totally unswitched:
>>>>>>
>>>>>> for (...)
>>>>>> switch(c) {
>>>>>> case 0: inc(); break;
>>>>>> case 1: dec(); break;
>>>>>> default: goto loop_exit;
>>>>>> }
>>>>>>
>>>>>> loop_exit:
>>>>>> ...
>>>>>>
>>>>>> Result of processing should be 2 additional loops for c == 0 and for c
>>>>>> == 1.
>>>>>>
>>>>>>
>>>>>> 2011-11-18-TwoSwitches.ll
>>>>>> Check that second switch will unswitched too. Check that switches will
>>>>>> not unswitched again in new loop:
>>>>>>
>>>>>> Initially we have the next:
>>>>>>
>>>>>> for (...) {
>>>>>> switch(c) {
>>>>>> case 0: inc(); break;
>>>>>> }
>>>>>> switch(d) {
>>>>>> case 0: inc(); break;
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> After optimization we should got 3 additional loops: when (c == 0&& d
>>>>>> == 0), when (c == 0&& d != 0) and when (c != 0&& d == 0). Original
>>>>>> loop will activated for (c != 0&& d != 0):
>>>>>>
>>>>>> if (c == 0&& d == 0) {
>>>>>> for (...) ... // All is clear here. Two "switch(0)" instructions.
>>>>>> } else if (c == 0&& d != 0) {
>>>>>> for (...) {
>>>>>> switch (0) { // c == 0
>>>>>> case 0: inc(); break;
>>>>>> }
>>>>>> switch (d) {
>>>>>> case 0: goto unreachable; // CHECK: That it will not unswitched
>>>>>> // again, since it looks "trivial",
>>>>>> // see LoopUnswitch::IsTrivialUnswitchCondition
>>>>>> }
>>>>>> }
>>>>>> } else if (c != 0&& d == 0) {
>>>>>> // the same...
>>>>>> ...
>>>>>> } else { // if (c != 0&& d != 0)
>>>>>> // Original totally unswitched loop:
>>>>>> switch (c) {
>>>>>> case 0: goto unreachable;
>>>>>> }
>>>>>> switch (d) {
>>>>>> case 0: goto unreachable;
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> Stepan.
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> llvm-commits mailing list
>>>>>> llvm-commits at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>
>>>>> _______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop-unswitch-unswitchvals.patch
Type: text/x-patch
Size: 6362 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20111205/bfcf2325/attachment.bin
From stpworld at narod.ru Mon Dec 5 07:05:38 2011
From: stpworld at narod.ru (Stepan Dyatkovskiy)
Date: Mon, 05 Dec 2011 17:05:38 +0400
Subject: [llvm-commits] [LLVM,
SelectionDAG] fix for #9905: Failure in code selection for llvm
intrinsics sqrt/exp
In-Reply-To: <4ED9D140.2070504@narod.ru>
References: <4ED74593.2030003@narod.ru> <4ED9D140.2070504@narod.ru>
Message-ID: <4EDCC1A2.5010500@narod.ru>
ping.
-Stepan.
Stepan Dyatkovskiy wrote:
> ping.
>
> -Stepan
>
> Stepan Dyatkovskiy wrote:
>> Hi all. Please find the patch and regression tests in attachment for
>> review.
>> This patch for ARM. It fixes selection for several instructions that
>> works with v4f32 arguments: FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2,
>> FLOG10, FEXP, FEXP2.
>> I'm still worrying about FCOPYSIGN, FNEG, FABS, FCEIL, FTRUNC, FRINT,
>> FNEARBYINT, FFLOOR. I could not found a way to add this instructions
>> with v2f32 argument to DAG. It seems that it is impossible in ToT. So
>> these instructions was not fixed.
>>
>> -Stepan.
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From glider at google.com Mon Dec 5 02:44:28 2011
From: glider at google.com (Alexander Potapenko)
Date: Mon, 5 Dec 2011 12:44:28 +0400
Subject: [llvm-commits] AddressSanitizer GCD tests on Mac: prevent
optimization, enable.
Message-ID:
Fix GCD tests for AddressSanitizer on Mac.
The following patch declares the char* vars holding the memory
allocations as volatile, which prevents the compiler from optimizing
them and breaking the tests.
I'm also enabling the tests by default, as the GCD support in ASan
runtime library is quite stable already.
--
Alexander Potapenko
Software Engineer
Google Moscow
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asan-mac-test.patch
Type: text/x-patch
Size: 4035 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20111205/8ba6136d/attachment.bin
From victor.umansky at intel.com Mon Dec 5 06:26:20 2011
From: victor.umansky at intel.com (Umansky, Victor)
Date: Mon, 5 Dec 2011 14:26:20 +0200
Subject: [llvm-commits] x86 branch sequence optimization in LLVM code gen:
please review
Message-ID: <021AD592C708E24FA11FD214489EC9BE0123F25260@hasmsx501.ger.corp.intel.com>
Hi,
My name is Victor Umansky; I'm an engineer in Intel OpenCL Team.
The attached patch contains an optimization of ptest-conditioned branch.
I.e., the following LLVM IR code
%res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
%tmp = and i32 %res, 1
%one = icmp eq i32 %tmp, 0
br i1 %one, label %label1, label %label2
ends with the following x86 machine code sequence:
ptest XMM3, XMM3
sete AL
movzx EAX, AL
test EAX, EAX
jne LBB18_26
which can be optimized to:
ptest XMM3, XMM3
je LBB18_26
The current machine code sequence stems from the need to coordinate i32 return type from the ptestz intrinsic with i1 condition type for branch IR instruction.
Consequently we can optimize it in x86 codegen backend where the both condition producer (ptest) amd consumer (jcc) use the same x86 EFLAGS register, and thus in-between conversions of the condition can be quietly dropped.
The optimization is focused on x86 DAG combining (post-legalization stage) which recognizes the sequence and converts it to the minimized one.
The attached patch file includes both the x86 backend instruction combining modification and a LIT regression test for it.
I'd like to commit the fix to the LLVM trunk, and your feedback will be mostly appreciated.
Best Regards,
Victor
---------------------------------------------------------------------
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/20111205/b8b519d1/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: brcond_combining.patch
Type: application/octet-stream
Size: 6435 bytes
Desc: brcond_combining.patch
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20111205/b8b519d1/attachment.obj
From bruno.cardoso at gmail.com Mon Dec 5 11:12:49 2011
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Mon, 5 Dec 2011 15:12:49 -0200
Subject: [llvm-commits] x86 branch sequence optimization in LLVM code
gen: please review
In-Reply-To: <021AD592C708E24FA11FD214489EC9BE0123F25260@hasmsx501.ger.corp.intel.com>
References: <021AD592C708E24FA11FD214489EC9BE0123F25260@hasmsx501.ger.corp.intel.com>
Message-ID:
Hi Victor,
On Mon, Dec 5, 2011 at 10:26 AM, Umansky, Victor
wrote:
> Hi,
>
> My name is Victor Umansky; I?m an engineer in Intel OpenCL Team.
>
> The attached patch contains an optimization of ptest-conditioned branch.
>
> I.e., the following LLVM IR code
>
> %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float>
> %a) nounwind
> %tmp = and i32 %res, 1
> %one = icmp eq i32 %tmp, 0
> br i1 %one, label %label1, label %label2
>
> ends with the following x86 machine code sequence:
>
> ptest XMM3, XMM3
> sete AL
> movzx EAX, AL
> test EAX, EAX
> jne LBB18_26
>
> which can be optimized to:
>
> ptest XMM3, XMM3
> je LBB18_26
>
>
> The current machine code sequence stems from the need to coordinate *i32
> return type* from the ptestz intrinsic with *i1 condition type* for
> branch IR instruction.
> Consequently we can optimize it in x86 codegen backend where the both
> condition producer (ptest) amd consumer (jcc) use the *same x86 **EFLAGS
> register*, and thus in-between conversions of the condition can be
> quietly dropped.
>
> The optimization is focused on x86 DAG combining (post-legalization stage)
> which recognizes the sequence and converts it to the minimized one.
>
> The attached patch file includes both the x86 backend instruction
> combining modification and a LIT regression test for it.
>
>
> I?d like to commit the fix to the LLVM trunk, and your feedback will be
> mostly appreciated.
>
>
+; RUN: llc %s -march=x86-64 -mcpu=corei7 -o %t.asm
+; RUN: FileCheck %s --input-file=%t.asm
Please do like the other tests, and read the file with "< %s". Also, place
it under test/CodeGen/X86/brcond.ll
--
Bruno Cardoso Lopes
http://www.brunocardoso.cc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20111205/8e6d2f7f/attachment.html
From benny.kra at googlemail.com Mon Dec 5 11:23:27 2011
From: benny.kra at googlemail.com (Benjamin Kramer)
Date: Mon, 05 Dec 2011 17:23:27 -0000
Subject: [llvm-commits] [llvm] r145810 - in /llvm/trunk/lib:
Transforms/Utils/AddrModeMatcher.cpp VMCore/Value.cpp
Message-ID: <20111205172328.0317E2A6C12C@llvm.org>
Author: d0k
Date: Mon Dec 5 11:23:27 2011
New Revision: 145810
URL: http://llvm.org/viewvc/llvm-project?rev=145810&view=rev
Log:
Add a little heuristic to Value::isUsedInBasicBlock to speed it up for small basic blocks.
- Calling getUser in a loop is much more expensive than iterating over a few instructions.
- Use it instead of the open-coded loop in AddrModeMatcher.
- 5% speedup on ARMDisassembler.cpp Release builds.
Modified:
llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp
llvm/trunk/lib/VMCore/Value.cpp
Modified: llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp?rev=145810&r1=145809&r2=145810&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp Mon Dec 5 11:23:27 2011
@@ -473,14 +473,7 @@
// Check to see if this value is already used in the memory instruction's
// block. If so, it's already live into the block at the very least, so we
// can reasonably fold it.
- BasicBlock *MemBB = MemoryInst->getParent();
- for (Value::use_iterator UI = Val->use_begin(), E = Val->use_end();
- UI != E; ++UI)
- // We know that uses of arguments and instructions have to be instructions.
- if (cast(*UI)->getParent() == MemBB)
- return true;
-
- return false;
+ return Val->isUsedInBasicBlock(MemoryInst->getParent());
}
Modified: llvm/trunk/lib/VMCore/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=145810&r1=145809&r2=145810&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Value.cpp (original)
+++ llvm/trunk/lib/VMCore/Value.cpp Mon Dec 5 11:23:27 2011
@@ -108,6 +108,19 @@
/// isUsedInBasicBlock - Return true if this value is used in the specified
/// basic block.
bool Value::isUsedInBasicBlock(const BasicBlock *BB) const {
+ // Start by scanning over the instructions looking for a use before we start
+ // the expensive use iteration.
+ unsigned MaxBlockSize = 3;
+ for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
+ if (std::find(I->op_begin(), I->op_end(), this) != I->op_end())
+ return true;
+ if (MaxBlockSize-- == 0) // If the block is larger fall back to use_iterator
+ break;
+ }
+
+ if (MaxBlockSize != 0) // We scanned the entire block and found no use.
+ return false;
+
for (const_use_iterator I = use_begin(), E = use_end(); I != E; ++I) {
const Instruction *User = dyn_cast(*I);
if (User && User->getParent() == BB)
From hfinkel at anl.gov Mon Dec 5 11:54:18 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 17:54:18 -0000
Subject: [llvm-commits] [llvm] r145816 -
/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
Message-ID: <20111205175418.0C62B2A6C12C@llvm.org>
Author: hfinkel
Date: Mon Dec 5 11:54:17 2011
New Revision: 145816
URL: http://llvm.org/viewvc/llvm-project?rev=145816&view=rev
Log:
add register pressure for CR regs
Modified:
llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=145816&r1=145815&r2=145816&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Mon Dec 5 11:54:17 2011
@@ -291,6 +291,8 @@
case PPC::F4RCRegClassID:
case PPC::VRRCRegClassID:
return 32 - DefaultSafety;
+ case PPC::CRRCRegClassID:
+ return 8 - DefaultSafety;
}
}
From hfinkel at anl.gov Mon Dec 5 11:55:06 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 17:55:06 -0000
Subject: [llvm-commits] [llvm] r145817 -
/llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll
Message-ID: <20111205175506.E17512A6C12C@llvm.org>
Author: hfinkel
Date: Mon Dec 5 11:55:06 2011
New Revision: 145817
URL: http://llvm.org/viewvc/llvm-project?rev=145817&view=rev
Log:
remove wasted space for extra bit copies of CR2 subregs
Modified:
llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll
Modified: llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll?rev=145817&r1=145816&r2=145817&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll Mon Dec 5 11:55:06 2011
@@ -9,7 +9,7 @@
;CHECK: mfcr r2
;CHECK: lis r0, 1
;CHECK: rlwinm r2, r2, 8, 0, 31
-;CHECK: ori r0, r0, 34540
+;CHECK: ori r0, r0, 34524
;CHECK: stwx r2, r1, r0
%x = alloca [100000 x i8] ; <[100000 x i8]*> [#uses=1]
%"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
@@ -20,7 +20,7 @@
return: ; preds = %entry
;CHECK: lis r0, 1
-;CHECK: ori r0, r0, 34540
+;CHECK: ori r0, r0, 34524
;CHECK: lwzx r2, r1, r0
;CHECK: rlwinm r2, r2, 24, 0, 31
;CHECK: mtcrf 32, r2
From hfinkel at anl.gov Mon Dec 5 11:55:13 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 17:55:13 -0000
Subject: [llvm-commits] [llvm] r145818 -
/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
Message-ID: <20111205175513.259212A6C12C@llvm.org>
Author: hfinkel
Date: Mon Dec 5 11:55:12 2011
New Revision: 145818
URL: http://llvm.org/viewvc/llvm-project?rev=145818&view=rev
Log:
don't include CR bit subregs in callee-saved list
Modified:
llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=145818&r1=145817&r2=145818&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Mon Dec 5 11:55:12 2011
@@ -120,10 +120,6 @@
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
- PPC::CR2LT, PPC::CR2GT, PPC::CR2EQ, PPC::CR2UN,
- PPC::CR3LT, PPC::CR3GT, PPC::CR3EQ, PPC::CR3UN,
- PPC::CR4LT, PPC::CR4GT, PPC::CR4EQ, PPC::CR4UN,
-
PPC::LR, 0
};
@@ -149,10 +145,6 @@
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
- PPC::CR2LT, PPC::CR2GT, PPC::CR2EQ, PPC::CR2UN,
- PPC::CR3LT, PPC::CR3GT, PPC::CR3EQ, PPC::CR3UN,
- PPC::CR4LT, PPC::CR4GT, PPC::CR4EQ, PPC::CR4UN,
-
0
};
// 64-bit Darwin calling convention.
@@ -174,10 +166,6 @@
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
- PPC::CR2LT, PPC::CR2GT, PPC::CR2EQ, PPC::CR2UN,
- PPC::CR3LT, PPC::CR3GT, PPC::CR3EQ, PPC::CR3UN,
- PPC::CR4LT, PPC::CR4GT, PPC::CR4EQ, PPC::CR4UN,
-
PPC::LR8, 0
};
@@ -203,10 +191,6 @@
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
- PPC::CR2LT, PPC::CR2GT, PPC::CR2EQ, PPC::CR2UN,
- PPC::CR3LT, PPC::CR3GT, PPC::CR3EQ, PPC::CR3UN,
- PPC::CR4LT, PPC::CR4GT, PPC::CR4EQ, PPC::CR4UN,
-
0
};
From hfinkel at anl.gov Mon Dec 5 11:55:18 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 17:55:18 -0000
Subject: [llvm-commits] [llvm] r145819 - in /llvm/trunk:
lib/Target/PowerPC/PPCFrameLowering.cpp lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.cpp
test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll
test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll
test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll
test/CodeGen/PowerPC/2010-02-12-saveCR.ll
test/CodeGen/PowerPC/Frames-alloca.ll test/CodeGen/PowerPC/ppc32-vaarg.ll
Message-ID: <20111205175518.343FF2A6C12C@llvm.org>
Author: hfinkel
Date: Mon Dec 5 11:55:17 2011
New Revision: 145819
URL: http://llvm.org/viewvc/llvm-project?rev=145819&view=rev
Log:
enable PPC register scavenging by default (update tests and remove some FIXMEs)
Modified:
llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/trunk/test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll
llvm/trunk/test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll
llvm/trunk/test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll
llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll
llvm/trunk/test/CodeGen/PowerPC/Frames-alloca.ll
llvm/trunk/test/CodeGen/PowerPC/ppc32-vaarg.ll
Modified: llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp Mon Dec 5 11:55:17 2011
@@ -772,7 +772,7 @@
// FIXME: doesn't detect whether or not we need to spill vXX, which requires
// r0 for now.
- if (RegInfo->requiresRegisterScavenging(MF)) // FIXME (64-bit): Enable.
+ if (RegInfo->requiresRegisterScavenging(MF))
if (needsFP(MF) || spillsCR(MF)) {
const TargetRegisterClass *GPRC = &PPC::GPRCRegClass;
const TargetRegisterClass *G8RC = &PPC::G8RCRegClass;
Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Mon Dec 5 11:55:17 2011
@@ -33,8 +33,8 @@
#include "PPCGenInstrInfo.inc"
namespace llvm {
-extern cl::opt EnablePPC32RS; // FIXME (64-bit): See PPCRegisterInfo.cpp.
-extern cl::opt EnablePPC64RS; // FIXME (64-bit): See PPCRegisterInfo.cpp.
+extern cl::opt DisablePPC32RS;
+extern cl::opt DisablePPC64RS;
}
using namespace llvm;
@@ -345,6 +345,7 @@
BuildMI(MBB, I, DL, MCID, DestReg).addReg(SrcReg, getKillRegState(KillSrc));
}
+// This function returns true if a CR spill is necessary and false otherwise.
bool
PPCInstrInfo::StoreRegToStackSlot(MachineFunction &MF,
unsigned SrcReg, bool isKill,
@@ -395,9 +396,8 @@
getKillRegState(isKill)),
FrameIdx));
} else if (PPC::CRRCRegisterClass->hasSubClassEq(RC)) {
- if ((EnablePPC32RS && !TM.getSubtargetImpl()->isPPC64()) ||
- (EnablePPC64RS && TM.getSubtargetImpl()->isPPC64())) {
- // FIXME (64-bit): Enable
+ if ((!DisablePPC32RS && !TM.getSubtargetImpl()->isPPC64()) ||
+ (!DisablePPC64RS && TM.getSubtargetImpl()->isPPC64())) {
NewMIs.push_back(addFrameReference(BuildMI(MF, DL, get(PPC::SPILL_CR))
.addReg(SrcReg,
getKillRegState(isKill)),
Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Mon Dec 5 11:55:17 2011
@@ -46,15 +46,14 @@
#define GET_REGINFO_TARGET_DESC
#include "PPCGenRegisterInfo.inc"
-// FIXME (64-bit): Eventually enable by default.
namespace llvm {
-cl::opt EnablePPC32RS("enable-ppc32-regscavenger",
+cl::opt DisablePPC32RS("disable-ppc32-regscavenger",
cl::init(false),
- cl::desc("Enable PPC32 register scavenger"),
+ cl::desc("Disable PPC32 register scavenger"),
cl::Hidden);
-cl::opt EnablePPC64RS("enable-ppc64-regscavenger",
+cl::opt DisablePPC64RS("disable-ppc64-regscavenger",
cl::init(false),
- cl::desc("Enable PPC64 register scavenger"),
+ cl::desc("Disable PPC64 register scavenger"),
cl::Hidden);
}
@@ -63,8 +62,8 @@
// FIXME (64-bit): Should be inlined.
bool
PPCRegisterInfo::requiresRegisterScavenging(const MachineFunction &) const {
- return ((EnablePPC32RS && !Subtarget.isPPC64()) ||
- (EnablePPC64RS && Subtarget.isPPC64()));
+ return ((!DisablePPC32RS && !Subtarget.isPPC64()) ||
+ (!DisablePPC64RS && Subtarget.isPPC64()));
}
PPCRegisterInfo::PPCRegisterInfo(const PPCSubtarget &ST,
@@ -231,9 +230,6 @@
Reserved.set(PPC::R13);
Reserved.set(PPC::R31);
- if (!requiresRegisterScavenging(MF))
- Reserved.set(PPC::R0); // FIXME (64-bit): Remove
-
Reserved.set(PPC::X0);
Reserved.set(PPC::X1);
Reserved.set(PPC::X13);
@@ -544,7 +540,7 @@
}
// Special case for pseudo-op SPILL_CR.
- if (requiresRegisterScavenging(MF)) // FIXME (64-bit): Enable by default.
+ if (requiresRegisterScavenging(MF))
if (OpC == PPC::SPILL_CR) {
lowerCRSpilling(II, FrameIndex, SPAdj, RS);
return;
Modified: llvm/trunk/test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll Mon Dec 5 11:55:17 2011
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=powerpc-apple-darwin -enable-ppc32-regscavenger
+; RUN: llc < %s -mtriple=powerpc-apple-darwin
declare i8* @bar(i32)
Modified: llvm/trunk/test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll Mon Dec 5 11:55:17 2011
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ppc32 -enable-ppc32-regscavenger
+; RUN: llc < %s -march=ppc32
%struct._cpp_strbuf = type { i8*, i32, i32 }
%struct.cpp_string = type { i32, i8* }
Modified: llvm/trunk/test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll Mon Dec 5 11:55:17 2011
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ppc64 -enable-ppc64-regscavenger
+; RUN: llc < %s -march=ppc64
define i16 @test(i8* %d1, i16* %d2) {
%tmp237 = call i16 asm "lhbrx $0, $2, $1", "=r,r,bO,m"( i8* %d1, i32 0, i16* %d2 )
Modified: llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2010-02-12-saveCR.ll Mon Dec 5 11:55:17 2011
@@ -6,11 +6,11 @@
define void @foo() nounwind {
entry:
-;CHECK: mfcr r2
-;CHECK: lis r0, 1
-;CHECK: rlwinm r2, r2, 8, 0, 31
-;CHECK: ori r0, r0, 34524
-;CHECK: stwx r2, r1, r0
+;CHECK: lis r4, 1
+;CHECK: ori r4, r4, 34524
+;CHECK: mfcr r3
+;CHECK: rlwinm r3, r3, 8, 0, 31
+;CHECK: stwx r3, r1, r4
%x = alloca [100000 x i8] ; <[100000 x i8]*> [#uses=1]
%"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
%x1 = bitcast [100000 x i8]* %x to i8* ; [#uses=1]
@@ -19,9 +19,9 @@
br label %return
return: ; preds = %entry
-;CHECK: lis r0, 1
-;CHECK: ori r0, r0, 34524
-;CHECK: lwzx r2, r1, r0
+;CHECK: lis r3, 1
+;CHECK: ori r3, r3, 34524
+;CHECK: lwzx r2, r1, r3
;CHECK: rlwinm r2, r2, 24, 0, 31
;CHECK: mtcrf 32, r2
ret void
Modified: llvm/trunk/test/CodeGen/PowerPC/Frames-alloca.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/Frames-alloca.ll?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/Frames-alloca.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/Frames-alloca.ll Mon Dec 5 11:55:17 2011
@@ -2,9 +2,9 @@
; RUN: llc < %s -march=ppc64 -mtriple=powerpc-apple-darwin8 | FileCheck %s -check-prefix=PPC64
; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | FileCheck %s -check-prefix=PPC32-NOFP
; RUN: llc < %s -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | FileCheck %s -check-prefix=PPC64-NOFP
-; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin8 -enable-ppc32-regscavenger | FileCheck %s -check-prefix=PPC32
-; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin8 -enable-ppc32-regscavenger | FileCheck %s -check-prefix=PPC32-RS
-; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim -enable-ppc32-regscavenger | FileCheck %s -check-prefix=PPC32-RS-NOFP
+; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin8 | FileCheck %s -check-prefix=PPC32
+; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin8 | FileCheck %s -check-prefix=PPC32-RS
+; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | FileCheck %s -check-prefix=PPC32-RS-NOFP
; CHECK-PPC32: stw r31, -4(r1)
; CHECK-PPC32: lwz r1, 0(r1)
Modified: llvm/trunk/test/CodeGen/PowerPC/ppc32-vaarg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc32-vaarg.ll?rev=145819&r1=145818&r2=145819&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/ppc32-vaarg.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/ppc32-vaarg.ll Mon Dec 5 11:55:17 2011
@@ -37,8 +37,8 @@
; CHECK-NEXT: stw 3, -24(1)
; CHECK-NEXT: stw 8, -28(1)
; CHECK-NEXT: stw 6, -32(1)
-; CHECK-NEXT: mfcr 0 # cr0
-; CHECK-NEXT: stw 0, -36(1)
+; CHECK-NEXT: mfcr 3 # cr0
+; CHECK-NEXT: stw 3, -36(1)
; CHECK-NEXT: blt 0, .LBB0_4
; CHECK-NEXT: # BB#3: # %entry
; CHECK-NEXT: lwz 3, -20(1)
@@ -82,8 +82,8 @@
; CHECK-NEXT: stw 4, -52(1)
; CHECK-NEXT: stw 6, -56(1)
; CHECK-NEXT: stw 8, -60(1)
-; CHECK-NEXT: mfcr 0 # cr0
-; CHECK-NEXT: stw 0, -64(1)
+; CHECK-NEXT: mfcr 3 # cr0
+; CHECK-NEXT: stw 3, -64(1)
; CHECK-NEXT: blt 0, .LBB0_8
; CHECK-NEXT: # BB#7: # %entry
; CHECK-NEXT: lwz 3, -48(1)
@@ -122,8 +122,8 @@
; CHECK-NEXT: mr 8, 5
; CHECK-NEXT: stw 4, -72(1)
; CHECK-NEXT: stw 6, -76(1)
-; CHECK-NEXT: mfcr 0 # cr0
-; CHECK-NEXT: stw 0, -80(1)
+; CHECK-NEXT: mfcr 3 # cr0
+; CHECK-NEXT: stw 3, -80(1)
; CHECK-NEXT: stw 5, -84(1)
; CHECK-NEXT: stw 8, -88(1)
; CHECK-NEXT: stw 7, -92(1)
From hfinkel at anl.gov Mon Dec 5 11:55:22 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 17:55:22 -0000
Subject: [llvm-commits] [llvm] r145820 -
/llvm/trunk/test/CodeGen/PowerPC/2011-12-05-NoSpillDupCR.ll
Message-ID: <20111205175522.F0EF22A6C12C@llvm.org>
Author: hfinkel
Date: Mon Dec 5 11:55:22 2011
New Revision: 145820
URL: http://llvm.org/viewvc/llvm-project?rev=145820&view=rev
Log:
Add test case - this input used to crash because of duplicate generation of SPILL_CRs
Added:
llvm/trunk/test/CodeGen/PowerPC/2011-12-05-NoSpillDupCR.ll
Added: llvm/trunk/test/CodeGen/PowerPC/2011-12-05-NoSpillDupCR.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2011-12-05-NoSpillDupCR.ll?rev=145820&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/2011-12-05-NoSpillDupCR.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/2011-12-05-NoSpillDupCR.ll Mon Dec 5 11:55:22 2011
@@ -0,0 +1,191 @@
+; RUN: llc < %s -mtriple=powerpc-apple-darwin -mcpu=g4 | FileCheck %s
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=g4 | FileCheck %s
+
+; ModuleID = 'tsc.c'
+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-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+ at a = common global [32000 x float] zeroinitializer, align 16
+ at b = common global [32000 x float] zeroinitializer, align 16
+ at c = common global [32000 x float] zeroinitializer, align 16
+ at d = common global [32000 x float] zeroinitializer, align 16
+ at e = common global [32000 x float] zeroinitializer, align 16
+ at aa = common global [256 x [256 x float]] zeroinitializer, align 16
+ at bb = common global [256 x [256 x float]] zeroinitializer, align 16
+ at cc = common global [256 x [256 x float]] zeroinitializer, align 16
+
+ at .str11 = private unnamed_addr constant [6 x i8] c"s122 \00", align 1
+ at .str152 = private unnamed_addr constant [14 x i8] c"S122\09 %.2f \09\09\00", align 1
+
+declare i32 @printf(i8* nocapture, ...) nounwind
+declare i32 @init(i8* %name) nounwind
+declare i64 @clock() nounwind
+declare i32 @dummy(float*, float*, float*, float*, float*, [256 x float]*, [256 x float]*, [256 x float]*, float)
+declare void @check(i32 %name) nounwind
+
+; CHECK: mfcr
+; CHECK: mtcr
+
+define i32 @s122(i32 %n1, i32 %n3) nounwind {
+entry:
+ %call = tail call i32 @init(i8* getelementptr inbounds ([6 x i8]* @.str11, i64 0, i64 0))
+ %call1 = tail call i64 @clock() nounwind
+ %sub = add nsw i32 %n1, -1
+ %cmp316 = icmp slt i32 %sub, 32000
+ br i1 %cmp316, label %entry.split.us, label %for.end.7
+
+entry.split.us: ; preds = %entry
+ %0 = sext i32 %sub to i64
+ %1 = sext i32 %n3 to i64
+ br label %for.body4.lr.ph.us
+
+for.body4.us: ; preds = %for.body4.lr.ph.us, %for.body4.us
+ %indvars.iv20 = phi i64 [ 0, %for.body4.lr.ph.us ], [ %indvars.iv.next21, %for.body4.us ]
+ %indvars.iv = phi i64 [ %0, %for.body4.lr.ph.us ], [ %indvars.iv.next, %for.body4.us ]
+ %indvars.iv.next21 = add i64 %indvars.iv20, 1
+ %sub5.us = sub i64 31999, %indvars.iv20
+ %sext = shl i64 %sub5.us, 32
+ %idxprom.us = ashr exact i64 %sext, 32
+ %arrayidx.us = getelementptr inbounds [32000 x float]* @b, i64 0, i64 %idxprom.us
+ %2 = load float* %arrayidx.us, align 4, !tbaa !5
+ %arrayidx7.us = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %indvars.iv
+ %3 = load float* %arrayidx7.us, align 4, !tbaa !5
+ %add8.us = fadd float %3, %2
+ store float %add8.us, float* %arrayidx7.us, align 4, !tbaa !5
+ %indvars.iv.next = add i64 %indvars.iv, %1
+ %4 = trunc i64 %indvars.iv.next to i32
+ %cmp3.us = icmp slt i32 %4, 32000
+ br i1 %cmp3.us, label %for.body4.us, label %for.body4.lr.ph.us.1
+
+for.body4.lr.ph.us: ; preds = %entry.split.us, %for.end.us.4
+ %nl.019.us = phi i32 [ 0, %entry.split.us ], [ %inc.us.4, %for.end.us.4 ]
+ br label %for.body4.us
+
+for.end12: ; preds = %for.end.7, %for.end.us.4
+ %call13 = tail call i64 @clock() nounwind
+ %sub14 = sub nsw i64 %call13, %call1
+ %conv = sitofp i64 %sub14 to double
+ %div = fdiv double %conv, 1.000000e+06
+ %call15 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str152, i64 0, i64 0), double %div) nounwind
+ tail call void @check(i32 1)
+ ret i32 0
+
+for.body4.lr.ph.us.1: ; preds = %for.body4.us
+ %call10.us = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ br label %for.body4.us.1
+
+for.body4.us.1: ; preds = %for.body4.us.1, %for.body4.lr.ph.us.1
+ %indvars.iv20.1 = phi i64 [ 0, %for.body4.lr.ph.us.1 ], [ %indvars.iv.next21.1, %for.body4.us.1 ]
+ %indvars.iv.1 = phi i64 [ %0, %for.body4.lr.ph.us.1 ], [ %indvars.iv.next.1, %for.body4.us.1 ]
+ %indvars.iv.next21.1 = add i64 %indvars.iv20.1, 1
+ %sub5.us.1 = sub i64 31999, %indvars.iv20.1
+ %sext23 = shl i64 %sub5.us.1, 32
+ %idxprom.us.1 = ashr exact i64 %sext23, 32
+ %arrayidx.us.1 = getelementptr inbounds [32000 x float]* @b, i64 0, i64 %idxprom.us.1
+ %5 = load float* %arrayidx.us.1, align 4, !tbaa !5
+ %arrayidx7.us.1 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %indvars.iv.1
+ %6 = load float* %arrayidx7.us.1, align 4, !tbaa !5
+ %add8.us.1 = fadd float %6, %5
+ store float %add8.us.1, float* %arrayidx7.us.1, align 4, !tbaa !5
+ %indvars.iv.next.1 = add i64 %indvars.iv.1, %1
+ %7 = trunc i64 %indvars.iv.next.1 to i32
+ %cmp3.us.1 = icmp slt i32 %7, 32000
+ br i1 %cmp3.us.1, label %for.body4.us.1, label %for.body4.lr.ph.us.2
+
+for.body4.lr.ph.us.2: ; preds = %for.body4.us.1
+ %call10.us.1 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ br label %for.body4.us.2
+
+for.body4.us.2: ; preds = %for.body4.us.2, %for.body4.lr.ph.us.2
+ %indvars.iv20.2 = phi i64 [ 0, %for.body4.lr.ph.us.2 ], [ %indvars.iv.next21.2, %for.body4.us.2 ]
+ %indvars.iv.2 = phi i64 [ %0, %for.body4.lr.ph.us.2 ], [ %indvars.iv.next.2, %for.body4.us.2 ]
+ %indvars.iv.next21.2 = add i64 %indvars.iv20.2, 1
+ %sub5.us.2 = sub i64 31999, %indvars.iv20.2
+ %sext24 = shl i64 %sub5.us.2, 32
+ %idxprom.us.2 = ashr exact i64 %sext24, 32
+ %arrayidx.us.2 = getelementptr inbounds [32000 x float]* @b, i64 0, i64 %idxprom.us.2
+ %8 = load float* %arrayidx.us.2, align 4, !tbaa !5
+ %arrayidx7.us.2 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %indvars.iv.2
+ %9 = load float* %arrayidx7.us.2, align 4, !tbaa !5
+ %add8.us.2 = fadd float %9, %8
+ store float %add8.us.2, float* %arrayidx7.us.2, align 4, !tbaa !5
+ %indvars.iv.next.2 = add i64 %indvars.iv.2, %1
+ %10 = trunc i64 %indvars.iv.next.2 to i32
+ %cmp3.us.2 = icmp slt i32 %10, 32000
+ br i1 %cmp3.us.2, label %for.body4.us.2, label %for.body4.lr.ph.us.3
+
+for.body4.lr.ph.us.3: ; preds = %for.body4.us.2
+ %call10.us.2 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ br label %for.body4.us.3
+
+for.body4.us.3: ; preds = %for.body4.us.3, %for.body4.lr.ph.us.3
+ %indvars.iv20.3 = phi i64 [ 0, %for.body4.lr.ph.us.3 ], [ %indvars.iv.next21.3, %for.body4.us.3 ]
+ %indvars.iv.3 = phi i64 [ %0, %for.body4.lr.ph.us.3 ], [ %indvars.iv.next.3, %for.body4.us.3 ]
+ %indvars.iv.next21.3 = add i64 %indvars.iv20.3, 1
+ %sub5.us.3 = sub i64 31999, %indvars.iv20.3
+ %sext25 = shl i64 %sub5.us.3, 32
+ %idxprom.us.3 = ashr exact i64 %sext25, 32
+ %arrayidx.us.3 = getelementptr inbounds [32000 x float]* @b, i64 0, i64 %idxprom.us.3
+ %11 = load float* %arrayidx.us.3, align 4, !tbaa !5
+ %arrayidx7.us.3 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %indvars.iv.3
+ %12 = load float* %arrayidx7.us.3, align 4, !tbaa !5
+ %add8.us.3 = fadd float %12, %11
+ store float %add8.us.3, float* %arrayidx7.us.3, align 4, !tbaa !5
+ %indvars.iv.next.3 = add i64 %indvars.iv.3, %1
+ %13 = trunc i64 %indvars.iv.next.3 to i32
+ %cmp3.us.3 = icmp slt i32 %13, 32000
+ br i1 %cmp3.us.3, label %for.body4.us.3, label %for.body4.lr.ph.us.4
+
+for.body4.lr.ph.us.4: ; preds = %for.body4.us.3
+ %call10.us.3 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ br label %for.body4.us.4
+
+for.body4.us.4: ; preds = %for.body4.us.4, %for.body4.lr.ph.us.4
+ %indvars.iv20.4 = phi i64 [ 0, %for.body4.lr.ph.us.4 ], [ %indvars.iv.next21.4, %for.body4.us.4 ]
+ %indvars.iv.4 = phi i64 [ %0, %for.body4.lr.ph.us.4 ], [ %indvars.iv.next.4, %for.body4.us.4 ]
+ %indvars.iv.next21.4 = add i64 %indvars.iv20.4, 1
+ %sub5.us.4 = sub i64 31999, %indvars.iv20.4
+ %sext26 = shl i64 %sub5.us.4, 32
+ %idxprom.us.4 = ashr exact i64 %sext26, 32
+ %arrayidx.us.4 = getelementptr inbounds [32000 x float]* @b, i64 0, i64 %idxprom.us.4
+ %14 = load float* %arrayidx.us.4, align 4, !tbaa !5
+ %arrayidx7.us.4 = getelementptr inbounds [32000 x float]* @a, i64 0, i64 %indvars.iv.4
+ %15 = load float* %arrayidx7.us.4, align 4, !tbaa !5
+ %add8.us.4 = fadd float %15, %14
+ store float %add8.us.4, float* %arrayidx7.us.4, align 4, !tbaa !5
+ %indvars.iv.next.4 = add i64 %indvars.iv.4, %1
+ %16 = trunc i64 %indvars.iv.next.4 to i32
+ %cmp3.us.4 = icmp slt i32 %16, 32000
+ br i1 %cmp3.us.4, label %for.body4.us.4, label %for.end.us.4
+
+for.end.us.4: ; preds = %for.body4.us.4
+ %call10.us.4 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %inc.us.4 = add nsw i32 %nl.019.us, 5
+ %exitcond.4 = icmp eq i32 %inc.us.4, 200000
+ br i1 %exitcond.4, label %for.end12, label %for.body4.lr.ph.us
+
+for.end.7: ; preds = %entry, %for.end.7
+ %nl.019 = phi i32 [ %inc.7, %for.end.7 ], [ 0, %entry ]
+ %call10 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %call10.1 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %call10.2 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %call10.3 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %call10.4 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %call10.5 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %call10.6 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %call10.7 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]]* @cc, i64 0, i64 0), float 0.000000e+00) nounwind
+ %inc.7 = add nsw i32 %nl.019, 8
+ %exitcond.7 = icmp eq i32 %inc.7, 200000
+ br i1 %exitcond.7, label %for.end12, label %for.end.7
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
+
+declare i32 @puts(i8* nocapture) nounwind
+
+!0 = metadata !{metadata !"any pointer", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
+!3 = metadata !{metadata !"branch_weights", i32 64, i32 4}
+!4 = metadata !{metadata !"int", metadata !1}
+!5 = metadata !{metadata !"float", metadata !1}
From kcc at google.com Mon Dec 5 11:56:33 2011
From: kcc at google.com (Kostya Serebryany)
Date: Mon, 05 Dec 2011 17:56:33 -0000
Subject: [llvm-commits] [compiler-rt] r145821 - in
/compiler-rt/trunk/lib/asan: asan_interceptors.h asan_rtl.cc
Message-ID: <20111205175633.274CB2A6C12C@llvm.org>
Author: kcc
Date: Mon Dec 5 11:56:32 2011
New Revision: 145821
URL: http://llvm.org/viewvc/llvm-project?rev=145821&view=rev
Log:
[asan] don't require __cxa_throw to be present in the process. This is the last dependency on libstdc++
Modified:
compiler-rt/trunk/lib/asan/asan_interceptors.h
compiler-rt/trunk/lib/asan/asan_rtl.cc
Modified: compiler-rt/trunk/lib/asan/asan_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.h?rev=145821&r1=145820&r2=145821&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h Mon Dec 5 11:56:32 2011
@@ -37,18 +37,33 @@
#include "mach_override/mach_override.h"
#define WRAP(x) wrap_##x
#define WRAPPER_NAME(x) "wrap_"#x
+
#define OVERRIDE_FUNCTION(oldfunc, newfunc) \
CHECK(0 == mach_override_ptr((void*)(oldfunc), \
(void*)(newfunc), \
(void**)&real_##oldfunc)); \
CHECK(real_##oldfunc != NULL);
+
+#define OVERRIDE_FUNCTION_IF_EXISTS(oldfunc, newfunc) \
+ do { mach_override_ptr((void*)(oldfunc), \
+ (void*)(newfunc), \
+ (void**)&real_##oldfunc); } while (0)
+
#define INTERCEPT_FUNCTION(func) \
OVERRIDE_FUNCTION(func, WRAP(func))
-#else
+
+#define INTERCEPT_FUNCTION_IF_EXISTS(func) \
+ OVERRIDE_FUNCTION_IF_EXISTS(func, WRAP(func))
+
+#else // __linux__
#define WRAP(x) x
#define WRAPPER_NAME(x) #x
+
#define INTERCEPT_FUNCTION(func) \
CHECK((real_##func = (func##_f)dlsym(RTLD_NEXT, #func)));
+
+#define INTERCEPT_FUNCTION_IF_EXISTS(func) \
+ do { real_##func = (func##_f)dlsym(RTLD_NEXT, #func); } while (0)
#endif
#ifdef __APPLE__
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=145821&r1=145820&r2=145821&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Mon Dec 5 11:56:32 2011
@@ -507,6 +507,7 @@
#if ASAN_HAS_EXCEPTIONS
extern "C" void WRAP(__cxa_throw)(void *a, void *b, void *c) {
+ CHECK(&real___cxa_throw);
UnpoisonStackFromHereToTop();
real___cxa_throw(a, b, c);
}
@@ -690,7 +691,7 @@
INTERCEPT_FUNCTION(signal);
INTERCEPT_FUNCTION(longjmp);
INTERCEPT_FUNCTION(_longjmp);
- INTERCEPT_FUNCTION(__cxa_throw);
+ INTERCEPT_FUNCTION_IF_EXISTS(__cxa_throw);
INTERCEPT_FUNCTION(pthread_create);
#ifdef __APPLE__
INTERCEPT_FUNCTION(dispatch_async_f);
From stoklund at 2pi.dk Mon Dec 5 12:12:57 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Mon, 05 Dec 2011 10:12:57 -0800
Subject: [llvm-commits] [llvm] r145819 - in /llvm/trunk:
lib/Target/PowerPC/PPCFrameLowering.cpp lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.cpp
test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll
test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll
test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll
test/CodeGen/PowerPC/2010-02-12-saveCR.ll
test/CodeGen/PowerPC/Frames-alloca.ll test/CodeGen/PowerPC/ppc32-vaarg.ll
In-Reply-To: <20111205175518.343FF2A6C12C@llvm.org>
References: <20111205175518.343FF2A6C12C@llvm.org>
Message-ID:
On Dec 5, 2011, at 9:55 AM, Hal Finkel wrote:
> Author: hfinkel
> Date: Mon Dec 5 11:55:17 2011
> New Revision: 145819
>
> URL: http://llvm.org/viewvc/llvm-project?rev=145819&view=rev
> Log:
> enable PPC register scavenging by default (update tests and remove some FIXMEs)
Nice!
Did you run extensive tests with this change? Does it work with -O0?
The register scavenger is notorious for exposing sloppy liveness info in older targets like PPC. I would expect a number of scavenger assertions.
/jakob
From kcc at google.com Mon Dec 5 12:56:29 2011
From: kcc at google.com (Kostya Serebryany)
Date: Mon, 05 Dec 2011 18:56:29 -0000
Subject: [llvm-commits] [compiler-rt] r145826 -
/compiler-rt/trunk/lib/asan/asan_interceptors.cc
Message-ID: <20111205185629.3CD7A2A6C12C@llvm.org>
Author: kcc
Date: Mon Dec 5 12:56:29 2011
New Revision: 145826
URL: http://llvm.org/viewvc/llvm-project?rev=145826&view=rev
Log:
[asan] cleanup memset/memmove/memcpy interceptors and enable them on Mac. Patch by samsonov at google.com
Modified:
compiler-rt/trunk/lib/asan/asan_interceptors.cc
Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=145826&r1=145825&r2=145826&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Mon Dec 5 12:56:29 2011
@@ -62,15 +62,15 @@
AccessAddress(ptr, isWrite); \
AccessAddress(ptr + (size) - 1, isWrite); \
} \
-} while (0);
+} while (0)
#define ASAN_READ_RANGE(offset, size) do { \
ACCESS_MEMORY_RANGE(offset, size, false); \
-} while (0);
+} while (0)
#define ASAN_WRITE_RANGE(offset, size) do { \
ACCESS_MEMORY_RANGE(offset, size, true); \
-} while (0);
+} while (0)
// Behavior of functions like "memcpy" or "strcpy" is undefined
// if memory intervals overlap. We report error in this case.
@@ -90,15 +90,14 @@
PRINT_CURRENT_STACK(); \
ShowStatsAndAbort(); \
} \
-} while (0);
-
-static inline void ensure_asan_inited() {
- CHECK(!asan_init_is_running);
- if (!asan_inited) {
- __asan_init();
- }
-}
+} while (0)
+#define ENSURE_ASAN_INITED() do { \
+ CHECK(!asan_init_is_running); \
+ if (!asan_inited) { \
+ __asan_init(); \
+ } \
+} while (0)
size_t internal_strlen(const char *s) {
size_t i = 0;
@@ -121,15 +120,9 @@
#else
OVERRIDE_FUNCTION(index, WRAP(strchr));
#endif
-#ifndef __APPLE__
INTERCEPT_FUNCTION(memcpy);
INTERCEPT_FUNCTION(memmove);
INTERCEPT_FUNCTION(memset);
-#else
- real_memcpy = memcpy;
- real_memmove = memmove;
- real_memset = memset;
-#endif
INTERCEPT_FUNCTION(strchr);
INTERCEPT_FUNCTION(strcmp);
INTERCEPT_FUNCTION(strcpy); // NOLINT
@@ -156,7 +149,7 @@
if (asan_init_is_running) {
return real_memcpy(to, from, size);
}
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_intrin) {
CHECK_RANGES_OVERLAP(to, from, size);
ASAN_WRITE_RANGE(from, size);
@@ -166,7 +159,7 @@
}
void *WRAP(memmove)(void *to, const void *from, size_t size) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_intrin) {
ASAN_WRITE_RANGE(from, size);
ASAN_READ_RANGE(to, size);
@@ -175,7 +168,11 @@
}
void *WRAP(memset)(void *block, int c, size_t size) {
- ensure_asan_inited();
+ // memset is called inside INTERCEPT_FUNCTION on Mac.
+ if (asan_init_is_running) {
+ return real_memset(block, c, size);
+ }
+ ENSURE_ASAN_INITED();
if (FLAG_replace_intrin) {
ASAN_WRITE_RANGE(block, size);
}
@@ -192,7 +189,7 @@
#endif
char *WRAP(strchr)(const char *str, int c) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
char *result = real_strchr(str, c);
if (FLAG_replace_str) {
size_t bytes_read = (result ? result - str : real_strlen(str)) + 1;
@@ -229,7 +226,7 @@
if (asan_init_is_running) {
return real_strcpy(to, from);
}
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_str) {
size_t from_size = real_strlen(from) + 1;
CHECK_RANGES_OVERLAP(to, from, from_size);
@@ -240,7 +237,7 @@
}
char *WRAP(strdup)(const char *s) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_str) {
size_t length = real_strlen(s);
ASAN_READ_RANGE(s, length + 1);
@@ -254,7 +251,7 @@
if (asan_init_is_running) {
return real_strlen(s);
}
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
size_t length = real_strlen(s);
if (FLAG_replace_str) {
ASAN_READ_RANGE(s, length + 1);
@@ -281,7 +278,7 @@
}
char *WRAP(strncpy)(char *to, const char *from, size_t size) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
if (FLAG_replace_str) {
size_t from_size = Min(size, internal_strnlen(from, size) + 1);
CHECK_RANGES_OVERLAP(to, from, from_size);
@@ -293,7 +290,7 @@
#ifndef __APPLE__
size_t WRAP(strnlen)(const char *s, size_t maxlen) {
- ensure_asan_inited();
+ ENSURE_ASAN_INITED();
size_t length = real_strnlen(s, maxlen);
if (FLAG_replace_str) {
ASAN_READ_RANGE(s, Min(length + 1, maxlen));
From kcc at google.com Mon Dec 5 13:00:13 2011
From: kcc at google.com (Kostya Serebryany)
Date: Mon, 5 Dec 2011 11:00:13 -0800
Subject: [llvm-commits] Cleanup in ASan interceptors, makefile fix
In-Reply-To:
References:
Message-ID:
landed the part with the interceptors as r145826.
On Sat, Dec 3, 2011 at 2:35 PM, Alexey Samsonov wrote:
> Hello!
>
> This is a cleanup for projects/compiler-rt/lib/asan:
> Rietveld link: http://codereview.appspot.com/5437128/
>
> Makefile.old :
> 1. Fix in Makefile - changes in asan_*.{cc,h} files were not captured
> by "make test" command.
> asan_interceptors.cc:
> 1. ensure_asan_inited() is now a macro (so that CHECK failure outputs
> the line inside a function with troubles).
> 2. wiped out stubs, as memset/memmove/memcpy interceptors are now enabled.
>
> --
> Alexey Samsonov
> Software Engineer, Moscow
> samsonov at google.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20111205/577d9cf5/attachment.html
From konstantin.s.serebryany at gmail.com Mon Dec 5 13:00:55 2011
From: konstantin.s.serebryany at gmail.com (konstantin.s.serebryany at gmail.com)
Date: Mon, 05 Dec 2011 19:00:55 +0000
Subject: [llvm-commits] Cleanup in ASan interceptors (issue 5437128)
Message-ID: <20cf300fae133a7ea604b35cf0c8@google.com>
> Hm-m, let it be a temporary fix then. Without this change, changes in
asan rtl
> are not reflected when we rebuild the tests (or I'm doing smth
completely
> wrong).
I am not sure this is a good goal, but I am sure this is a wrong
solution.
http://codereview.appspot.com/5437128/
From kcc at google.com Mon Dec 5 13:04:33 2011
From: kcc at google.com (Kostya Serebryany)
Date: Mon, 5 Dec 2011 11:04:33 -0800
Subject: [llvm-commits] AddressSanitizer GCD tests on Mac: prevent
optimization, enable.
In-Reply-To:
References:
Message-ID:
I wonder if you can reuse Ident() from tests/asan_test_utils.h instead of
using volatile.
Like this:
char *mem = Ident(malloc(10));
// This function returns its parameter but in such a way that compiler
// can not prove it.
template
__attribute__((noinline))
static T Ident(T t) {
...
--kcc
On Mon, Dec 5, 2011 at 12:44 AM, Alexander Potapenko wrote:
> Fix GCD tests for AddressSanitizer on Mac.
> The following patch declares the char* vars holding the memory
> allocations as volatile, which prevents the compiler from optimizing
> them and breaking the tests.
> I'm also enabling the tests by default, as the GCD support in ASan
> runtime library is quite stable already.
>
> --
> Alexander Potapenko
> Software Engineer
> Google Moscow
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20111205/5af341d9/attachment.html
From hfinkel at anl.gov Mon Dec 5 13:14:25 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 13:14:25 -0600
Subject: [llvm-commits] [llvm] r145819 - in /llvm/trunk:
lib/Target/PowerPC/PPCFrameLowering.cpp lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.cpp
test/CodeGen/PowerPC/2008-03-05-RegScavengerAssert.ll
test/CodeGen/PowerPC/2008-03-17-RegScavengerCrash.ll
test/CodeGen/PowerPC/2008-03-18-RegScavengerAssert.ll
test/CodeGen/PowerPC/2010-02-12-saveCR.ll
test/CodeGen/PowerPC/Frames-alloca.ll test/CodeGen/PowerPC/ppc32-vaarg.ll
In-Reply-To:
References: <20111205175518.343FF2A6C12C@llvm.org>
Message-ID: <1323112465.2507.3170.camel@sapling>
On Mon, 2011-12-05 at 10:12 -0800, Jakob Stoklund Olesen wrote:
> On Dec 5, 2011, at 9:55 AM, Hal Finkel wrote:
>
> > Author: hfinkel
> > Date: Mon Dec 5 11:55:17 2011
> > New Revision: 145819
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=145819&view=rev
> > Log:
> > enable PPC register scavenging by default (update tests and remove some FIXMEs)
>
> Nice!
>
> Did you run extensive tests with this change?
Not extensive; I ran the regression tests and a few other files I've
been using recently. I'll be setup soon to run the test suite on ppc64,
and so I'll test more-extensively using the test suite. Unfortunately,
there are still other problems that I have to fix first (like PR11476,
which may be related to register scavenging, but was not fixed by these
changes).
> Does it work with -O0?
Good point, I'll run some more tests (and the test suite) with -O0. Some
of the regression tests specify -O0 (like the varargs test, which seemed
to be fine).
Thanks again,
Hal
>
> The register scavenger is notorious for exposing sloppy liveness info in older targets like PPC. I would expect a number of scavenger assertions.
>
> /jakob
>
--
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
From ganna at apple.com Mon Dec 5 13:17:04 2011
From: ganna at apple.com (Anna Zaks)
Date: Mon, 05 Dec 2011 19:17:04 -0000
Subject: [llvm-commits] [llvm] r145837 - in /llvm/trunk/include/llvm:
ADT/GraphTraits.h Analysis/DominatorInternals.h Analysis/Dominators.h
CodeGen/MachineFunction.h Support/CFG.h
Message-ID: <20111205191704.D37242A6C12C@llvm.org>
Author: zaks
Date: Mon Dec 5 13:17:04 2011
New Revision: 145837
URL: http://llvm.org/viewvc/llvm-project?rev=145837&view=rev
Log:
Change the Dominators recalculate() function to only rely on GraphTraits
This is a patch by Guoping Long!
As part of utilizing LLVM Dominator computation in Clang, made two changes to LLVM dominators tree implementation:
- (1) Change the recalculate() template function to only rely on GraphTraits.
- (2) Add a size() method to GraphTraits template class to query the number of nodes in the graph.
Modified:
llvm/trunk/include/llvm/ADT/GraphTraits.h
llvm/trunk/include/llvm/Analysis/DominatorInternals.h
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/CodeGen/MachineFunction.h
llvm/trunk/include/llvm/Support/CFG.h
Modified: llvm/trunk/include/llvm/ADT/GraphTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/GraphTraits.h?rev=145837&r1=145836&r2=145837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/GraphTraits.h (original)
+++ llvm/trunk/include/llvm/ADT/GraphTraits.h Mon Dec 5 13:17:04 2011
@@ -43,9 +43,12 @@
// typedef ...iterator nodes_iterator;
// static nodes_iterator nodes_begin(GraphType *G)
// static nodes_iterator nodes_end (GraphType *G)
- //
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
+ // static unsigned size (GraphType *G)
+ // Return total number of nodes in the graph
+ //
+
// If anyone tries to use this class without having an appropriate
// specialization, make an error. If you get this error, it's because you
Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=145837&r1=145836&r2=145837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Mon Dec 5 13:17:04 2011
@@ -171,7 +171,7 @@
// it might be that some blocks did not get a DFS number (e.g., blocks of
// infinite loops). In these cases an artificial exit node is required.
- MultipleRoots |= (DT.isPostDominator() && N != F.size());
+ MultipleRoots |= (DT.isPostDominator() && N != GraphTraits::size(&F));
// When naively implemented, the Lengauer-Tarjan algorithm requires a separate
// bucket for each vertex. However, this is unnecessary, because each vertex
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=145837&r1=145836&r2=145837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Dec 5 13:17:04 2011
@@ -653,21 +653,24 @@
/// recalculate - compute a dominator tree for the given function
template
void recalculate(FT& F) {
+ typedef GraphTraits TraitsTy;
reset();
this->Vertex.push_back(0);
if (!this->IsPostDominators) {
// Initialize root
- this->Roots.push_back(&F.front());
- this->IDoms[&F.front()] = 0;
- this->DomTreeNodes[&F.front()] = 0;
+ NodeT *entry = TraitsTy::getEntryNode(&F);
+ this->Roots.push_back(entry);
+ this->IDoms[entry] = 0;
+ this->DomTreeNodes[entry] = 0;
Calculate(*this, F);
} else {
// Initialize the roots list
- for (typename FT::iterator I = F.begin(), E = F.end(); I != E; ++I) {
- if (std::distance(GraphTraits::child_begin(I),
- GraphTraits::child_end(I)) == 0)
+ for (typename TraitsTy::nodes_iterator I = TraitsTy::nodes_begin(&F),
+ E = TraitsTy::nodes_end(&F); I != E; ++I) {
+ if (std::distance(TraitsTy::child_begin(I),
+ TraitsTy::child_end(I)) == 0)
addRoot(I);
// Prepopulate maps so that we don't get iterator invalidation issues later.
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=145837&r1=145836&r2=145837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Dec 5 13:17:04 2011
@@ -437,6 +437,7 @@
typedef MachineFunction::iterator nodes_iterator;
static nodes_iterator nodes_begin(MachineFunction *F) { return F->begin(); }
static nodes_iterator nodes_end (MachineFunction *F) { return F->end(); }
+ static unsigned size (MachineFunction *F) { return F->size(); }
};
template <> struct GraphTraits :
public GraphTraits {
@@ -452,6 +453,9 @@
static nodes_iterator nodes_end (const MachineFunction *F) {
return F->end();
}
+ static unsigned size (const MachineFunction *F) {
+ return F->size();
+ }
};
Modified: llvm/trunk/include/llvm/Support/CFG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CFG.h?rev=145837&r1=145836&r2=145837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CFG.h (original)
+++ llvm/trunk/include/llvm/Support/CFG.h Mon Dec 5 13:17:04 2011
@@ -314,6 +314,7 @@
typedef Function::iterator nodes_iterator;
static nodes_iterator nodes_begin(Function *F) { return F->begin(); }
static nodes_iterator nodes_end (Function *F) { return F->end(); }
+ static unsigned size (Function *F) { return F->size(); }
};
template <> struct GraphTraits :
public GraphTraits {
@@ -323,6 +324,7 @@
typedef Function::const_iterator nodes_iterator;
static nodes_iterator nodes_begin(const Function *F) { return F->begin(); }
static nodes_iterator nodes_end (const Function *F) { return F->end(); }
+ static unsigned size (const Function *F) { return F->size(); }
};
From kcc at google.com Mon Dec 5 13:17:53 2011
From: kcc at google.com (Kostya Serebryany)
Date: Mon, 05 Dec 2011 19:17:53 -0000
Subject: [llvm-commits] [compiler-rt] r145838 - in
/compiler-rt/trunk/lib/asan: asan_allocator.cc asan_interface.h
asan_internal.h asan_rtl.cc asan_stats.cc tests/asan_interface_test.cc
tests/asan_noinst_test.cc
Message-ID: <20111205191753.5C7522A6C12C@llvm.org>
Author: kcc
Date: Mon Dec 5 13:17:53 2011
New Revision: 145838
URL: http://llvm.org/viewvc/llvm-project?rev=145838&view=rev
Log:
[asan] always collect malloc statstics (removed FLAG_stats)
Modified:
compiler-rt/trunk/lib/asan/asan_allocator.cc
compiler-rt/trunk/lib/asan/asan_interface.h
compiler-rt/trunk/lib/asan/asan_internal.h
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/asan/asan_stats.cc
compiler-rt/trunk/lib/asan/tests/asan_interface_test.cc
compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc
Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=145838&r1=145837&r2=145838&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.cc Mon Dec 5 13:17:53 2011
@@ -491,13 +491,12 @@
m->next = free_lists_[size_class];
free_lists_[size_class] = m;
- if (FLAG_stats) {
- AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
- thread_stats.real_frees++;
- thread_stats.really_freed += m->used_size;
- thread_stats.really_freed_redzones += m->Size() - m->used_size;
- thread_stats.really_freed_by_size[m->SizeClass()]++;
- }
+ // Statistics.
+ AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
+ thread_stats.real_frees++;
+ thread_stats.really_freed += m->used_size;
+ thread_stats.really_freed_redzones += m->Size() - m->used_size;
+ thread_stats.really_freed_by_size[m->SizeClass()]++;
}
// Get a list of newly allocated chunks.
@@ -517,12 +516,13 @@
}
CHECK(n_chunks > 0);
uint8_t *mem = MmapNewPagesAndPoisonShadow(mmap_size);
- if (FLAG_stats) {
- AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
- thread_stats.mmaps++;
- thread_stats.mmaped += mmap_size;
- thread_stats.mmaped_by_size[size_class] += n_chunks;
- }
+
+ // Statistics.
+ AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
+ thread_stats.mmaps++;
+ thread_stats.mmaped += mmap_size;
+ thread_stats.mmaped_by_size[size_class] += n_chunks;
+
AsanChunk *res = NULL;
for (size_t i = 0; i < n_chunks; i++) {
AsanChunk *m = (AsanChunk*)(mem + i * size);
@@ -623,29 +623,24 @@
AsanThread *t = asanThreadRegistry().GetCurrent();
AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
- if (FLAG_stats) {
- thread_stats.mallocs++;
- thread_stats.malloced += size;
- thread_stats.malloced_redzones += size_to_allocate - size;
- thread_stats.malloced_by_size[size_class]++;
- }
+ // Statistics
+ thread_stats.mallocs++;
+ thread_stats.malloced += size;
+ thread_stats.malloced_redzones += size_to_allocate - size;
+ thread_stats.malloced_by_size[size_class]++;
AsanChunk *m = NULL;
if (!t || size_to_allocate >= kMaxSizeForThreadLocalFreeList) {
// get directly from global storage.
m = malloc_info.AllocateChunks(size_class, 1);
- if (FLAG_stats) {
- thread_stats.malloc_large++;
- }
+ thread_stats.malloc_large++;
} else {
// get from the thread-local storage.
AsanChunk **fl = &t->malloc_storage().free_lists_[size_class];
if (!*fl) {
size_t n_new_chunks = kMaxSizeForThreadLocalFreeList / size_to_allocate;
*fl = malloc_info.AllocateChunks(size_class, n_new_chunks);
- if (FLAG_stats) {
- thread_stats.malloc_small_slow++;
- }
+ thread_stats.malloc_small_slow++;
}
m = *fl;
*fl = (*fl)->next;
@@ -714,12 +709,11 @@
size_t rounded_size = RoundUpTo(m->used_size, REDZONE);
PoisonShadow((uintptr_t)ptr, rounded_size, kAsanHeapFreeMagic);
- if (FLAG_stats) {
- AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
- thread_stats.frees++;
- thread_stats.freed += m->used_size;
- thread_stats.freed_by_size[m->SizeClass()]++;
- }
+ // Statistics.
+ AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
+ thread_stats.frees++;
+ thread_stats.freed += m->used_size;
+ thread_stats.freed_by_size[m->SizeClass()]++;
m->chunk_state = CHUNK_QUARANTINE;
if (t) {
@@ -739,11 +733,12 @@
static uint8_t *Reallocate(uint8_t *old_ptr, size_t new_size,
AsanStackTrace *stack) {
CHECK(old_ptr && new_size);
- if (FLAG_stats) {
- AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
- thread_stats.reallocs++;
- thread_stats.realloced += new_size;
- }
+
+ // Statistics.
+ AsanStats &thread_stats = asanThreadRegistry().GetCurrentThreadStats();
+ thread_stats.reallocs++;
+ thread_stats.realloced += new_size;
+
AsanChunk *m = PtrToChunk((uintptr_t)old_ptr);
CHECK(m->chunk_state == CHUNK_ALLOCATED);
size_t old_size = m->used_size;
Modified: compiler-rt/trunk/lib/asan/asan_interface.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface.h?rev=145838&r1=145837&r2=145838&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interface.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interface.h Mon Dec 5 13:17:53 2011
@@ -126,8 +126,6 @@
// Number of bytes in unmapped pages, that are released to OS. Currently,
// always returns 0.
size_t __asan_get_unmapped_bytes();
- // Turns on/off statistics update. Returns the previous value.
- bool __asan_enable_statistics(bool enable);
// Prints accumulated stats to stderr. Used for debugging.
void __asan_print_accumulated_stats();
} // namespace
Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=145838&r1=145837&r2=145838&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Mon Dec 5 13:17:53 2011
@@ -97,7 +97,6 @@
extern bool FLAG_poison_shadow;
extern int FLAG_report_globals;
extern size_t FLAG_malloc_context_size;
-extern bool FLAG_stats;
extern bool FLAG_replace_str;
extern bool FLAG_replace_intrin;
extern bool FLAG_replace_cfallocator;
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=145838&r1=145837&r2=145838&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Mon Dec 5 13:17:53 2011
@@ -73,7 +73,6 @@
bool FLAG_replace_str;
bool FLAG_replace_intrin;
bool FLAG_replace_cfallocator; // Used on Mac only.
-bool FLAG_stats;
size_t FLAG_max_malloc_fill_size = 0;
bool FLAG_use_fake_stack;
int FLAG_exitcode = EXIT_FAILURE;
@@ -661,7 +660,6 @@
FLAG_handle_segv = IntFlagValue(options, "handle_segv=",
ASAN_NEEDS_SEGV);
FLAG_handle_sigill = IntFlagValue(options, "handle_sigill=", 0);
- FLAG_stats = IntFlagValue(options, "stats=", 0);
FLAG_symbolize = IntFlagValue(options, "symbolize=", 1);
FLAG_demangle = IntFlagValue(options, "demangle=", 1);
FLAG_debug = IntFlagValue(options, "debug=", 0);
Modified: compiler-rt/trunk/lib/asan/asan_stats.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stats.cc?rev=145838&r1=145837&r2=145838&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_stats.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_stats.cc Mon Dec 5 13:17:53 2011
@@ -56,7 +56,6 @@
static AsanLock print_lock(LINKER_INITIALIZED);
static void PrintAccumulatedStats() {
- if (!FLAG_stats) return;
AsanStats stats = asanThreadRegistry().GetAccumulatedStats();
// Use lock to keep reports from mixing up.
ScopedLock lock(&print_lock);
@@ -84,12 +83,6 @@
return 0;
}
-bool __asan_enable_statistics(bool enable) {
- bool old_flag = FLAG_stats;
- FLAG_stats = enable;
- return old_flag;
-}
-
void __asan_print_accumulated_stats() {
PrintAccumulatedStats();
}
Modified: compiler-rt/trunk/lib/asan/tests/asan_interface_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_interface_test.cc?rev=145838&r1=145837&r2=145838&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_interface_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_interface_test.cc Mon Dec 5 13:17:53 2011
@@ -63,17 +63,10 @@
delete int_ptr;
}
-TEST(AddressSanitizerInterface, EnableStatisticsTest) {
- bool old_stats_value = __asan_enable_statistics(true);
- EXPECT_EQ(true, __asan_enable_statistics(false));
- EXPECT_EQ(false, __asan_enable_statistics(old_stats_value));
-}
-
TEST(AddressSanitizerInterface, GetCurrentAllocatedBytesTest) {
size_t before_malloc, after_malloc, after_free;
char *array;
const size_t kMallocSize = 100;
- bool old_stats_value = __asan_enable_statistics(true);
before_malloc = __asan_get_current_allocated_bytes();
array = Ident((char*)malloc(kMallocSize));
@@ -83,14 +76,6 @@
free(array);
after_free = __asan_get_current_allocated_bytes();
EXPECT_EQ(before_malloc, after_free);
-
- __asan_enable_statistics(false);
- array = Ident((char*)malloc(kMallocSize));
- after_malloc = __asan_get_current_allocated_bytes();
- EXPECT_EQ(before_malloc, after_malloc);
-
- free(array);
- __asan_enable_statistics(old_stats_value);
}
static void DoDoubleFree() {
@@ -106,7 +91,6 @@
size_t old_heap_size, new_heap_size, heap_growth;
// We unlikely have have chunk of this size in free list.
static const size_t kLargeMallocSize = 1 << 29; // 512M
- __asan_enable_statistics(true);
old_heap_size = __asan_get_heap_size();
fprintf(stderr, "allocating %zu bytes:\n", kLargeMallocSize);
free(Ident(malloc(kLargeMallocSize)));
@@ -136,7 +120,6 @@
static void DoLargeMallocForGetFreeBytesTestAndDie() {
size_t old_free_bytes, new_free_bytes;
static const size_t kLargeMallocSize = 1 << 29; // 512M
- __asan_enable_statistics(true);
// If we malloc and free a large memory chunk, it will not fall
// into quarantine and will be available for future requests.
old_free_bytes = __asan_get_free_bytes();
@@ -156,7 +139,6 @@
char *chunks[kNumOfChunks];
size_t i;
size_t old_free_bytes, new_free_bytes;
- bool old_stats_value = __asan_enable_statistics(true);
// Allocate a small chunk. Now allocator probably has a lot of these
// chunks to fulfill future requests. So, future requests will decrease
// the number of free bytes.
@@ -175,7 +157,6 @@
EXPECT_EQ(old_free_bytes, __asan_get_free_bytes());
}
EXPECT_DEATH(DoLargeMallocForGetFreeBytesTestAndDie(), "double-free");
- __asan_enable_statistics(old_stats_value);
}
static const size_t kManyThreadsMallocSizes[] = {5, 1UL<<10, 1UL<<20, 357};
@@ -194,7 +175,6 @@
TEST(AddressSanitizerInterface, ManyThreadsWithStatsStressTest) {
size_t before_test, after_test, i;
pthread_t threads[kManyThreadsNumThreads];
- bool old_stats_value = __asan_enable_statistics(true);
before_test = __asan_get_current_allocated_bytes();
for (i = 0; i < kManyThreadsNumThreads; i++) {
pthread_create(&threads[i], 0,
@@ -207,7 +187,6 @@
// ASan stats also reflect memory usage of internal ASan RTL structs,
// so we can't check for equality here.
EXPECT_LT(after_test, before_test + (1UL<<20));
- __asan_enable_statistics(old_stats_value);
}
TEST(AddressSanitizerInterface, ExitCode) {
Modified: compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc?rev=145838&r1=145837&r2=145838&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc Mon Dec 5 13:17:53 2011
@@ -290,7 +290,6 @@
// destroyed.
TEST(AddressSanitizer, ThreadedQuarantineTest) {
const int n_threads = 3000;
- bool old_flag_stats = __asan_enable_statistics(true);
size_t mmaped1 = __asan_get_heap_size();
for (int i = 0; i < n_threads; i++) {
pthread_t t;
@@ -299,7 +298,6 @@
size_t mmaped2 = __asan_get_heap_size();
EXPECT_LT(mmaped2 - mmaped1, 320U * (1 << 20));
}
- __asan_enable_statistics(old_flag_stats);
}
void *ThreadedOneSizeMallocStress(void *unused) {
From kcc at google.com Mon Dec 5 13:20:57 2011
From: kcc at google.com (Kostya Serebryany)
Date: Mon, 05 Dec 2011 19:20:57 -0000
Subject: [llvm-commits] [compiler-rt] r145839 -
/compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
Message-ID: <20111205192057.DD7562A6C12C@llvm.org>
Author: kcc
Date: Mon Dec 5 13:20:57 2011
New Revision: 145839
URL: http://llvm.org/viewvc/llvm-project?rev=145839&view=rev
Log:
[asan] add the test for bug 11468
Added:
compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
Added: compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc?rev=145839&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc (added)
+++ compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc Mon Dec 5 13:20:57 2011
@@ -0,0 +1,27 @@
+// See http://llvm.org/bugs/show_bug.cgi?id=11468
+#include
+#include
+
+class Action {
+ public:
+ Action() {}
+ void PrintString(const std::string& msg) const {
+ fprintf(stderr, "%s\n", msg.c_str());
+ }
+ void Throw(const char& arg) const {
+ PrintString("PrintString called!"); // this line is important
+ throw arg;
+ }
+};
+
+int main() {
+ const Action a;
+ fprintf(stderr, "&a before = %p\n", &a);
+ try {
+ a.Throw('c');
+ } catch (const char&) {
+ fprintf(stderr, "&a in catch = %p\n", &a);
+ }
+ fprintf(stderr, "&a final = %p\n", &a);
+ return 0;
+}
From grosbach at apple.com Mon Dec 5 13:55:46 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 19:55:46 -0000
Subject: [llvm-commits] [llvm] r145842 - in /llvm/trunk/lib/Target/ARM:
ARMInstrFormats.td ARMInstrNEON.td
Message-ID: <20111205195546.DFAE62A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 13:55:46 2011
New Revision: 145842
URL: http://llvm.org/viewvc/llvm-project?rev=145842&view=rev
Log:
ARM assmebler parsing for two-operand VMUL instructions.
Combined destination and first source operand for f32 variant of the VMUL
(by scalar) instruction.
rdar://10522016
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=145842&r1=145841&r2=145842&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Dec 5 13:55:46 2011
@@ -231,6 +231,8 @@
: InstAlias, Requires<[HasVFP2]>;
class VFP3InstAlias
: InstAlias, Requires<[HasVFP3]>;
+class NEONInstAlias
+ : InstAlias, Requires<[HasNEON]>;
//===----------------------------------------------------------------------===//
// ARM Instruction templates.
Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145842&r1=145841&r2=145842&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 13:55:46 2011
@@ -3672,6 +3672,15 @@
def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
v2f32, fmul>;
+// Two-operand aliases.
+def : NEONInstAlias<"vmul${p}.f32 $Ddn $Dm$lane",
+ (VMULslfd DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.f32 $Qdn $Dm$lane",
+ (VMULslfq QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+
+
def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
(v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
(v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
From mcrosier at apple.com Mon Dec 5 14:06:57 2011
From: mcrosier at apple.com (Chad Rosier)
Date: Mon, 05 Dec 2011 12:06:57 -0800
Subject: [llvm-commits] [llvm] r145842 - in /llvm/trunk/lib/Target/ARM:
ARMInstrFormats.td ARMInstrNEON.td
In-Reply-To: <20111205195546.DFAE62A6C12C@llvm.org>
References: <20111205195546.DFAE62A6C12C@llvm.org>
Message-ID: <17B2F12B-75C4-4F4B-A1F3-6861DEEAE6A3@apple.com>
Test case?
Chad
On Dec 5, 2011, at 11:55 AM, Jim Grosbach wrote:
> Author: grosbach
> Date: Mon Dec 5 13:55:46 2011
> New Revision: 145842
>
> URL: http://llvm.org/viewvc/llvm-project?rev=145842&view=rev
> Log:
> ARM assmebler parsing for two-operand VMUL instructions.
>
> Combined destination and first source operand for f32 variant of the VMUL
> (by scalar) instruction.
>
> rdar://10522016
>
> Modified:
> llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
> llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
>
> Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=145842&r1=145841&r2=145842&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
> +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Dec 5 13:55:46 2011
> @@ -231,6 +231,8 @@
> : InstAlias, Requires<[HasVFP2]>;
> class VFP3InstAlias
> : InstAlias, Requires<[HasVFP3]>;
> +class NEONInstAlias
> + : InstAlias, Requires<[HasNEON]>;
>
> //===----------------------------------------------------------------------===//
> // ARM Instruction templates.
>
> Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145842&r1=145841&r2=145842&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
> +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 13:55:46 2011
> @@ -3672,6 +3672,15 @@
> def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
> v2f32, fmul>;
>
> +// Two-operand aliases.
> +def : NEONInstAlias<"vmul${p}.f32 $Ddn $Dm$lane",
> + (VMULslfd DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
> + VectorIndex32:$lane, pred:$p)>;
> +def : NEONInstAlias<"vmul${p}.f32 $Qdn $Dm$lane",
> + (VMULslfq QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
> + VectorIndex32:$lane, pred:$p)>;
> +
> +
> def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
> (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
> (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From ganna at apple.com Mon Dec 5 14:08:59 2011
From: ganna at apple.com (Anna Zaks)
Date: Mon, 05 Dec 2011 12:08:59 -0800
Subject: [llvm-commits] Refactoring of the dominator tree implementation
for Clang
In-Reply-To: <4B9E5CDC-1444-40F3-8D79-AB84BA475EE4@2pi.dk>
References:
<5075B012-08E8-49D9-B6AD-419A774FB06E@2pi.dk>
<4B9E5CDC-1444-40F3-8D79-AB84BA475EE4@2pi.dk>
Message-ID:
Guoping,
LLVM part of the patch is committed in r145837.
Anna.
On Nov 30, 2011, at 8:40 PM, Jakob Stoklund Olesen wrote:
>
> On Nov 30, 2011, at 7:56 PM, Guoping Long wrote:
>
>> Hi, Jakob
>>
>> Thanks for your comments. Attached is the revised patch.
>
> Looks good to me.
>
> I'll leave the clang stuff to Anna.
>
> /jakob
>
From grosbach at apple.com Mon Dec 5 14:09:45 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 20:09:45 -0000
Subject: [llvm-commits] [llvm] r145843 -
/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
Message-ID: <20111205200945.2E4062A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 14:09:44 2011
New Revision: 145843
URL: http://llvm.org/viewvc/llvm-project?rev=145843&view=rev
Log:
Tidy up. No functional change.
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145843&r1=145842&r2=145843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 14:09:44 2011
@@ -2898,14 +2898,11 @@
v4i32, v4i32, OpNode, Commutable>;
}
-multiclass N3VSL_HS op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
- def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
- v4i16, ShOp>;
- def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, !strconcat(Dt,"32"),
- v2i32, ShOp>;
- def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, !strconcat(Dt, "16"),
- v8i16, v4i16, ShOp>;
- def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, !strconcat(Dt,"32"),
+multiclass N3VSL_HS op11_8, string OpcodeStr, SDNode ShOp> {
+ def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, "16", v4i16, ShOp>;
+ def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, "32", v2i32, ShOp>;
+ def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, "i16", v8i16, v4i16, ShOp>;
+ def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, "32",
v4i32, v2i32, ShOp>;
}
@@ -3667,7 +3664,7 @@
v2f32, v2f32, fmul, 1>;
def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VFMULQ, "vmul", "f32",
v4f32, v4f32, fmul, 1>;
-defm VMULsl : N3VSL_HS<0b1000, "vmul", "i", mul>;
+defm VMULsl : N3VSL_HS<0b1000, "vmul", mul>;
def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
v2f32, fmul>;
From grosbach at apple.com Mon Dec 5 14:12:26 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 20:12:26 -0000
Subject: [llvm-commits] [llvm] r145844 -
/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
Message-ID: <20111205201226.D44E72A6C12D@llvm.org>
Author: grosbach
Date: Mon Dec 5 14:12:26 2011
New Revision: 145844
URL: http://llvm.org/viewvc/llvm-project?rev=145844&view=rev
Log:
Fix previous commit. Oops.
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145844&r1=145843&r2=145844&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 14:12:26 2011
@@ -2899,10 +2899,10 @@
}
multiclass N3VSL_HS op11_8, string OpcodeStr, SDNode ShOp> {
- def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, "16", v4i16, ShOp>;
- def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, "32", v2i32, ShOp>;
+ def v4i16 : N3VDSL16<0b01, op11_8, OpcodeStr, "i16", v4i16, ShOp>;
+ def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, OpcodeStr, "i32", v2i32, ShOp>;
def v8i16 : N3VQSL16<0b01, op11_8, OpcodeStr, "i16", v8i16, v4i16, ShOp>;
- def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, "32",
+ def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, OpcodeStr, "i32",
v4i32, v2i32, ShOp>;
}
From grosbach at apple.com Mon Dec 5 14:29:59 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 20:29:59 -0000
Subject: [llvm-commits] [llvm] r145846 - in /llvm/trunk:
lib/Target/ARM/ARMInstrFormats.td lib/Target/ARM/ARMInstrNEON.td
test/MC/ARM/neon-mul-encoding.s
Message-ID: <20111205202959.E976F2A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 14:29:59 2011
New Revision: 145846
URL: http://llvm.org/viewvc/llvm-project?rev=145846&view=rev
Log:
ARM assembly parsing for the rest of the VMUL data type aliases.
Finish up rdar://10522016.
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
llvm/trunk/test/MC/ARM/neon-mul-encoding.s
Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=145846&r1=145845&r2=145846&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Dec 5 14:29:59 2011
@@ -1996,7 +1996,7 @@
// VFP/NEON Instruction aliases for type suffices.
class VFPDataTypeInstAlias :
- InstAlias;
+ InstAlias, Requires<[HasVFP2]>;
multiclass VFPDT8ReqInstAlias {
def I8 : VFPDataTypeInstAlias;
def S8 : VFPDataTypeInstAlias;
Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145846&r1=145845&r2=145846&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 14:29:59 2011
@@ -3669,15 +3669,6 @@
def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
v2f32, fmul>;
-// Two-operand aliases.
-def : NEONInstAlias<"vmul${p}.f32 $Ddn $Dm$lane",
- (VMULslfd DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
- VectorIndex32:$lane, pred:$p)>;
-def : NEONInstAlias<"vmul${p}.f32 $Qdn $Dm$lane",
- (VMULslfq QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
- VectorIndex32:$lane, pred:$p)>;
-
-
def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
(v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
(v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
@@ -5620,6 +5611,79 @@
defm VEXTq : VFPDT64ReqInstAlias<"vext${p}", "$Vd, $Vn, $Vm, $index",
(VEXTq64 QPR:$Vd, QPR:$Vn, QPR:$Vm, imm0_1:$index, pred:$p)>;
+// VMUL instructions data type suffix aliases for more-specific types.
+def : NEONInstAlias<"vmul${p}.s16 $Dd, $Dn $Dm$lane",
+ (VMULslv4i16 DPR:$Dd, DPR:$Dn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.s16 $Qd, $Qn, $Dm$lane",
+ (VMULslv8i16 QPR:$Qd, QPR:$Qn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u16 $Dd, $Dn $Dm$lane",
+ (VMULslv4i16 DPR:$Dd, DPR:$Dn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u16 $Qd, $Qn, $Dm$lane",
+ (VMULslv8i16 QPR:$Qd, QPR:$Qn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+
+def : NEONInstAlias<"vmul${p}.s32 $Dd, $Dn $Dm$lane",
+ (VMULslv2i32 DPR:$Dd, DPR:$Dn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.s32 $Qd, $Qn, $Dm$lane",
+ (VMULslv4i32 QPR:$Qd, QPR:$Qn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u32 $Dd, $Dn $Dm$lane",
+ (VMULslv2i32 DPR:$Dd, DPR:$Dn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u32 $Qd, $Qn, $Dm$lane",
+ (VMULslv4i32 QPR:$Qd, QPR:$Qn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+
+// VMUL two-operand aliases.
+def : NEONInstAlias<"vmul${p}.i16 $Ddn, $Dm$lane",
+ (VMULslv4i16 DPR:$Ddn, DPR:$Ddn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.i16 $Qdn, $Dm$lane",
+ (VMULslv8i16 QPR:$Qdn, QPR:$Qdn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.s16 $Ddn, $Dm$lane",
+ (VMULslv4i16 DPR:$Ddn, DPR:$Ddn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.s16 $Qdn, $Dm$lane",
+ (VMULslv8i16 QPR:$Qdn, QPR:$Qdn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u16 $Ddn, $Dm$lane",
+ (VMULslv4i16 DPR:$Ddn, DPR:$Ddn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u16 $Qdn, $Dm$lane",
+ (VMULslv8i16 QPR:$Qdn, QPR:$Qdn, DPR_8:$Dm,
+ VectorIndex16:$lane, pred:$p)>;
+
+def : NEONInstAlias<"vmul${p}.i32 $Ddn, $Dm$lane",
+ (VMULslv2i32 DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.i32 $Qdn, $Dm$lane",
+ (VMULslv4i32 QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.s32 $Ddn, $Dm$lane",
+ (VMULslv2i32 DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.s32 $Qdn, $Dm$lane",
+ (VMULslv4i32 QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u32 $Ddn, $Dm$lane",
+ (VMULslv2i32 DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.u32 $Qdn, $Dm$lane",
+ (VMULslv4i32 QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+
+def : NEONInstAlias<"vmul${p}.f32 $Ddn, $Dm$lane",
+ (VMULslfd DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+def : NEONInstAlias<"vmul${p}.f32 $Qdn, $Dm$lane",
+ (VMULslfq QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
+ VectorIndex32:$lane, pred:$p)>;
+
// VLD1 single-lane pseudo-instructions. These need special handling for
// the lane index that an InstAlias can't handle, so we use these instead.
defm VLD1LNdAsm : NEONDT8AsmPseudoInst<"vld1${p}", "$list, $addr",
Modified: llvm/trunk/test/MC/ARM/neon-mul-encoding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/neon-mul-encoding.s?rev=145846&r1=145845&r2=145846&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/neon-mul-encoding.s (original)
+++ llvm/trunk/test/MC/ARM/neon-mul-encoding.s Mon Dec 5 14:29:59 2011
@@ -72,3 +72,68 @@
@ CHECK: vqdmull.s16 q8, d16, d17 @ encoding: [0xa1,0x0d,0xd0,0xf2]
@ CHECK: vqdmull.s32 q8, d16, d17 @ encoding: [0xa1,0x0d,0xe0,0xf2]
+
+
+ vmul.i16 d0, d4[2]
+ vmul.s16 d1, d7[3]
+ vmul.u16 d2, d1[1]
+ vmul.i32 d3, d2[0]
+ vmul.s32 d4, d3[1]
+ vmul.u32 d5, d4[0]
+ vmul.f32 d6, d5[1]
+
+ vmul.i16 q0, d4[2]
+ vmul.s16 q1, d7[3]
+ vmul.u16 q2, d1[1]
+ vmul.i32 q3, d2[0]
+ vmul.s32 q4, d3[1]
+ vmul.u32 q5, d4[0]
+ vmul.f32 q6, d5[1]
+
+ vmul.i16 d9, d0, d4[2]
+ vmul.s16 d8, d1, d7[3]
+ vmul.u16 d7, d2, d1[1]
+ vmul.i32 d6, d3, d2[0]
+ vmul.s32 d5, d4, d3[1]
+ vmul.u32 d4, d5, d4[0]
+ vmul.f32 d3, d6, d5[1]
+
+ vmul.i16 q9, q0, d4[2]
+ vmul.s16 q8, q1, d7[3]
+ vmul.u16 q7, q2, d1[1]
+ vmul.i32 q6, q3, d2[0]
+ vmul.s32 q5, q4, d3[1]
+ vmul.u32 q4, q5, d4[0]
+ vmul.f32 q3, q6, d5[1]
+
+@ CHECK: vmul.i16 d0, d0, d4[2] @ encoding: [0x64,0x08,0x90,0xf2]
+@ CHECK: vmul.i16 d1, d1, d7[3] @ encoding: [0x6f,0x18,0x91,0xf2]
+@ CHECK: vmul.i16 d2, d2, d1[1] @ encoding: [0x49,0x28,0x92,0xf2]
+@ CHECK: vmul.i32 d3, d3, d2[0] @ encoding: [0x42,0x38,0xa3,0xf2]
+@ CHECK: vmul.i32 d4, d4, d3[1] @ encoding: [0x63,0x48,0xa4,0xf2]
+@ CHECK: vmul.i32 d5, d5, d4[0] @ encoding: [0x44,0x58,0xa5,0xf2]
+@ CHECK: vmul.f32 d6, d6, d5[1] @ encoding: [0x65,0x69,0xa6,0xf2]
+
+@ CHECK: vmul.i16 q0, q0, d4[2] @ encoding: [0x64,0x08,0x90,0xf3]
+@ CHECK: vmul.i16 q1, q1, d7[3] @ encoding: [0x6f,0x28,0x92,0xf3]
+@ CHECK: vmul.i16 q2, q2, d1[1] @ encoding: [0x49,0x48,0x94,0xf3]
+@ CHECK: vmul.i32 q3, q3, d2[0] @ encoding: [0x42,0x68,0xa6,0xf3]
+@ CHECK: vmul.i32 q4, q4, d3[1] @ encoding: [0x63,0x88,0xa8,0xf3]
+@ CHECK: vmul.i32 q5, q5, d4[0] @ encoding: [0x44,0xa8,0xaa,0xf3]
+@ CHECK: vmul.f32 q6, q6, d5[1] @ encoding: [0x65,0xc9,0xac,0xf3]
+
+@ CHECK: vmul.i16 d9, d0, d4[2] @ encoding: [0x64,0x98,0x90,0xf2]
+@ CHECK: vmul.i16 d8, d1, d7[3] @ encoding: [0x6f,0x88,0x91,0xf2]
+@ CHECK: vmul.i16 d7, d2, d1[1] @ encoding: [0x49,0x78,0x92,0xf2]
+@ CHECK: vmul.i32 d6, d3, d2[0] @ encoding: [0x42,0x68,0xa3,0xf2]
+@ CHECK: vmul.i32 d5, d4, d3[1] @ encoding: [0x63,0x58,0xa4,0xf2]
+@ CHECK: vmul.i32 d4, d5, d4[0] @ encoding: [0x44,0x48,0xa5,0xf2]
+@ CHECK: vmul.f32 d3, d6, d5[1] @ encoding: [0x65,0x39,0xa6,0xf2]
+
+@ CHECK: vmul.i16 q9, q0, d4[2] @ encoding: [0x64,0x28,0xd0,0xf3]
+@ CHECK: vmul.i16 q8, q1, d7[3] @ encoding: [0x6f,0x08,0xd2,0xf3]
+@ CHECK: vmul.i16 q7, q2, d1[1] @ encoding: [0x49,0xe8,0x94,0xf3]
+@ CHECK: vmul.i32 q6, q3, d2[0] @ encoding: [0x42,0xc8,0xa6,0xf3]
+@ CHECK: vmul.i32 q5, q4, d3[1] @ encoding: [0x63,0xa8,0xa8,0xf3]
+@ CHECK: vmul.i32 q4, q5, d4[0] @ encoding: [0x44,0x88,0xaa,0xf3]
+@ CHECK: vmul.f32 q3, q6, d5[1] @ encoding: [0x65,0x69,0xac,0xf3]
From grosbach at apple.com Mon Dec 5 14:33:33 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 12:33:33 -0800
Subject: [llvm-commits] [llvm] r145842 - in /llvm/trunk/lib/Target/ARM:
ARMInstrFormats.td ARMInstrNEON.td
In-Reply-To: <8E1D7282-652A-4DEF-90DF-2E01BF1CDF45@apple.com>
References: <20111205195546.DFAE62A6C12C@llvm.org>
<17B2F12B-75C4-4F4B-A1F3-6861DEEAE6A3@apple.com>
<8E1D7282-652A-4DEF-90DF-2E01BF1CDF45@apple.com>
Message-ID:
Tests for these along w/ the rest of the aliases in r145846.
Thanks for checking!
-jim
On Dec 5, 2011, at 12:12 PM, Chad Rosier wrote:
> 10-4.
>
> On Dec 5, 2011, at 12:10 PM, Jim Grosbach wrote:
>
>> Forthcoming, along with a few other variants of this same instruction class.
>>
>> On Dec 5, 2011, at 12:06 PM, Chad Rosier wrote:
>>
>>> Test case?
>>>
>>> Chad
>>>
>>> On Dec 5, 2011, at 11:55 AM, Jim Grosbach wrote:
>>>
>>>> Author: grosbach
>>>> Date: Mon Dec 5 13:55:46 2011
>>>> New Revision: 145842
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=145842&view=rev
>>>> Log:
>>>> ARM assmebler parsing for two-operand VMUL instructions.
>>>>
>>>> Combined destination and first source operand for f32 variant of the VMUL
>>>> (by scalar) instruction.
>>>>
>>>> rdar://10522016
>>>>
>>>> Modified:
>>>> llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
>>>> llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
>>>>
>>>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=145842&r1=145841&r2=145842&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
>>>> +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Dec 5 13:55:46 2011
>>>> @@ -231,6 +231,8 @@
>>>> : InstAlias, Requires<[HasVFP2]>;
>>>> class VFP3InstAlias
>>>> : InstAlias, Requires<[HasVFP3]>;
>>>> +class NEONInstAlias
>>>> + : InstAlias, Requires<[HasNEON]>;
>>>>
>>>> //===----------------------------------------------------------------------===//
>>>> // ARM Instruction templates.
>>>>
>>>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145842&r1=145841&r2=145842&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
>>>> +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 13:55:46 2011
>>>> @@ -3672,6 +3672,15 @@
>>>> def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
>>>> v2f32, fmul>;
>>>>
>>>> +// Two-operand aliases.
>>>> +def : NEONInstAlias<"vmul${p}.f32 $Ddn $Dm$lane",
>>>> + (VMULslfd DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
>>>> + VectorIndex32:$lane, pred:$p)>;
>>>> +def : NEONInstAlias<"vmul${p}.f32 $Qdn $Dm$lane",
>>>> + (VMULslfq QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
>>>> + VectorIndex32:$lane, pred:$p)>;
>>>> +
>>>> +
>>>> def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
>>>> (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
>>>> (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>
From benny.kra at googlemail.com Mon Dec 5 14:33:47 2011
From: benny.kra at googlemail.com (Benjamin Kramer)
Date: Mon, 05 Dec 2011 20:33:47 -0000
Subject: [llvm-commits] [www-pubs] r145847 -
/www-pubs/trunk/2009-01-PEPM-Parfait.html
Message-ID: <20111205203347.577C22A6C12C@llvm.org>
Author: d0k
Date: Mon Dec 5 14:33:47 2011
New Revision: 145847
URL: http://llvm.org/viewvc/llvm-project?rev=145847&view=rev
Log:
Fix bad markup.
Modified:
www-pubs/trunk/2009-01-PEPM-Parfait.html
Modified: www-pubs/trunk/2009-01-PEPM-Parfait.html
URL: http://llvm.org/viewvc/llvm-project/www-pubs/trunk/2009-01-PEPM-Parfait.html?rev=145847&r1=145846&r2=145847&view=diff
==============================================================================
--- www-pubs/trunk/2009-01-PEPM-Parfait.html (original)
+++ www-pubs/trunk/2009-01-PEPM-Parfait.html Mon Dec 5 14:33:47 2011
@@ -3,7 +3,7 @@
- Program analysis for bug detection using Parfait
+ Program analysis for bug detection using Parfait
From kcc at google.com Mon Dec 5 14:44:30 2011
From: kcc at google.com (Kostya Serebryany)
Date: Mon, 05 Dec 2011 20:44:30 -0000
Subject: [llvm-commits] [compiler-rt] r145848 - in
/compiler-rt/trunk/lib/asan: Makefile.old tests/asan_exceptions_test.cc
tests/test_output.sh
Message-ID: <20111205204430.564FD2A6C12C@llvm.org>
Author: kcc
Date: Mon Dec 5 14:44:30 2011
New Revision: 145848
URL: http://llvm.org/viewvc/llvm-project?rev=145848&view=rev
Log:
[asan]: test a pure C file with -faddress-sanitizer; lint fixes
Modified:
compiler-rt/trunk/lib/asan/Makefile.old
compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
compiler-rt/trunk/lib/asan/tests/test_output.sh
Modified: compiler-rt/trunk/lib/asan/Makefile.old
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/Makefile.old?rev=145848&r1=145847&r2=145848&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/Makefile.old (original)
+++ compiler-rt/trunk/lib/asan/Makefile.old Mon Dec 5 14:44:30 2011
@@ -210,7 +210,7 @@
test: t64 t32 output_tests lint
output_tests: b32 b64
- cd tests && ./test_output.sh $(CLANG_CXX)
+ cd tests && ./test_output.sh $(CLANG_CXX) $(CLANG_CC)
t64: b64
$(BIN)/asan_test64
Modified: compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc?rev=145848&r1=145847&r2=145848&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc Mon Dec 5 14:44:30 2011
@@ -9,7 +9,7 @@
fprintf(stderr, "%s\n", msg.c_str());
}
void Throw(const char& arg) const {
- PrintString("PrintString called!"); // this line is important
+ PrintString("PrintString called!"); // this line is important
throw arg;
}
};
@@ -19,7 +19,7 @@
fprintf(stderr, "&a before = %p\n", &a);
try {
a.Throw('c');
- } catch (const char&) {
+ } catch(const char&) {
fprintf(stderr, "&a in catch = %p\n", &a);
}
fprintf(stderr, "&a final = %p\n", &a);
Modified: compiler-rt/trunk/lib/asan/tests/test_output.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/test_output.sh?rev=145848&r1=145847&r2=145848&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/test_output.sh (original)
+++ compiler-rt/trunk/lib/asan/tests/test_output.sh Mon Dec 5 14:44:30 2011
@@ -2,9 +2,16 @@
OS=`uname`
CXX=$1
+CC=$2
CXXFLAGS="-mno-omit-leaf-frame-pointer"
SYMBOLIZER=../scripts/asan_symbolize.py
+C_TEST=use-after-free
+$CC -g -faddress-sanitizer -O2 $C_TEST.c || exit 1
+echo "Sanity checking a test in pure C"
+./a.out 2>&1 | grep "heap-use-after-free" > /dev/null || exit 1
+rm ./a.out
+
for t in *.tmpl; do
for b in 32 64; do
for O in 0 1 2 3; do
@@ -29,4 +36,5 @@
done
done
done
+
exit 0
From hfinkel at anl.gov Mon Dec 5 14:56:41 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 14:56:41 -0600
Subject: [llvm-commits] Dead register (was Re: [llvm] r145819)
In-Reply-To: <1323112465.2507.3170.camel@sapling>
References: <20111205175518.343FF2A6C12C@llvm.org>
<1323112465.2507.3170.camel@sapling>
Message-ID: <1323118601.2507.3183.camel@sapling>
RegScavenger is complaining about use of an undefined register, CTR8, in
the BCTR8 instruction, in the following instance (this is from the PPC
backend):
BB#38: derived from LLVM BB %for.end50
Predecessors according to CFG: BB#36
%X3 = LD 0, ; mem:LD8[FixedStack27]
%X4 = RLDICR %X3, 3, 60
%X5 = LI8 [TF=4]
%X5 = ADDIS8 %X5, [TF=8]
%X4 = LDX %X4, %X5; mem:LD8[JumpTable]
MTCTR8 %X4, %CTR8
BCTR8 %CTR8, %RM
Successors according to CFG: BB#23 BB#15 BB#7 BB#8 BB#9 BB#10 BB#11
BB#25 BB#12 BB#16 BB#18 BB#13 BB#17
How could CRT8 be marked implicitly-defined and also dead in the same
instruction when it is clearly used in the next instruction? The code
that inserts these instructions is in SDNode
*PPCDAGToDAGISel::Select(SDNode *N) and reads:
case ISD::BRIND: {
// FIXME: Should custom lower this.
SDValue Chain = N->getOperand(0);
SDValue Target = N->getOperand(1);
unsigned Opc = Target.getValueType() == MVT::i32 ? PPC::MTCTR :
PPC::MTCTR8;
unsigned Reg = Target.getValueType() == MVT::i32 ? PPC::BCTR :
PPC::BCTR8;
Chain = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Target,
Chain), 0);
return CurDAG->SelectNodeTo(N, Reg, MVT::Other, Chain);
}
Thanks in advance,
Hal
On Mon, 2011-12-05 at 13:14 -0600, Hal Finkel wrote:
> On Mon, 2011-12-05 at 10:12 -0800, Jakob Stoklund Olesen wrote:
> > On Dec 5, 2011, at 9:55 AM, Hal Finkel wrote:
> >
> > > Author: hfinkel
> > > Date: Mon Dec 5 11:55:17 2011
> > > New Revision: 145819
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=145819&view=rev
> > > Log:
> > > enable PPC register scavenging by default (update tests and remove some FIXMEs)
> >
> > Nice!
> >
> > Did you run extensive tests with this change?
>
> Not extensive; I ran the regression tests and a few other files I've
> been using recently. I'll be setup soon to run the test suite on ppc64,
> and so I'll test more-extensively using the test suite. Unfortunately,
> there are still other problems that I have to fix first (like PR11476,
> which may be related to register scavenging, but was not fixed by these
> changes).
>
> > Does it work with -O0?
>
> Good point, I'll run some more tests (and the test suite) with -O0. Some
> of the regression tests specify -O0 (like the varargs test, which seemed
> to be fine).
>
> Thanks again,
> Hal
>
> >
> > The register scavenger is notorious for exposing sloppy liveness info in older targets like PPC. I would expect a number of scavenger assertions.
> >
> > /jakob
> >
>
--
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
From ahatanaka at mips.com Mon Dec 5 15:03:04 2011
From: ahatanaka at mips.com (Akira Hatanaka)
Date: Mon, 05 Dec 2011 21:03:04 -0000
Subject: [llvm-commits] [llvm] r145850 - in /llvm/trunk:
lib/Target/Mips/MipsISelLowering.cpp test/CodeGen/Mips/2010-07-20-Switch.ll
Message-ID: <20111205210304.2E4982A6C12C@llvm.org>
Author: ahatanak
Date: Mon Dec 5 15:03:03 2011
New Revision: 145850
URL: http://llvm.org/viewvc/llvm-project?rev=145850&view=rev
Log:
Have LowerJumpTable support Mips64. Modify 2010-07-20-Switch.ll to test N64 and
O32 with relocation-model=pic too.
Modified:
llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
llvm/trunk/test/CodeGen/Mips/2010-07-20-Switch.ll
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=145850&r1=145849&r2=145850&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Dec 5 15:03:03 2011
@@ -130,6 +130,7 @@
setOperationAction(ISD::BlockAddress, MVT::i64, Custom);
setOperationAction(ISD::GlobalTLSAddress, MVT::i32, Custom);
setOperationAction(ISD::JumpTable, MVT::i32, Custom);
+ setOperationAction(ISD::JumpTable, MVT::i64, Custom);
setOperationAction(ISD::ConstantPool, MVT::i32, Custom);
setOperationAction(ISD::ConstantPool, MVT::i64, Custom);
setOperationAction(ISD::SELECT, MVT::f32, Custom);
@@ -1594,34 +1595,29 @@
SDValue MipsTargetLowering::
LowerJumpTable(SDValue Op, SelectionDAG &DAG) const
{
- SDValue ResNode;
- SDValue HiPart;
+ SDValue HiPart, JTI, JTILo;
// FIXME there isn't actually debug info here
DebugLoc dl = Op.getDebugLoc();
bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_;
- unsigned char OpFlag = IsPIC ? MipsII::MO_GOT : MipsII::MO_ABS_HI;
-
EVT PtrVT = Op.getValueType();
- JumpTableSDNode *JT = cast(Op);
+ JumpTableSDNode *JT = cast(Op);
- SDValue JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, OpFlag);
-
- if (!IsPIC) {
- SDValue Ops[] = { JTI };
- HiPart = DAG.getNode(MipsISD::Hi, dl, DAG.getVTList(MVT::i32), Ops, 1);
+ if (!IsPIC && !IsN64) {
+ JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, MipsII::MO_ABS_HI);
+ HiPart = DAG.getNode(MipsISD::Hi, dl, PtrVT, JTI);
+ JTILo = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, MipsII::MO_ABS_LO);
} else {// Emit Load from Global Pointer
- JTI = DAG.getNode(MipsISD::WrapperPIC, dl, MVT::i32, JTI);
- HiPart = DAG.getLoad(MVT::i32, dl, DAG.getEntryNode(), JTI,
- MachinePointerInfo(),
- false, false, false, 0);
+ unsigned GOTFlag = IsN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
+ unsigned OfstFlag = IsN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
+ JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, GOTFlag);
+ JTI = DAG.getNode(MipsISD::WrapperPIC, dl, PtrVT, JTI);
+ HiPart = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), JTI,
+ MachinePointerInfo(), false, false, false, 0);
+ JTILo = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, OfstFlag);
}
- SDValue JTILo = DAG.getTargetJumpTable(JT->getIndex(), PtrVT,
- MipsII::MO_ABS_LO);
- SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, JTILo);
- ResNode = DAG.getNode(ISD::ADD, dl, MVT::i32, HiPart, Lo);
-
- return ResNode;
+ SDValue Lo = DAG.getNode(MipsISD::Lo, dl, PtrVT, JTILo);
+ return DAG.getNode(ISD::ADD, dl, PtrVT, HiPart, Lo);
}
SDValue MipsTargetLowering::
Modified: llvm/trunk/test/CodeGen/Mips/2010-07-20-Switch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2010-07-20-Switch.ll?rev=145850&r1=145849&r2=145850&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/2010-07-20-Switch.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/2010-07-20-Switch.ll Mon Dec 5 15:03:03 2011
@@ -1,13 +1,21 @@
-; RUN: llc < %s -march=mips -relocation-model=static | FileCheck %s
+; RUN: llc < %s -march=mips -relocation-model=static | FileCheck %s -check-prefix=STATIC-O32
+; RUN: llc < %s -march=mips -relocation-model=pic | FileCheck %s -check-prefix=PIC-O32
+; RUN: llc < %s -march=mips64 -relocation-model=pic -mcpu=mips64 -mattr=n64 | FileCheck %s -check-prefix=PIC-N64
define i32 @main() nounwind readnone {
entry:
%x = alloca i32, align 4 ; [#uses=2]
store volatile i32 2, i32* %x, align 4
%0 = load volatile i32* %x, align 4 ; [#uses=1]
-; CHECK: lui $3, %hi($JTI0_0)
-; CHECK: addiu $3, $3, %lo($JTI0_0)
-; CHECK: sll $2, $2, 2
+; STATIC-O32: lui $[[R0:[0-9]+]], %hi($JTI0_0)
+; STATIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0)
+; STATIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2
+; PIC-O32: lw $[[R0:[0-9]+]], %got($JTI0_0)
+; PIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0)
+; PIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2
+; PIC-N64: ld $[[R0:[0-9]+]], %got_page($JTI0_0)
+; PIC-N64: daddiu ${{[0-9]+}}, $[[R0]], %got_ofst($JTI0_0)
+; PIC-N64: dsll ${{[0-9]+}}, ${{[0-9]+}}, 2
switch i32 %0, label %bb4 [
i32 0, label %bb5
i32 1, label %bb1
@@ -18,7 +26,7 @@
bb1: ; preds = %entry
ret i32 2
-; CHECK: $BB0_2
+; CHECK: STATIC-O32: $BB0_2
bb2: ; preds = %entry
ret i32 0
From deeppatel1987 at gmail.com Mon Dec 5 15:06:21 2011
From: deeppatel1987 at gmail.com (Sandeep Patel)
Date: Mon, 5 Dec 2011 21:06:21 +0000
Subject: [llvm-commits] PATCH: Initial patches for changing the
semantics of llvm.cttz and llvm.ctlz
In-Reply-To: <313D9FE2-D633-4744-92EE-9383B6691E62@mac.com>
References:
<2DBA1282-CC2C-430B-9A62-5694D5ABAD4B@apple.com>
<313D9FE2-D633-4744-92EE-9383B6691E62@mac.com>
Message-ID:
On Sat, Dec 3, 2011 at 6:24 AM, Owen Anderson wrote:
>
> On Dec 1, 2011, at 3:06 PM, Chris Lattner wrote:
>
>>
>> On Dec 1, 2011, at 11:20 AM, Dan Gohman wrote:
>>
>>> On Dec 1, 2011, at 2:47 AM, Chandler Carruth wrote:
>>>>
>>>> 7) remove all support (other than auto-upgrade) for the old intrinsics
>>>
>>> The "old" semantics really are more desirable though, in general. The only
>>> reason I know of for the "new" semantics is to cater to x86's old bsf and
>>> bsr instructions. But x86 admits its own deficiency, and has since introduced
>>> the lzcnt and tzcnt instructions, which behave properly. It seems unfortunate
>>> to require people who want the sane semantics to use a branch (even if
>>> CodeGen is clever and can eliminate it).
>>
>> I would be fine with keeping the existing intrinsics and adding two new ones with gcc-compatible semantics.
>
> What's the point of having two? ?Would any frontend actually generate the non-GCC compatible ones?
It seems likely that intrinsics will be desired to choose a particular
instruction on known hardware or in a CPUID-protected code path.
deep
From grosbach at apple.com Mon Dec 5 15:06:26 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 21:06:26 -0000
Subject: [llvm-commits] [llvm] r145851 - in /llvm/trunk:
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/basic-thumb2-instructions.s
Message-ID: <20111205210626.5A4F42A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 15:06:26 2011
New Revision: 145851
URL: http://llvm.org/viewvc/llvm-project?rev=145851&view=rev
Log:
Thumb2 prefer encoding T3 to T4 for ADD/SUB immediate instructions.
rdar://10529348
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s
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=145851&r1=145850&r2=145851&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Dec 5 15:06:26 2011
@@ -5200,6 +5200,24 @@
Inst = TmpInst;
}
break;
+ case ARM::t2ADDri12:
+ // If the immediate fits for encoding T3 (t2ADDri) and the generic "add"
+ // mnemonic was used (not "addw"), encoding T3 is preferred.
+ if (static_cast(Operands[0])->getToken() != "add" ||
+ ARM_AM::getT2SOImmVal(Inst.getOperand(2).getImm()) == -1)
+ break;
+ Inst.setOpcode(ARM::t2ADDri);
+ Inst.addOperand(MCOperand::CreateReg(0)); // cc_out
+ break;
+ case ARM::t2SUBri12:
+ // If the immediate fits for encoding T3 (t2SUBri) and the generic "sub"
+ // mnemonic was used (not "subw"), encoding T3 is preferred.
+ if (static_cast(Operands[0])->getToken() != "sub" ||
+ ARM_AM::getT2SOImmVal(Inst.getOperand(2).getImm()) == -1)
+ break;
+ Inst.setOpcode(ARM::t2SUBri);
+ Inst.addOperand(MCOperand::CreateReg(0)); // cc_out
+ break;
case ARM::tADDi8:
// If the immediate is in the range 0-7, we want tADDi3 iff Rd was
// explicitly specified. From the ARM ARM: "Encoding T1 is preferred
Modified: llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s?rev=145851&r1=145850&r2=145851&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s Mon Dec 5 15:06:26 2011
@@ -74,6 +74,7 @@
addw r12, r6, #0x100
adds r1, r2, #0x1f0
add r2, #1
+ add r0, r0, #32
@ CHECK: itet eq @ encoding: [0x0a,0xbf]
@ CHECK: addeq r1, r2, #4 @ encoding: [0x11,0x1d]
@@ -87,6 +88,7 @@
@ CHECK: addw r12, r6, #256 @ encoding: [0x06,0xf2,0x00,0x1c]
@ CHECK: adds.w r1, r2, #496 @ encoding: [0x12,0xf5,0xf8,0x71]
@ CHECK: add.w r2, r2, #1 @ encoding: [0x02,0xf1,0x01,0x02]
+@ CHECK: add.w r0, r0, #32 @ encoding: [0x00,0xf1,0x20,0x00]
@------------------------------------------------------------------------------
@@ -2566,6 +2568,7 @@
subw r12, r6, #0x100
subs r1, r2, #0x1f0
sub r2, #1
+ sub r0, r0, #32
@ CHECK: itet eq @ encoding: [0x0a,0xbf]
@ CHECK: subeq r1, r2, #4 @ encoding: [0x11,0x1f]
@@ -2579,6 +2582,7 @@
@ CHECK: subw r12, r6, #256 @ encoding: [0xa6,0xf2,0x00,0x1c]
@ CHECK: subs.w r1, r2, #496 @ encoding: [0xb2,0xf5,0xf8,0x71]
@ CHECK: sub.w r2, r2, #1 @ encoding: [0xa2,0xf1,0x01,0x02]
+@ CHECK: sub.w r0, r0, #32 @ encoding: [0xa0,0xf1,0x20,0x00]
@------------------------------------------------------------------------------
From grosbach at apple.com Mon Dec 5 14:10:30 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 12:10:30 -0800
Subject: [llvm-commits] [llvm] r145842 - in /llvm/trunk/lib/Target/ARM:
ARMInstrFormats.td ARMInstrNEON.td
In-Reply-To: <17B2F12B-75C4-4F4B-A1F3-6861DEEAE6A3@apple.com>
References: <20111205195546.DFAE62A6C12C@llvm.org>
<17B2F12B-75C4-4F4B-A1F3-6861DEEAE6A3@apple.com>
Message-ID:
Forthcoming, along with a few other variants of this same instruction class.
On Dec 5, 2011, at 12:06 PM, Chad Rosier wrote:
> Test case?
>
> Chad
>
> On Dec 5, 2011, at 11:55 AM, Jim Grosbach wrote:
>
>> Author: grosbach
>> Date: Mon Dec 5 13:55:46 2011
>> New Revision: 145842
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=145842&view=rev
>> Log:
>> ARM assmebler parsing for two-operand VMUL instructions.
>>
>> Combined destination and first source operand for f32 variant of the VMUL
>> (by scalar) instruction.
>>
>> rdar://10522016
>>
>> Modified:
>> llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
>> llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
>>
>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=145842&r1=145841&r2=145842&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
>> +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Dec 5 13:55:46 2011
>> @@ -231,6 +231,8 @@
>> : InstAlias, Requires<[HasVFP2]>;
>> class VFP3InstAlias
>> : InstAlias, Requires<[HasVFP3]>;
>> +class NEONInstAlias
>> + : InstAlias, Requires<[HasNEON]>;
>>
>> //===----------------------------------------------------------------------===//
>> // ARM Instruction templates.
>>
>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145842&r1=145841&r2=145842&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
>> +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 13:55:46 2011
>> @@ -3672,6 +3672,15 @@
>> def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
>> v2f32, fmul>;
>>
>> +// Two-operand aliases.
>> +def : NEONInstAlias<"vmul${p}.f32 $Ddn $Dm$lane",
>> + (VMULslfd DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
>> + VectorIndex32:$lane, pred:$p)>;
>> +def : NEONInstAlias<"vmul${p}.f32 $Qdn $Dm$lane",
>> + (VMULslfq QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
>> + VectorIndex32:$lane, pred:$p)>;
>> +
>> +
>> def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
>> (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
>> (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From mcrosier at apple.com Mon Dec 5 14:12:03 2011
From: mcrosier at apple.com (Chad Rosier)
Date: Mon, 05 Dec 2011 12:12:03 -0800
Subject: [llvm-commits] [llvm] r145842 - in /llvm/trunk/lib/Target/ARM:
ARMInstrFormats.td ARMInstrNEON.td
In-Reply-To:
References: <20111205195546.DFAE62A6C12C@llvm.org>
<17B2F12B-75C4-4F4B-A1F3-6861DEEAE6A3@apple.com>
Message-ID: <8E1D7282-652A-4DEF-90DF-2E01BF1CDF45@apple.com>
10-4.
On Dec 5, 2011, at 12:10 PM, Jim Grosbach wrote:
> Forthcoming, along with a few other variants of this same instruction class.
>
> On Dec 5, 2011, at 12:06 PM, Chad Rosier wrote:
>
>> Test case?
>>
>> Chad
>>
>> On Dec 5, 2011, at 11:55 AM, Jim Grosbach wrote:
>>
>>> Author: grosbach
>>> Date: Mon Dec 5 13:55:46 2011
>>> New Revision: 145842
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=145842&view=rev
>>> Log:
>>> ARM assmebler parsing for two-operand VMUL instructions.
>>>
>>> Combined destination and first source operand for f32 variant of the VMUL
>>> (by scalar) instruction.
>>>
>>> rdar://10522016
>>>
>>> Modified:
>>> llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
>>> llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
>>>
>>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=145842&r1=145841&r2=145842&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
>>> +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Dec 5 13:55:46 2011
>>> @@ -231,6 +231,8 @@
>>> : InstAlias, Requires<[HasVFP2]>;
>>> class VFP3InstAlias
>>> : InstAlias, Requires<[HasVFP3]>;
>>> +class NEONInstAlias
>>> + : InstAlias, Requires<[HasNEON]>;
>>>
>>> //===----------------------------------------------------------------------===//
>>> // ARM Instruction templates.
>>>
>>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=145842&r1=145841&r2=145842&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original)
>>> +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Dec 5 13:55:46 2011
>>> @@ -3672,6 +3672,15 @@
>>> def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
>>> v2f32, fmul>;
>>>
>>> +// Two-operand aliases.
>>> +def : NEONInstAlias<"vmul${p}.f32 $Ddn $Dm$lane",
>>> + (VMULslfd DPR:$Ddn, DPR:$Ddn, DPR_VFP2:$Dm,
>>> + VectorIndex32:$lane, pred:$p)>;
>>> +def : NEONInstAlias<"vmul${p}.f32 $Qdn $Dm$lane",
>>> + (VMULslfq QPR:$Qdn, QPR:$Qdn, DPR_VFP2:$Dm,
>>> + VectorIndex32:$lane, pred:$p)>;
>>> +
>>> +
>>> def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
>>> (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
>>> (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
From ahatanaka at mips.com Mon Dec 5 15:14:28 2011
From: ahatanaka at mips.com (Akira Hatanaka)
Date: Mon, 05 Dec 2011 21:14:28 -0000
Subject: [llvm-commits] [llvm] r145852 -
/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
Message-ID: <20111205211429.0BFEE2A6C12C@llvm.org>
Author: ahatanak
Date: Mon Dec 5 15:14:28 2011
New Revision: 145852
URL: http://llvm.org/viewvc/llvm-project?rev=145852&view=rev
Log:
Split ExtIns into two base classes and have instructions EXT and INS derive from
them.
Modified:
llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=145852&r1=145851&r2=145852&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Mon Dec 5 15:14:28 2011
@@ -623,14 +623,29 @@
}
// Ext and Ins
-class ExtIns _funct, string instr_asm, dag outs, dag ins,
- list pattern, InstrItinClass itin>:
- FR<0x1f, _funct, outs, ins, !strconcat(instr_asm, " $rt, $rs, $pos, $sz"),
- pattern, itin>, Requires<[HasMips32r2]> {
+class ExtBase _funct, string instr_asm, RegisterClass RC>:
+ FR<0x1f, _funct, (outs RC:$rt), (ins RC:$rs, uimm16:$pos, size_ext:$sz),
+ !strconcat(instr_asm, " $rt, $rs, $pos, $sz"),
+ [(set RC:$rt, (MipsExt RC:$rs, imm:$pos, imm:$sz))], NoItinerary> {
bits<5> pos;
bits<5> sz;
let rd = sz;
let shamt = pos;
+ let Predicates = [HasMips32r2];
+}
+
+class InsBase _funct, string instr_asm, RegisterClass RC>:
+ FR<0x1f, _funct, (outs RC:$rt),
+ (ins RC:$rs, uimm16:$pos, size_ins:$sz, RC:$src),
+ !strconcat(instr_asm, " $rt, $rs, $pos, $sz"),
+ [(set RC:$rt, (MipsIns RC:$rs, imm:$pos, imm:$sz, RC:$src))],
+ NoItinerary> {
+ bits<5> pos;
+ bits<5> sz;
+ let rd = sz;
+ let shamt = pos;
+ let Predicates = [HasMips32r2];
+ let Constraints = "$src = $rt";
}
// Atomic instructions with 2 source operands (ATOMIC_SWAP & ATOMIC_LOAD_*).
@@ -890,19 +905,8 @@
def RDHWR : ReadHardware;
-def EXT : ExtIns<0, "ext", (outs CPURegs:$rt),
- (ins CPURegs:$rs, uimm16:$pos, size_ext:$sz),
- [(set CPURegs:$rt,
- (MipsExt CPURegs:$rs, immZExt5:$pos, immZExt5:$sz))],
- NoItinerary>;
-
-let Constraints = "$src = $rt" in
-def INS : ExtIns<4, "ins", (outs CPURegs:$rt),
- (ins CPURegs:$rs, uimm16:$pos, size_ins:$sz, CPURegs:$src),
- [(set CPURegs:$rt,
- (MipsIns CPURegs:$rs, immZExt5:$pos, immZExt5:$sz,
- CPURegs:$src))],
- NoItinerary>;
+def EXT : ExtBase<0, "ext", CPURegs>;
+def INS : InsBase<4, "ins", CPURegs>;
//===----------------------------------------------------------------------===//
// Arbitrary patterns that map to one or more instructions
From stoklund at 2pi.dk Mon Dec 5 15:18:21 2011
From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
Date: Mon, 05 Dec 2011 13:18:21 -0800
Subject: [llvm-commits] Dead register (was Re: [llvm] r145819)
In-Reply-To: <1323118601.2507.3183.camel@sapling>
References: <20111205175518.343FF2A6C12C@llvm.org>
<1323112465.2507.3170.camel@sapling>
<1323118601.2507.3183.camel@sapling>
Message-ID:
On Dec 5, 2011, at 12:56 PM, Hal Finkel wrote:
> RegScavenger is complaining about use of an undefined register, CTR8, in
> the BCTR8 instruction, in the following instance (this is from the PPC
> backend):
>
> BB#38: derived from LLVM BB %for.end50
> Predecessors according to CFG: BB#36
> %X3 = LD 0, ; mem:LD8[FixedStack27]
> %X4 = RLDICR %X3, 3, 60
> %X5 = LI8 [TF=4]
> %X5 = ADDIS8 %X5, [TF=8]
> %X4 = LDX %X4, %X5; mem:LD8[JumpTable]
> MTCTR8 %X4, %CTR8
> BCTR8 %CTR8, %RM
> Successors according to CFG: BB#23 BB#15 BB#7 BB#8 BB#9 BB#10 BB#11
> BB#25 BB#12 BB#16 BB#18 BB#13 BB#17
>
> How could CRT8 be marked implicitly-defined and also dead in the same
> instruction when it is clearly used in the next instruction?
This is the kind of sloppy liveness, I was talking about ;-)
llc -verify-machineinstrs should give you better info.
/jakob
From ahatanaka at mips.com Mon Dec 5 15:26:35 2011
From: ahatanaka at mips.com (Akira Hatanaka)
Date: Mon, 05 Dec 2011 21:26:35 -0000
Subject: [llvm-commits] [llvm] r145853 - in /llvm/trunk:
lib/Target/Mips/Mips64InstrInfo.td lib/Target/Mips/MipsISelLowering.cpp
test/CodeGen/Mips/mips64extins.ll
Message-ID: <20111205212635.3C0D62A6C12C@llvm.org>
Author: ahatanak
Date: Mon Dec 5 15:26:34 2011
New Revision: 145853
URL: http://llvm.org/viewvc/llvm-project?rev=145853&view=rev
Log:
Add definitions of 64-bit extract and insert instrucions and make
PerformANDCombine and PerformOrCombine aware of them. Test cases are included
too.
Added:
llvm/trunk/test/CodeGen/Mips/mips64extins.ll
Modified:
llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td
llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
Modified: llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td?rev=145853&r1=145852&r2=145853&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td (original)
+++ llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td Mon Dec 5 15:26:34 2011
@@ -206,6 +206,9 @@
def DynAlloc64 : EffectiveAddress<"daddiu\t$rt, $addr", CPU64Regs, mem_ea_64>,
Requires<[IsN64]>;
+def DEXT : ExtBase<3, "dext", CPU64Regs>;
+def DINS : InsBase<7, "dins", CPU64Regs>;
+
//===----------------------------------------------------------------------===//
// Arbitrary patterns that map to one or more instructions
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=145853&r1=145852&r2=145853&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Dec 5 15:26:34 2011
@@ -40,11 +40,11 @@
// mask (Pos), and return true.
// For example, if I is 0x003ff800, (Pos, Size) = (11, 11).
static bool IsShiftedMask(uint64_t I, uint64_t &Pos, uint64_t &Size) {
- if (!isUInt<32>(I) || !isShiftedMask_32(I))
+ if (!isShiftedMask_64(I))
return false;
- Size = CountPopulation_32(I);
- Pos = CountTrailingZeros_32(I);
+ Size = CountPopulation_64(I);
+ Pos = CountTrailingZeros_64(I);
return true;
}
@@ -556,20 +556,20 @@
return SDValue();
SDValue ShiftRight = N->getOperand(0), Mask = N->getOperand(1);
-
+ unsigned ShiftRightOpc = ShiftRight.getOpcode();
+
// Op's first operand must be a shift right.
- if (ShiftRight.getOpcode() != ISD::SRA && ShiftRight.getOpcode() != ISD::SRL)
+ if (ShiftRightOpc != ISD::SRA && ShiftRightOpc != ISD::SRL)
return SDValue();
// The second operand of the shift must be an immediate.
- uint64_t Pos;
ConstantSDNode *CN;
if (!(CN = dyn_cast(ShiftRight.getOperand(1))))
return SDValue();
- Pos = CN->getZExtValue();
-
+ uint64_t Pos = CN->getZExtValue();
uint64_t SMPos, SMSize;
+
// Op's second operand must be a shifted mask.
if (!(CN = dyn_cast(Mask)) ||
!IsShiftedMask(CN->getZExtValue(), SMPos, SMSize))
@@ -577,10 +577,11 @@
// Return if the shifted mask does not start at bit 0 or the sum of its size
// and Pos exceeds the word's size.
- if (SMPos != 0 || Pos + SMSize > 32)
+ EVT ValTy = N->getValueType(0);
+ if (SMPos != 0 || Pos + SMSize > ValTy.getSizeInBits())
return SDValue();
- return DAG.getNode(MipsISD::Ext, N->getDebugLoc(), MVT::i32,
+ return DAG.getNode(MipsISD::Ext, N->getDebugLoc(), ValTy,
ShiftRight.getOperand(0),
DAG.getConstant(Pos, MVT::i32),
DAG.getConstant(SMSize, MVT::i32));
@@ -631,10 +632,11 @@
// Return if the shift amount and the first bit position of mask are not the
// same.
- if (Shamt != SMPos0)
+ EVT ValTy = N->getValueType(0);
+ if ((Shamt != SMPos0) || (SMPos0 + SMSize0 > ValTy.getSizeInBits()))
return SDValue();
- return DAG.getNode(MipsISD::Ins, N->getDebugLoc(), MVT::i32,
+ return DAG.getNode(MipsISD::Ins, N->getDebugLoc(), ValTy,
Shl.getOperand(0),
DAG.getConstant(SMPos0, MVT::i32),
DAG.getConstant(SMSize0, MVT::i32),
Added: llvm/trunk/test/CodeGen/Mips/mips64extins.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/mips64extins.ll?rev=145853&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/mips64extins.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/mips64extins.ll Mon Dec 5 15:26:34 2011
@@ -0,0 +1,55 @@
+; RUN: llc < %s -march=mips64el -mcpu=mips64r2 -mattr=n64 | FileCheck %s
+
+define i64 @dext(i64 %i) nounwind readnone {
+entry:
+; CHECK: dext ${{[0-9]+}}, ${{[0-9]+}}, 5, 10
+ %shr = lshr i64 %i, 5
+ %and = and i64 %shr, 1023
+ ret i64 %and
+}
+
+define i64 @dextm(i64 %i) nounwind readnone {
+entry:
+; CHECK: dext ${{[0-9]+}}, ${{[0-9]+}}, 5, 34
+ %shr = lshr i64 %i, 5
+ %and = and i64 %shr, 17179869183
+ ret i64 %and
+}
+
+define i64 @dextu(i64 %i) nounwind readnone {
+entry:
+; CHECK: dext ${{[0-9]+}}, ${{[0-9]+}}, 34, 6
+ %shr = lshr i64 %i, 34
+ %and = and i64 %shr, 63
+ ret i64 %and
+}
+
+define i64 @dins(i64 %i, i64 %j) nounwind readnone {
+entry:
+; CHECK: dins ${{[0-9]+}}, ${{[0-9]+}}, 8, 10
+ %shl2 = shl i64 %j, 8
+ %and = and i64 %shl2, 261888
+ %and3 = and i64 %i, -261889
+ %or = or i64 %and3, %and
+ ret i64 %or
+}
+
+define i64 @dinsm(i64 %i, i64 %j) nounwind readnone {
+entry:
+; CHECK: dins ${{[0-9]+}}, ${{[0-9]+}}, 10, 33
+ %shl4 = shl i64 %j, 10
+ %and = and i64 %shl4, 8796093021184
+ %and5 = and i64 %i, -8796093021185
+ %or = or i64 %and5, %and
+ ret i64 %or
+}
+
+define i64 @dinsu(i64 %i, i64 %j) nounwind readnone {
+entry:
+; CHECK: dins ${{[0-9]+}}, ${{[0-9]+}}, 40, 13
+ %shl4 = shl i64 %j, 40
+ %and = and i64 %shl4, 9006099743113216
+ %and5 = and i64 %i, -9006099743113217
+ %or = or i64 %and5, %and
+ ret i64 %or
+}
From isanbard at gmail.com Mon Dec 5 15:27:54 2011
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 05 Dec 2011 21:27:54 -0000
Subject: [llvm-commits] [llvm] r145854 - /llvm/trunk/docs/LangRef.html
Message-ID: <20111205212754.D7EAA2A6C12C@llvm.org>
Author: void
Date: Mon Dec 5 15:27:54 2011
New Revision: 145854
URL: http://llvm.org/viewvc/llvm-project?rev=145854&view=rev
Log:
Move 'returns_twice' definition into alphabetical place.
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=145854&r1=145853&r2=145854&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Dec 5 15:27:54 2011
@@ -1216,6 +1216,12 @@
exception by calling the C++ exception throwing methods, but may
use the unwind instruction.
+
This attribute indicates that this function can return twice. The
+ C setjmp is an example of such a function. The compiler
+ disables some optimizations (like tail calls) in the caller of these
+ functions.
This attribute indicates that the function should emit a stack smashing
protector. It is in the form of a "canary"—a random value placed on
@@ -1243,12 +1249,6 @@
show that no exceptions passes by it. This is normally the case for
the ELF x86-64 abi, but it can be disabled for some compilation
units.
This attribute indicates that this function can return
- twice. The C setjmp is an example of such a function.
- The compiler disables some optimizations (like tail calls) in the caller of
- these functions.
From hfinkel at anl.gov Mon Dec 5 15:36:50 2011
From: hfinkel at anl.gov (Hal Finkel)
Date: Mon, 05 Dec 2011 15:36:50 -0600
Subject: [llvm-commits] Dead register (was Re: [llvm] r145819)
In-Reply-To:
References: <20111205175518.343FF2A6C12C@llvm.org>
<1323112465.2507.3170.camel@sapling>
<1323118601.2507.3183.camel@sapling>
Message-ID: <1323121010.2507.3186.camel@sapling>
On Mon, 2011-12-05 at 13:18 -0800, Jakob Stoklund Olesen wrote:
> On Dec 5, 2011, at 12:56 PM, Hal Finkel wrote:
>
> > RegScavenger is complaining about use of an undefined register, CTR8, in
> > the BCTR8 instruction, in the following instance (this is from the PPC
> > backend):
> >
> > BB#38: derived from LLVM BB %for.end50
> > Predecessors according to CFG: BB#36
> > %X3 = LD 0, ; mem:LD8[FixedStack27]
> > %X4 = RLDICR %X3, 3, 60
> > %X5 = LI8 [TF=4]
> > %X5 = ADDIS8 %X5, [TF=8]
> > %X4 = LDX %X4, %X5; mem:LD8[JumpTable]
> > MTCTR8 %X4, %CTR8
> > BCTR8 %CTR8, %RM
> > Successors according to CFG: BB#23 BB#15 BB#7 BB#8 BB#9 BB#10 BB#11
> > BB#25 BB#12 BB#16 BB#18 BB#13 BB#17
> >
> > How could CRT8 be marked implicitly-defined and also dead in the same
> > instruction when it is clearly used in the next instruction?
>
> This is the kind of sloppy liveness, I was talking about ;-)
Yea, I went looking ;)
>
> llc -verify-machineinstrs should give you better info.
Thanks!
-Hal
>
> /jakob
>
--
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
From grosbach at apple.com Mon Dec 5 16:16:39 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 22:16:39 -0000
Subject: [llvm-commits] [llvm] r145860 -
/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Message-ID: <20111205221639.4CC512A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 16:16:39 2011
New Revision: 145860
URL: http://llvm.org/viewvc/llvm-project?rev=145860&view=rev
Log:
Thumb2 prefer ADD register encoding T2 to T3 when possible.
rdar://10529664
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=145860&r1=145859&r2=145860&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Dec 5 16:16:39 2011
@@ -5238,6 +5238,26 @@
return true;
}
break;
+ case ARM::t2ADDrr: {
+ // If the destination and first source operand are the same, and
+ // there's no setting of the flags, use encoding T2 instead of T3.
+ // Note that this is only for ADD, not SUB. This mirrors the system
+ // 'as' behaviour. Make sure the wide encoding wasn't explicit.
+ if (Inst.getOperand(0).getReg() != Inst.getOperand(1).getReg() ||
+ Inst.getOperand(5).getReg() != 0 ||
+ (static_cast(Operands[2])->isToken() &&
+ static_cast(Operands[2])->getToken() == ".w"))
+ break;
+ MCInst TmpInst;
+ TmpInst.setOpcode(ARM::tADDhirr);
+ TmpInst.addOperand(Inst.getOperand(0));
+ TmpInst.addOperand(Inst.getOperand(0));
+ TmpInst.addOperand(Inst.getOperand(2));
+ TmpInst.addOperand(Inst.getOperand(3));
+ TmpInst.addOperand(Inst.getOperand(4));
+ Inst = TmpInst;
+ return true;
+ }
case ARM::tB:
// A Thumb conditional branch outside of an IT block is a tBcc.
if (Inst.getOperand(1).getImm() != ARMCC::AL && !inITBlock()) {
From grosbach at apple.com Mon Dec 5 16:21:28 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 22:21:28 -0000
Subject: [llvm-commits] [llvm] r145861 - in /llvm/trunk/test/MC/ARM:
basic-thumb2-instructions.s mode-switch.s
Message-ID: <20111205222128.848972A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 16:21:28 2011
New Revision: 145861
URL: http://llvm.org/viewvc/llvm-project?rev=145861&view=rev
Log:
Update tests for r145860. Add a few new ones.
Modified:
llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s
llvm/trunk/test/MC/ARM/mode-switch.s
Modified: llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s?rev=145861&r1=145860&r2=145861&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/basic-thumb2-instructions.s Mon Dec 5 16:21:28 2011
@@ -99,12 +99,16 @@
adds r7, r3, r1, lsl #31
adds.w r0, r3, r6, lsr #25
add.w r4, r8, r1, ror #12
+ add r10, r8
+ add r10, r10, r8
@ CHECK: add.w r1, r2, r8 @ encoding: [0x02,0xeb,0x08,0x01]
@ CHECK: add.w r5, r9, r2, asr #32 @ encoding: [0x09,0xeb,0x22,0x05]
@ CHECK: adds.w r7, r3, r1, lsl #31 @ encoding: [0x13,0xeb,0xc1,0x77]
@ CHECK: adds.w r0, r3, r6, lsr #25 @ encoding: [0x13,0xeb,0x56,0x60]
@ CHECK: add.w r4, r8, r1, ror #12 @ encoding: [0x08,0xeb,0x31,0x34]
+@ CHECK: add r10, r8 @ encoding: [0xc2,0x44]
+@ CHECK: add r10, r8 @ encoding: [0xc2,0x44]
@------------------------------------------------------------------------------
Modified: llvm/trunk/test/MC/ARM/mode-switch.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/mode-switch.s?rev=145861&r1=145860&r2=145861&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/mode-switch.s (original)
+++ llvm/trunk/test/MC/ARM/mode-switch.s Mon Dec 5 16:21:28 2011
@@ -4,7 +4,7 @@
.code 16
add.w r0, r0, r1
-@ CHECK: add.w r0, r0, r1 @ encoding: [0x00,0xeb,0x01,0x00]
+@ CHECK: add r0, r1 @ encoding: [0x08,0x44]
.code 32
add r0, r0, r1
From grosbach at apple.com Mon Dec 5 16:27:05 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 22:27:05 -0000
Subject: [llvm-commits] [llvm] r145863 - in /llvm/trunk:
lib/Target/ARM/AsmParser/ARMAsmParser.cpp test/MC/ARM/mode-switch.s
Message-ID: <20111205222705.1E00A2A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 16:27:04 2011
New Revision: 145863
URL: http://llvm.org/viewvc/llvm-project?rev=145863&view=rev
Log:
Tweak ADDrr fix. Bad check for explicit .w
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/trunk/test/MC/ARM/mode-switch.s
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=145863&r1=145862&r2=145863&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Dec 5 16:27:04 2011
@@ -5245,8 +5245,8 @@
// 'as' behaviour. Make sure the wide encoding wasn't explicit.
if (Inst.getOperand(0).getReg() != Inst.getOperand(1).getReg() ||
Inst.getOperand(5).getReg() != 0 ||
- (static_cast(Operands[2])->isToken() &&
- static_cast(Operands[2])->getToken() == ".w"))
+ (static_cast(Operands[3])->isToken() &&
+ static_cast(Operands[3])->getToken() == ".w"))
break;
MCInst TmpInst;
TmpInst.setOpcode(ARM::tADDhirr);
Modified: llvm/trunk/test/MC/ARM/mode-switch.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/mode-switch.s?rev=145863&r1=145862&r2=145863&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/mode-switch.s (original)
+++ llvm/trunk/test/MC/ARM/mode-switch.s Mon Dec 5 16:27:04 2011
@@ -4,7 +4,7 @@
.code 16
add.w r0, r0, r1
-@ CHECK: add r0, r1 @ encoding: [0x08,0x44]
+@ CHECK: add.w r0, r0, r1 @ encoding: [0x00,0xeb,0x01,0x00]
.code 32
add r0, r0, r1
From mcrosier at apple.com Mon Dec 5 16:37:00 2011
From: mcrosier at apple.com (Chad Rosier)
Date: Mon, 05 Dec 2011 22:37:00 -0000
Subject: [llvm-commits] [llvm] r145865 - in /llvm/trunk:
lib/Transforms/Scalar/MemCpyOptimizer.cpp
test/Transforms/MemCpyOpt/form-memset.ll
Message-ID: <20111205223700.8EE422A6C12C@llvm.org>
Author: mcrosier
Date: Mon Dec 5 16:37:00 2011
New Revision: 145865
URL: http://llvm.org/viewvc/llvm-project?rev=145865&view=rev
Log:
Make the MemCpyOptimizer a bit more aggressive. I can't think of a scenerio
where this would be bad as the backend shouldn't have a problem inlining small
memcpys.
rdar://10510150
Modified:
llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=145865&r1=145864&r2=145865&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Dec 5 16:37:00 2011
@@ -148,7 +148,7 @@
bool MemsetRange::isProfitableToUseMemset(const TargetData &TD) const {
// If we found more than 8 stores to merge or 64 bytes, use memset.
- if (TheStores.size() >= 8 || End-Start >= 64) return true;
+ if (TheStores.size() >= 4 || End-Start >= 16) return true;
// If there is nothing to merge, don't do anything.
if (TheStores.size() < 2) return false;
Modified: llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll?rev=145865&r1=145864&r2=145865&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll (original)
+++ llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll Mon Dec 5 16:37:00 2011
@@ -57,8 +57,8 @@
declare i32 @bar(...)
+%struct.MV = type { i16, i16 }
- %struct.MV = type { i16, i16 }
define void @test2() nounwind {
entry:
@@ -220,3 +220,19 @@
; CHECK: call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 24, i32 1, i1 false)
}
+; More aggressive heuristic
+; rdar://9892684
+define void @test7(i32* nocapture %c) nounwind optsize {
+ store i32 -1, i32* %c, align 4
+ %1 = getelementptr inbounds i32* %c, i32 1
+ store i32 -1, i32* %1, align 4
+ %2 = getelementptr inbounds i32* %c, i32 2
+ store i32 -1, i32* %2, align 4
+ %3 = getelementptr inbounds i32* %c, i32 3
+ store i32 -1, i32* %3, align 4
+ %4 = getelementptr inbounds i32* %c, i32 4
+ store i32 -1, i32* %4, align 4
+; CHECK: @test7
+; CHECK: call void @llvm.memset.p0i8.i64(i8* %5, i8 -1, i64 20, i32 4, i1 false)
+ ret void
+}
From bob.wilson at apple.com Mon Dec 5 16:42:45 2011
From: bob.wilson at apple.com (Bob Wilson)
Date: Mon, 05 Dec 2011 14:42:45 -0800
Subject: [llvm-commits] [llvm] r145865 - in /llvm/trunk:
lib/Transforms/Scalar/MemCpyOptimizer.cpp
test/Transforms/MemCpyOpt/form-memset.ll
In-Reply-To: <20111205223700.8EE422A6C12C@llvm.org>
References: <20111205223700.8EE422A6C12C@llvm.org>
Message-ID:
I think you meant
On Dec 5, 2011, at 2:37 PM, Chad Rosier wrote:
> Author: mcrosier
> Date: Mon Dec 5 16:37:00 2011
> New Revision: 145865
>
> URL: http://llvm.org/viewvc/llvm-project?rev=145865&view=rev
> Log:
> Make the MemCpyOptimizer a bit more aggressive. I can't think of a scenerio
> where this would be bad as the backend shouldn't have a problem inlining small
> memcpys.
> rdar://10510150
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
> llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
>
> Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=145865&r1=145864&r2=145865&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Dec 5 16:37:00 2011
> @@ -148,7 +148,7 @@
>
> bool MemsetRange::isProfitableToUseMemset(const TargetData &TD) const {
> // If we found more than 8 stores to merge or 64 bytes, use memset.
> - if (TheStores.size() >= 8 || End-Start >= 64) return true;
> + if (TheStores.size() >= 4 || End-Start >= 16) return true;
>
> // If there is nothing to merge, don't do anything.
> if (TheStores.size() < 2) return false;
>
> Modified: llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll?rev=145865&r1=145864&r2=145865&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll (original)
> +++ llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll Mon Dec 5 16:37:00 2011
> @@ -57,8 +57,8 @@
>
> declare i32 @bar(...)
>
> +%struct.MV = type { i16, i16 }
>
> - %struct.MV = type { i16, i16 }
>
> define void @test2() nounwind {
> entry:
> @@ -220,3 +220,19 @@
> ; CHECK: call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 24, i32 1, i1 false)
> }
>
> +; More aggressive heuristic
> +; rdar://9892684
> +define void @test7(i32* nocapture %c) nounwind optsize {
> + store i32 -1, i32* %c, align 4
> + %1 = getelementptr inbounds i32* %c, i32 1
> + store i32 -1, i32* %1, align 4
> + %2 = getelementptr inbounds i32* %c, i32 2
> + store i32 -1, i32* %2, align 4
> + %3 = getelementptr inbounds i32* %c, i32 3
> + store i32 -1, i32* %3, align 4
> + %4 = getelementptr inbounds i32* %c, i32 4
> + store i32 -1, i32* %4, align 4
> +; CHECK: @test7
> +; CHECK: call void @llvm.memset.p0i8.i64(i8* %5, i8 -1, i64 20, i32 4, i1 false)
> + ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From mcrosier at apple.com Mon Dec 5 16:50:01 2011
From: mcrosier at apple.com (Chad Rosier)
Date: Mon, 05 Dec 2011 14:50:01 -0800
Subject: [llvm-commits] [llvm] r145865 - in /llvm/trunk:
lib/Transforms/Scalar/MemCpyOptimizer.cpp
test/Transforms/MemCpyOpt/form-memset.ll
In-Reply-To: <8A7D3AC4-6389-4260-8E5A-61A9C47FB9A4@apple.com>
References: <20111205223700.8EE422A6C12C@llvm.org>
<8A7D3AC4-6389-4260-8E5A-61A9C47FB9A4@apple.com>
Message-ID:
Yes, juggling too many things at once. Will do.
Chad
On Dec 5, 2011, at 2:44 PM, Bob Wilson wrote:
>
> On Dec 5, 2011, at 2:42 PM, Bob Wilson wrote:
>
>> I think you meant
>>
>> On Dec 5, 2011, at 2:37 PM, Chad Rosier wrote:
>>
>>> Author: mcrosier
>>> Date: Mon Dec 5 16:37:00 2011
>>> New Revision: 145865
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=145865&view=rev
>>> Log:
>>> Make the MemCpyOptimizer a bit more aggressive. I can't think of a scenerio
>>> where this would be bad as the backend shouldn't have a problem inlining small
>>> memcpys.
>>> rdar://10510150
>>>
>>> Modified:
>>> llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
>>> llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
>>>
>>> Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=145865&r1=145864&r2=145865&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
>>> +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Dec 5 16:37:00 2011
>>> @@ -148,7 +148,7 @@
>>>
>>> bool MemsetRange::isProfitableToUseMemset(const TargetData &TD) const {
>>> // If we found more than 8 stores to merge or 64 bytes, use memset.
>>> - if (TheStores.size() >= 8 || End-Start >= 64) return true;
>>> + if (TheStores.size() >= 4 || End-Start >= 16) return true;
>
> ?and please update the comment to match.
From mcrosier at apple.com Mon Dec 5 16:53:09 2011
From: mcrosier at apple.com (Chad Rosier)
Date: Mon, 05 Dec 2011 22:53:09 -0000
Subject: [llvm-commits] [llvm] r145866 -
/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Message-ID: <20111205225309.442522A6C12C@llvm.org>
Author: mcrosier
Date: Mon Dec 5 16:53:09 2011
New Revision: 145866
URL: http://llvm.org/viewvc/llvm-project?rev=145866&view=rev
Log:
Update comment.
Modified:
llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=145866&r1=145865&r2=145866&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Dec 5 16:53:09 2011
@@ -147,7 +147,7 @@
} // end anon namespace
bool MemsetRange::isProfitableToUseMemset(const TargetData &TD) const {
- // If we found more than 8 stores to merge or 64 bytes, use memset.
+ // If we found more than 4 stores to merge or 16 bytes, use memset.
if (TheStores.size() >= 4 || End-Start >= 16) return true;
// If there is nothing to merge, don't do anything.
From bob.wilson at apple.com Mon Dec 5 16:44:54 2011
From: bob.wilson at apple.com (Bob Wilson)
Date: Mon, 05 Dec 2011 14:44:54 -0800
Subject: [llvm-commits] [llvm] r145865 - in /llvm/trunk:
lib/Transforms/Scalar/MemCpyOptimizer.cpp
test/Transforms/MemCpyOpt/form-memset.ll
In-Reply-To:
References: <20111205223700.8EE422A6C12C@llvm.org>
Message-ID: <8A7D3AC4-6389-4260-8E5A-61A9C47FB9A4@apple.com>
On Dec 5, 2011, at 2:42 PM, Bob Wilson wrote:
> I think you meant
>
> On Dec 5, 2011, at 2:37 PM, Chad Rosier wrote:
>
>> Author: mcrosier
>> Date: Mon Dec 5 16:37:00 2011
>> New Revision: 145865
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=145865&view=rev
>> Log:
>> Make the MemCpyOptimizer a bit more aggressive. I can't think of a scenerio
>> where this would be bad as the backend shouldn't have a problem inlining small
>> memcpys.
>> rdar://10510150
>>
>> Modified:
>> llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
>> llvm/trunk/test/Transforms/MemCpyOpt/form-memset.ll
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=145865&r1=145864&r2=145865&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Dec 5 16:37:00 2011
>> @@ -148,7 +148,7 @@
>>
>> bool MemsetRange::isProfitableToUseMemset(const TargetData &TD) const {
>> // If we found more than 8 stores to merge or 64 bytes, use memset.
>> - if (TheStores.size() >= 8 || End-Start >= 64) return true;
>> + if (TheStores.size() >= 4 || End-Start >= 16) return true;
?and please update the comment to match.
From nicholas at mxc.ca Mon Dec 5 17:07:06 2011
From: nicholas at mxc.ca (Nick Lewycky)
Date: Mon, 05 Dec 2011 23:07:06 -0000
Subject: [llvm-commits] [llvm] r145869 - in /llvm/trunk:
include/llvm/ADT/Statistic.h lib/Support/Statistic.cpp
Message-ID: <20111205230706.14E252A6C12C@llvm.org>
Author: nicholas
Date: Mon Dec 5 17:07:05 2011
New Revision: 145869
URL: http://llvm.org/viewvc/llvm-project?rev=145869&view=rev
Log:
Silence tsan false-positives (tsan can't track things which are only safe due to
memory fences) in statistics registration, which works the same way that
ManagedStatic registration does.
Modified:
llvm/trunk/include/llvm/ADT/Statistic.h
llvm/trunk/lib/Support/Statistic.cpp
Modified: llvm/trunk/include/llvm/ADT/Statistic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Statistic.h?rev=145869&r1=145868&r2=145869&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Statistic.h (original)
+++ llvm/trunk/include/llvm/ADT/Statistic.h Mon Dec 5 17:07:05 2011
@@ -27,6 +27,7 @@
#define LLVM_ADT_STATISTIC_H
#include "llvm/Support/Atomic.h"
+#include "llvm/Support/Valgrind.h"
namespace llvm {
class raw_ostream;
@@ -110,6 +111,7 @@
bool tmp = Initialized;
sys::MemoryFence();
if (!tmp) RegisterStatistic();
+ TsanHappensAfter(this);
return *this;
}
void RegisterStatistic();
Modified: llvm/trunk/lib/Support/Statistic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Statistic.cpp?rev=145869&r1=145868&r2=145869&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Statistic.cpp (original)
+++ llvm/trunk/lib/Support/Statistic.cpp Mon Dec 5 17:07:05 2011
@@ -73,9 +73,12 @@
if (Enabled)
StatInfo->addStatistic(this);
+ TsanHappensBefore(this);
sys::MemoryFence();
// Remember we have been registered.
+ TsanIgnoreWritesBegin();
Initialized = true;
+ TsanIgnoreWritesEnd();
}
}
From grosbach at apple.com Mon Dec 5 17:20:14 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 23:20:14 -0000
Subject: [llvm-commits] [llvm] r145870 -
/llvm/trunk/tools/llvm-mc/llvm-mc.cpp
Message-ID: <20111205232014.515452A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 17:20:14 2011
New Revision: 145870
URL: http://llvm.org/viewvc/llvm-project?rev=145870&view=rev
Log:
Tidy up.
Modified:
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=145870&r1=145869&r2=145870&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Mon Dec 5 17:20:14 2011
@@ -418,7 +418,7 @@
/*useCFI*/ true,
/*useDwarfDirectory*/ true,
IP, CE, MAB, ShowInst));
-
+
} else if (FileType == OFT_Null) {
Str.reset(createNullStreamer(Ctx));
} else {
From grosbach at apple.com Mon Dec 5 17:45:46 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 05 Dec 2011 23:45:46 -0000
Subject: [llvm-commits] [llvm] r145871 -
/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
Message-ID: <20111205234547.036AA2A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 17:45:46 2011
New Revision: 145871
URL: http://llvm.org/viewvc/llvm-project?rev=145871&view=rev
Log:
Simple branch relaxation for Thumb2 Bcc instructions.
Not right yet, as the rules for when to relax in the MCAssembler aren't
(yet) correct for ARM. This is a step in the proper direction, though.
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=145871&r1=145870&r2=145871&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Mon Dec 5 17:45:46 2011
@@ -124,14 +124,35 @@
};
} // end anonymous namespace
+static unsigned getRelaxedOpcode(unsigned Op) {
+ switch (Op) {
+ default: return Op;
+ case ARM::tBcc: return ARM::t2Bcc;
+ }
+}
+
bool ARMAsmBackend::MayNeedRelaxation(const MCInst &Inst) const {
- // FIXME: Thumb targets, different move constant targets..
+ if (getRelaxedOpcode(Inst.getOpcode()) != Inst.getOpcode())
+ return true;
return false;
}
void ARMAsmBackend::RelaxInstruction(const MCInst &Inst, MCInst &Res) const {
- assert(0 && "ARMAsmBackend::RelaxInstruction() unimplemented");
- return;
+ unsigned RelaxedOp = getRelaxedOpcode(Inst.getOpcode());
+
+ // Sanity check w/ diagnostic if we get here w/ a bogus instruction.
+ if (RelaxedOp == Inst.getOpcode()) {
+ SmallString<256> Tmp;
+ raw_svector_ostream OS(Tmp);
+ Inst.dump_pretty(OS);
+ OS << "\n";
+ report_fatal_error("unexpected instruction to relax: " + OS.str());
+ }
+
+ // The instructions we're relaxing have (so far) the same operands.
+ // We just need to update to the proper opcode.
+ Res = Inst;
+ Res.setOpcode(RelaxedOp);
}
bool ARMAsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const {
From grosbach at apple.com Mon Dec 5 18:03:48 2011
From: grosbach at apple.com (Jim Grosbach)
Date: Tue, 06 Dec 2011 00:03:48 -0000
Subject: [llvm-commits] [llvm] r145873 - in /llvm/trunk:
include/llvm/MC/MCAssembler.h lib/MC/ELFObjectWriter.cpp
lib/MC/MCAssembler.cpp lib/MC/MachObjectWriter.cpp
lib/MC/WinCOFFObjectWriter.cpp
Message-ID: <20111206000348.6D9012A6C12C@llvm.org>
Author: grosbach
Date: Mon Dec 5 18:03:48 2011
New Revision: 145873
URL: http://llvm.org/viewvc/llvm-project?rev=145873&view=rev
Log:
Switch MCAssembler to method names starting w/ lower-case.
per http://llvm.org/docs/CodingStandards.html#ll_naming
Modified:
llvm/trunk/include/llvm/MC/MCAssembler.h
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCAssembler.cpp
llvm/trunk/lib/MC/MachObjectWriter.cpp
llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=145873&r1=145872&r2=145873&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Mon Dec 5 18:03:48 2011
@@ -711,43 +711,43 @@
/// \return Whether the fixup value was fully resolved. This is true if the
/// \arg Value result is fixed, otherwise the value may change due to
/// relocation.
- bool EvaluateFixup(const MCAsmLayout &Layout,
+ bool evaluateFixup(const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
MCValue &Target, uint64_t &Value) const;
/// Check whether a fixup can be satisfied, or whether it needs to be relaxed
/// (increased in size, in order to hold its value correctly).
- bool FixupNeedsRelaxation(const MCFixup &Fixup, const MCFragment *DF,
+ bool fixupNeedsRelaxation(const MCFixup &Fixup, const MCFragment *DF,
const MCAsmLayout &Layout) const;
/// Check whether the given fragment needs relaxation.
- bool FragmentNeedsRelaxation(const MCInstFragment *IF,
+ bool fragmentNeedsRelaxation(const MCInstFragment *IF,
const MCAsmLayout &Layout) const;
- /// LayoutOnce - Perform one layout iteration and return true if any offsets
+ /// layoutOnce - Perform one layout iteration and return true if any offsets
/// were adjusted.
- bool LayoutOnce(MCAsmLayout &Layout);
+ bool layoutOnce(MCAsmLayout &Layout);
- bool LayoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD);
+ bool layoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD);
- bool RelaxInstruction(MCAsmLayout &Layout, MCInstFragment &IF);
+ bool relaxInstruction(MCAsmLayout &Layout, MCInstFragment &IF);
- bool RelaxLEB(MCAsmLayout &Layout, MCLEBFragment &IF);
+ bool relaxLEB(MCAsmLayout &Layout, MCLEBFragment &IF);
- bool RelaxDwarfLineAddr(MCAsmLayout &Layout, MCDwarfLineAddrFragment &DF);
- bool RelaxDwarfCallFrameFragment(MCAsmLayout &Layout,
+ bool relaxDwarfLineAddr(MCAsmLayout &Layout, MCDwarfLineAddrFragment &DF);
+ bool relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
MCDwarfCallFrameFragment &DF);
- /// FinishLayout - Finalize a layout, including fragment lowering.
- void FinishLayout(MCAsmLayout &Layout);
+ /// finishLayout - Finalize a layout, including fragment lowering.
+ void finishLayout(MCAsmLayout &Layout);
- uint64_t HandleFixup(const MCAsmLayout &Layout,
+ uint64_t handleFixup(const MCAsmLayout &Layout,
MCFragment &F, const MCFixup &Fixup);
public:
/// Compute the effective fragment size assuming it is laid out at the given
/// \arg SectionAddress and \arg FragmentOffset.
- uint64_t ComputeFragmentSize(const MCAsmLayout &Layout, const MCFragment &F) const;
+ uint64_t computeFragmentSize(const MCAsmLayout &Layout, const MCFragment &F) const;
/// Find the symbol which defines the atom containing the given symbol, or
/// null if there is no such symbol.
@@ -760,7 +760,7 @@
bool isSymbolLinkerVisible(const MCSymbol &SD) const;
/// Emit the section contents using the given object writer.
- void WriteSectionData(const MCSectionData *Section,
+ void writeSectionData(const MCSectionData *Section,
const MCAsmLayout &Layout) const;
/// Check whether a given symbol has been flagged with .thumb_func.
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=145873&r1=145872&r2=145873&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Dec 5 18:03:48 2011
@@ -1072,7 +1072,7 @@
WriteBytes(cast(F).getContents().str());
}
} else {
- Asm.WriteSectionData(&SD, Layout);
+ Asm.writeSectionData(&SD, Layout);
}
}
Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=145873&r1=145872&r2=145873&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Mon Dec 5 18:03:48 2011
@@ -33,7 +33,7 @@
namespace {
namespace stats {
STATISTIC(EmittedFragments, "Number of emitted assembler fragments");
-STATISTIC(EvaluateFixup, "Number of evaluated fixups");
+STATISTIC(evaluateFixup, "Number of evaluated fixups");
STATISTIC(FragmentLayouts, "Number of fragment layouts");
STATISTIC(ObjectBytes, "Number of emitted object file bytes");
STATISTIC(RelaxationSteps, "Number of assembler layout and relaxation steps");
@@ -136,7 +136,7 @@
uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
// The size is the last fragment's end offset.
const MCFragment &F = SD->getFragmentList().back();
- return getFragmentOffset(&F) + getAssembler().ComputeFragmentSize(*this, F);
+ return getFragmentOffset(&F) + getAssembler().computeFragmentSize(*this, F);
}
uint64_t MCAsmLayout::getSectionFileSize(const MCSectionData *SD) const {
@@ -237,10 +237,10 @@
return SD->getFragment()->getAtom();
}
-bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout,
+bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
MCValue &Target, uint64_t &Value) const {
- ++stats::EvaluateFixup;
+ ++stats::evaluateFixup;
if (!Fixup.getValue()->EvaluateAsRelocatable(Target, Layout))
report_fatal_error("expected relocatable expression");
@@ -312,7 +312,7 @@
return IsResolved;
}
-uint64_t MCAssembler::ComputeFragmentSize(const MCAsmLayout &Layout,
+uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
const MCFragment &F) const {
switch (F.getKind()) {
case MCFragment::FT_Data:
@@ -374,7 +374,7 @@
// Compute fragment offset and size.
uint64_t Offset = 0;
if (Prev)
- Offset += Prev->Offset + getAssembler().ComputeFragmentSize(*this, *Prev);
+ Offset += Prev->Offset + getAssembler().computeFragmentSize(*this, *Prev);
F->Offset = Offset;
LastValidFragment[F->getParent()] = F;
@@ -390,7 +390,7 @@
++stats::EmittedFragments;
// FIXME: Embed in fragments instead?
- uint64_t FragmentSize = Asm.ComputeFragmentSize(Layout, F);
+ uint64_t FragmentSize = Asm.computeFragmentSize(Layout, F);
switch (F.getKind()) {
case MCFragment::FT_Align: {
MCAlignFragment &AF = cast(F);
@@ -493,7 +493,7 @@
assert(OW->getStream().tell() - Start == FragmentSize);
}
-void MCAssembler::WriteSectionData(const MCSectionData *SD,
+void MCAssembler::writeSectionData(const MCSectionData *SD,
const MCAsmLayout &Layout) const {
// Ignore virtual sections.
if (SD->getSection().isVirtualSection()) {
@@ -546,13 +546,13 @@
}
-uint64_t MCAssembler::HandleFixup(const MCAsmLayout &Layout,
+uint64_t MCAssembler::handleFixup(const MCAsmLayout &Layout,
MCFragment &F,
const MCFixup &Fixup) {
// Evaluate the fixup.
MCValue Target;
uint64_t FixedValue;
- if (!EvaluateFixup(Layout, Fixup, &F, Target, FixedValue)) {
+ if (!evaluateFixup(Layout, Fixup, &F, Target, FixedValue)) {
// The fixup was unresolved, we need a relocation. Inform the object
// writer of the relocation, and give it an opportunity to adjust the
// fixup value if need be.
@@ -592,7 +592,7 @@
}
// Layout until everything fits.
- while (LayoutOnce(Layout))
+ while (layoutOnce(Layout))
continue;
DEBUG_WITH_TYPE("mc-dump", {
@@ -600,7 +600,7 @@
dump(); });
// Finalize the layout, including fragment lowering.
- FinishLayout(Layout);
+ finishLayout(Layout);
DEBUG_WITH_TYPE("mc-dump", {
llvm::errs() << "assembler backend - final-layout\n--\n";
@@ -621,7 +621,7 @@
for (MCDataFragment::fixup_iterator it3 = DF->fixup_begin(),
ie3 = DF->fixup_end(); it3 != ie3; ++it3) {
MCFixup &Fixup = *it3;
- uint64_t FixedValue = HandleFixup(Layout, *DF, Fixup);
+ uint64_t FixedValue = handleFixup(Layout, *DF, Fixup);
getBackend().ApplyFixup(Fixup, DF->getContents().data(),
DF->getContents().size(), FixedValue);
}
@@ -631,7 +631,7 @@
for (MCInstFragment::fixup_iterator it3 = IF->fixup_begin(),
ie3 = IF->fixup_end(); it3 != ie3; ++it3) {
MCFixup &Fixup = *it3;
- uint64_t FixedValue = HandleFixup(Layout, *IF, Fixup);
+ uint64_t FixedValue = handleFixup(Layout, *IF, Fixup);
getBackend().ApplyFixup(Fixup, IF->getCode().data(),
IF->getCode().size(), FixedValue);
}
@@ -645,7 +645,7 @@
stats::ObjectBytes += OS.tell() - StartOffset;
}
-bool MCAssembler::FixupNeedsRelaxation(const MCFixup &Fixup,
+bool MCAssembler::fixupNeedsRelaxation(const MCFixup &Fixup,
const MCFragment *DF,
const MCAsmLayout &Layout) const {
if (getRelaxAll())
@@ -654,7 +654,7 @@
// If we cannot resolve the fixup value, it requires relaxation.
MCValue Target;
uint64_t Value;
- if (!EvaluateFixup(Layout, Fixup, DF, Target, Value))
+ if (!evaluateFixup(Layout, Fixup, DF, Target, Value))
return true;
// Otherwise, relax if the value is too big for a (signed) i8.
@@ -663,7 +663,7 @@
return int64_t(Value) != int64_t(int8_t(Value));
}
-bool MCAssembler::FragmentNeedsRelaxation(const MCInstFragment *IF,
+bool MCAssembler::fragmentNeedsRelaxation(const MCInstFragment *IF,
const MCAsmLayout &Layout) const {
// If this inst doesn't ever need relaxation, ignore it. This occurs when we
// are intentionally pushing out inst fragments, or because we relaxed a
@@ -673,15 +673,15 @@
for (MCInstFragment::const_fixup_iterator it = IF->fixup_begin(),
ie = IF->fixup_end(); it != ie; ++it)
- if (FixupNeedsRelaxation(*it, IF, Layout))
+ if (fixupNeedsRelaxation(*it, IF, Layout))
return true;
return false;
}
-bool MCAssembler::RelaxInstruction(MCAsmLayout &Layout,
+bool MCAssembler::relaxInstruction(MCAsmLayout &Layout,
MCInstFragment &IF) {
- if (!FragmentNeedsRelaxation(&IF, Layout))
+ if (!fragmentNeedsRelaxation(&IF, Layout))
return false;
++stats::RelaxedInstructions;
@@ -715,7 +715,7 @@
return true;
}
-bool MCAssembler::RelaxLEB(MCAsmLayout &Layout, MCLEBFragment &LF) {
+bool MCAssembler::relaxLEB(MCAsmLayout &Layout, MCLEBFragment &LF) {
int64_t Value = 0;
uint64_t OldSize = LF.getContents().size();
bool IsAbs = LF.getValue().EvaluateAsAbsolute(Value, Layout);
@@ -732,7 +732,7 @@
return OldSize != LF.getContents().size();
}
-bool MCAssembler::RelaxDwarfLineAddr(MCAsmLayout &Layout,
+bool MCAssembler::relaxDwarfLineAddr(MCAsmLayout &Layout,
MCDwarfLineAddrFragment &DF) {
int64_t AddrDelta = 0;
uint64_t OldSize = DF.getContents().size();
@@ -749,7 +749,7 @@
return OldSize != Data.size();
}
-bool MCAssembler::RelaxDwarfCallFrameFragment(MCAsmLayout &Layout,
+bool MCAssembler::relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
MCDwarfCallFrameFragment &DF) {
int64_t AddrDelta = 0;
uint64_t OldSize = DF.getContents().size();
@@ -764,7 +764,7 @@
return OldSize != Data.size();
}
-bool MCAssembler::LayoutSectionOnce(MCAsmLayout &Layout,
+bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout,
MCSectionData &SD) {
MCFragment *FirstInvalidFragment = NULL;
// Scan for fragments that need relaxation.
@@ -776,19 +776,19 @@
default:
break;
case MCFragment::FT_Inst:
- relaxedFrag = RelaxInstruction(Layout, *cast(it2));
+ relaxedFrag = relaxInstruction(Layout, *cast(it2));
break;
case MCFragment::FT_Dwarf:
- relaxedFrag = RelaxDwarfLineAddr(Layout,
+ relaxedFrag = relaxDwarfLineAddr(Layout,
*cast(it2));
break;
case MCFragment::FT_DwarfFrame:
relaxedFrag =
- RelaxDwarfCallFrameFragment(Layout,
+ relaxDwarfCallFrameFragment(Layout,
*cast(it2));
break;
case MCFragment::FT_LEB:
- relaxedFrag = RelaxLEB(Layout, *cast