[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.259 -> 1.260 --- Log message: Don't convert store double C, Ptr to store long C, Ptr if i64 is not a legal type. --- Diffs of the changes: (+12 -9) DAGCombiner.cpp | 21 - 1 files changed, 12 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.259 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.260 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.259 Sun Dec 10 20:23:46 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Dec 11 11:25:19 2006 @@ -3035,17 +3035,20 @@ } // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' - // FIXME: We shouldn't do this for TargetConstantFP's. if (ConstantFPSDNode *CFP = dyn_cast(Value)) { -SDOperand Tmp; -if (CFP->getValueType(0) == MVT::f32) { - Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); -} else { - assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); - Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); +if (Value.getOpcode() != ISD::TargetConstantFP) { + SDOperand Tmp; + if (CFP->getValueType(0) == MVT::f32) { +Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); +return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), +ST->getSrcValueOffset()); + } else if (TLI.isTypeLegal(MVT::i64)) { +assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); +Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); +return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), +ST->getSrcValueOffset()); + } } -return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), -ST->getSrcValueOffset()); } if (CombinerAA) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/findoptdiff
Changes in directory llvm/utils: findoptdiff added (r1.1) --- Log message: Provide a script that can track down which optimization pass causes different code to be produced between two llvm builds that differe slightly. This is useful in tracking down mis-optimization bugs. --- Diffs of the changes: (+99 -0) findoptdiff | 99 1 files changed, 99 insertions(+) Index: llvm/utils/findoptdiff diff -c /dev/null llvm/utils/findoptdiff:1.1 *** /dev/null Mon Dec 11 11:42:22 2006 --- llvm/utils/findoptdiff Mon Dec 11 11:42:12 2006 *** *** 0 --- 1,99 + #!/bin/bash + # + # findoptdiff + # + # This script helps find the optimization difference between two llvm + # builds. It is useful when you have a build that is known to work and + # one that exhibits an optimization problem. Identifying the difference + # between the two builds can lead to discovery of the source of a + # mis-optimization. + # + # The script takes two llvm build paths as arguments. These specify the + # the two llvm builds to compare. It is generally expected that they + # are "close cousins". That is, they are the same except that the + # second build contains some experimental optimization features that + # are suspected of producing a misoptimization. + # + # The script takes two bytecode files, one from each build. They are + # presumed to be a compilation of the same program or program fragment + # with the only difference being the builds. + # + # The script operates by iteratively applying the optimizations that gccas + # and gccld run until there is a difference in the assembly resulting + # from the optimization. The difference is then reported with the set of + # optimization passes that produce the difference. + # + # To work around differences in the assembly language format, the script + # can also take two filter arguments that post-process the assembly + # so they can be differenced without making false positives for known + # differences in the two builds. These filters are optional. + # + # Usage: + # findoptdiff llvm1 llvm2 bc1 bc2 filter1 filter2 + # + # Where: + # llvm1 + # is the path to the first llvm build dir + # llvm2 + # is the path to the second llvm build dir + # bc1 + # is the bytecode file for the first llvm environment + # bc2 + # is the bytecode file for the second llvm environment + # filter1 + # is an optional filter for filtering the llvm1 generated assembly + # filter2 + # is an optional filter for filtering the llvm2 generated assembly + # + llvm1=$1 + llvm2=$2 + bc1=$3 + bc2=$4 + filt1=$5 + if [ -z "$filt1" ] ; then + filt1="cat" + fi + filt2=$6 + if [ -z "$filt2" ] ; then + filt2="cat" + fi + opt1=opt.$bc1 + opt2=opt.$bc2 + ll1=${bc1}.ll + ll2=${bc2}.ll + dir1="/proj/llvm/llvm-test-1/External/SPEC/CINT2000/300.twolf" + opt1="/proj/llvm/llvm-1/Debug/bin/opt" + dis1="/proj/llvm/llvm-1/Debug/bin/llvm-dis" + dir2="/proj/llvm/llvm-test-2/External/SPEC/CINT2000/300.twolf" + opt2="/proj/llvm/llvm-2/Debug/bin/opt" + dis2="/proj/llvm/llvm-2/Debug/bin/llvm-dis" + bcfile="Output/300.twolf.linked.rbc" + optll="opt.ll" + + all_switches="-verify -lowersetjmp -funcresolve -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -raise -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge -funcresolve -internalize -ipsccp -globalopt -constmerge -deadargelim -inline -prune-eh -globalopt -globaldce -argpromotion -instcombine -predsimplify -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -dse -instcombine -simplifycfg -verify" + + function tryit { + switches_to_use="$1" + cd $dir1 + $opt1 $switches_to_use "$bcfile" -o - | $dis1 | $filt1 > "$optll" + cd $dir2 + $opt2 $switches_to_use "$bcfile" -o - | $dis2 | $filt2 > "$optll" + diff "$dir1/$optll" "$dir2/$optll" > /dev/null + if [ $? -ne 0 ] ; then + echo + echo "Diff fails with these switches:" + echo $switches + echo "Differences:" + diff "$dir1/$optll" "$dir2/$optll" | head + exit 1 + fi + return 1 + } + + for sw in $all_switches ; do + echo -n " $sw" + switches="$switches $sw" + if tryit "$switches" ; then + break; + fi + done ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCJITInfo.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCJITInfo.cpp updated: 1.35 -> 1.36 --- Log message: Layout proper frame for ppc64. --- Diffs of the changes: (+38 -28) PPCJITInfo.cpp | 66 - 1 files changed, 38 insertions(+), 28 deletions(-) Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.35 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.36 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.35 Sun Dec 10 07:09:42 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Mon Dec 11 12:10:54 2006 @@ -84,9 +84,14 @@ // FIXME: need to save v[0-19] for altivec? // FIXME: could shrink frame // Set up a proper stack frame -"stwu r1, -208(r1)\n" +// FIXME Layout +// PowerPC64 ABI linkage- 24 bytes +// parameters - 32 bytes +// 13 double registers - 104 bytes +// 8 int registers - 32 bytes "mflr r0\n" -"stw r0, 216(r1)\n" +"stw r0, 8(r1)\n" +"stwu r1, -208(r1)\n" // Save all int arg registers "stw r10, 204(r1)\n""stw r9, 200(r1)\n" "stw r8, 196(r1)\n""stw r7, 192(r1)\n" @@ -146,47 +151,52 @@ // Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the // FIXME: need to save v[0-19] for altivec? // Set up a proper stack frame -"stdu r1, -208(r1)\n" +// Layout +// PowerPC64 ABI linkage- 48 bytes +// parameters - 64 bytes +// 13 double registers - 104 bytes +// 8 int registers - 64 bytes "mflr r0\n" -"std r0, 224(r1)\n" +"std r0, 16(r1)\n" +"stdu r1, -280(r1)\n" // Save all int arg registers -"std r10, 200(r1)\n""std r9, 192(r1)\n" -"std r8, 184(r1)\n""std r7, 176(r1)\n" -"std r6, 168(r1)\n""std r5, 160(r1)\n" -"std r4, 152(r1)\n""std r3, 144(r1)\n" +"std r10, 272(r1)\n""std r9, 264(r1)\n" +"std r8, 256(r1)\n""std r7, 248(r1)\n" +"std r6, 240(r1)\n""std r5, 232(r1)\n" +"std r4, 224(r1)\n""std r3, 216(r1)\n" // Save all call-clobbered FP regs. -"stfd f13, 136(r1)\n" "stfd f12, 128(r1)\n" -"stfd f11, 120(r1)\n" "stfd f10, 112(r1)\n" -"stfd f9, 104(r1)\n" "stfd f8, 96(r1)\n" -"stfd f7, 88(r1)\n" "stfd f6, 80(r1)\n" -"stfd f5, 72(r1)\n" "stfd f4, 64(r1)\n" -"stfd f3, 56(r1)\n" "stfd f2, 48(r1)\n" -"stfd f1, 40(r1)\n" +"stfd f13, 208(r1)\n""stfd f12, 200(r1)\n" +"stfd f11, 192(r1)\n""stfd f10, 184(r1)\n" +"stfd f9, 176(r1)\n""stfd f8, 168(r1)\n" +"stfd f7, 160(r1)\n""stfd f6, 152(r1)\n" +"stfd f5, 144(r1)\n""stfd f4, 136(r1)\n" +"stfd f3, 128(r1)\n""stfd f2, 120(r1)\n" +"stfd f1, 112(r1)\n" // Arguments to Compilation Callback: // r3 - our lr (address of the call instruction in stub plus 4) // r4 - stub's lr (address of instruction that called the stub plus 4) // r5 - is64Bit - always 1. "mr r3, r0\n" -"ld r2, 208(r1)\n" // stub's frame +"ld r2, 280(r1)\n" // stub's frame "ld r4, 16(r2)\n" // stub's lr "li r5, 1\n" // 1 == 64 bit "bl _PPCCompilationCallbackC\n" "mtctr r3\n" // Restore all int arg registers -"ld r10, 200(r1)\n""ld r9, 192(r1)\n" -"ld r8, 184(r1)\n""ld r7, 176(r1)\n" -"ld r6, 168(r1)\n""ld r5, 160(r1)\n" -"ld r4, 152(r1)\n""ld r3, 144(r1)\n" +"ld r10, 272(r1)\n""ld r9, 264(r1)\n" +"ld r8, 256(r1)\n""ld r7, 248(r1)\n" +"ld r6, 240(r1)\n""ld r5, 232(r1)\n" +"ld r4, 224(r1)\n""ld r3, 216(r1)\n" // Restore all FP arg registers -"lfd f13, 136(r1)\n""lfd f12, 128(r1)\n" -"lfd f11, 120(r1)\n""lfd f10, 112(r1)\n" -"lfd f9, 104(r1)\n""lfd f8, 96(r1)\n" -"lfd f7, 88(r1)\n""lfd f6, 80(r1)\n" -"lfd f5, 72(r1)\n""lfd f4, 64(r1)\n" -"lfd f3, 56(r1)\n""lfd f2, 48(r1)\n" -"lfd f1, 40(r1)\n" +"lfd f13, 208(r1)\n""lfd f12, 200(r1)\n" +"lfd f11, 192(r1)\n""lfd f10, 184(r1)\n" +"lfd f9, 176(r1)\n""lfd f8, 168(r1)\n" +"lfd f7, 160(r1)\n""lfd f6, 152(r1)\n" +"lfd f5, 144(r1)\n""lfd f4, 136(r1)\n" +"lfd f3, 128(r1)\n""lfd f2, 120(r1)\n" +"lfd f1, 112(r1)\n" // Pop 3 frames off the stack and branch to target -"ld r1, 208(r1)\n" +"ld r1, 280(r1)\n" "ld r2, 16(r1)\n" "mtlr r2\n" "bctr\n" ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.111 -> 1.112 --- Log message: Implement correct constant folding of bitcast. This implements Transforms/ConstProp/bitcast.ll and fixes SingleSource/Regression/C/2003-10-12-GlobalVarInitializers --- Diffs of the changes: (+33 -15) ConstantFolding.cpp | 48 +--- 1 files changed, 33 insertions(+), 15 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.111 llvm/lib/VMCore/ConstantFolding.cpp:1.112 --- llvm/lib/VMCore/ConstantFolding.cpp:1.111 Sun Dec 10 20:16:58 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 11 12:30:27 2006 @@ -828,10 +828,6 @@ const Type *DestTy) { const Type *SrcTy = V->getType(); - // Handle some simple cases - if (SrcTy == DestTy) -return (Constant*)V; // no-op cast - if (isa(V)) return UndefValue::get(DestTy); @@ -901,6 +897,8 @@ return ConstantIntegral::get(DestTy, CI->getZExtValue()); return 0; case Instruction::BitCast: +if (SrcTy == DestTy) return (Constant*)V; // no-op cast + // Check to see if we are casting a pointer to an aggregate to a pointer to // the first element. If so, return the appropriate GEP instruction. if (const PointerType *PTy = dyn_cast(V->getType())) @@ -960,18 +958,38 @@ } } -// Handle sign conversion for integer no-op casts. We need to cast the -// value to the correct signedness before we try to cast it to the -// destination type. Be careful to do this only for integer types. -if (isa(V) && SrcTy->isInteger()) { - if (SrcTy->isSigned()) -V = ConstantInt::get(SrcTy->getUnsignedVersion(), - cast(V)->getZExtValue()); - else -V = ConstantInt::get(SrcTy->getSignedVersion(), - cast(V)->getSExtValue()); +// Finally, implement bitcast folding now. The code below doesn't handle +// bitcast right. +if (isa(V)) // ptr->ptr cast. + return ConstantPointerNull::get(cast(DestTy)); + +// Handle integral constant input. +if (const ConstantInt *CI = dyn_cast(V)) { + // Integral -> Integral, must be changing sign. + if (DestTy->isIntegral()) +return ConstantInt::get(DestTy, CI->getZExtValue()); + + if (DestTy->isFloatingPoint()) { +if (DestTy == Type::FloatTy) + return ConstantFP::get(DestTy, BitsToFloat(CI->getZExtValue())); +assert(DestTy == Type::DoubleTy && "Unknown FP type!"); +return ConstantFP::get(DestTy, BitsToDouble(CI->getZExtValue())); + } + // Otherwise, can't fold this (packed?) + return 0; } -break; + +// Handle ConstantFP input. +if (const ConstantFP *FP = dyn_cast(V)) { + // FP -> Integral. + if (DestTy->isIntegral()) { +if (DestTy == Type::FloatTy) + return ConstantInt::get(DestTy, FloatToBits(FP->getValue())); +assert(DestTy == Type::DoubleTy && "Unknown FP type!"); +return ConstantInt::get(DestTy, DoubleToBits(FP->getValue())); + } +} +return 0; default: assert(!"Invalid CE CastInst opcode"); break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Transforms/ConstProp/bitcast.ll
Changes in directory llvm/test/Regression/Transforms/ConstProp: bitcast.ll added (r1.1) --- Log message: constant folding of bitcast is broken. --- Diffs of the changes: (+4 -0) bitcast.ll |4 1 files changed, 4 insertions(+) Index: llvm/test/Regression/Transforms/ConstProp/bitcast.ll diff -c /dev/null llvm/test/Regression/Transforms/ConstProp/bitcast.ll:1.1 *** /dev/null Mon Dec 11 12:29:17 2006 --- llvm/test/Regression/Transforms/ConstProp/bitcast.llMon Dec 11 12:29:07 2006 *** *** 0 --- 1,4 + ; RUN: llvm-as < %s | llvm-dis && + ; RUN: llvm-as < %s | llvm-dis | grep 0x36A0 + + %A = global float bitcast (int 1 to float) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.242 -> 1.243 --- Log message: Missing opcode. --- Diffs of the changes: (+1 -0) PPCISelLowering.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.242 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.243 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.242 Sun Dec 10 17:12:42 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Mon Dec 11 12:45:56 2006 @@ -310,6 +310,7 @@ case PPCISD::VPERM: return "PPCISD::VPERM"; case PPCISD::Hi:return "PPCISD::Hi"; case PPCISD::Lo:return "PPCISD::Lo"; + case PPCISD::DYNALLOC: return "PPCISD::DYNALLOC"; case PPCISD::GlobalBaseReg: return "PPCISD::GlobalBaseReg"; case PPCISD::SRL: return "PPCISD::SRL"; case PPCISD::SRA: return "PPCISD::SRA"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.426 -> 1.427 --- Log message: Revert changes that broke oggenc on ppc --- Diffs of the changes: (+9 -14) LegalizeDAG.cpp | 23 +-- 1 files changed, 9 insertions(+), 14 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.426 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.427 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.426 Mon Dec 11 00:50:04 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 12:53:38 2006 @@ -1547,10 +1547,7 @@ if (Tmp2.getValueType() != MVT::Vector) { SDOperand Lo, Hi; ExpandOp(Tmp2, Lo, Hi); - if (Hi.Val) -Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi,Tmp3); - else -Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3); + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi, Tmp3); Result = LegalizeOp(Result); } else { SDNode *InVal = Tmp2.Val; @@ -1612,10 +1609,8 @@ ExpandOp(Node->getOperand(i), Lo, Hi); NewValues.push_back(Lo); NewValues.push_back(Node->getOperand(i+1)); - if (Hi.Val) { -NewValues.push_back(Hi); -NewValues.push_back(Node->getOperand(i+1)); - } + NewValues.push_back(Hi); + NewValues.push_back(Node->getOperand(i+1)); break; } case Promote: @@ -4572,10 +4567,12 @@ Tmp = TLI.LowerOperation(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp), DAG); } +MVT::ValueType NVT = Node->getValueType(0); // f32 / f64 must be expanded to i32 / i64. -if (VT == MVT::f32 || VT == MVT::f64) { - Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); - Hi = SDOperand(); +if (NVT == MVT::f32 || NVT == MVT::f64) { + Lo = DAG.getNode(ISD::BIT_CONVERT, TLI.getTypeToTransformTo(NVT), + Node->getOperand(0)); + Hi = DAG.getConstant(0, TLI.getTypeToTransformTo(NVT)); break; } @@ -4878,9 +4875,7 @@ // is a type that requires multi-step expansion. if (getTypeAction(NVT) != Expand && NVT != MVT::isVoid) { Lo = LegalizeOp(Lo); -if (Hi.Val) - // Don't legalize the high part if it is expanded to a single node. - Hi = LegalizeOp(Hi); +Hi = LegalizeOp(Hi); } // Remember in a map if the values will be reused later. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAGSimple.cpp updated: 1.20 -> 1.21 --- Log message: It seems the llvm::OStream class does not handle stream manipulators. For now, just grab the stream and perform the output on it directly. --- Diffs of the changes: (+7 -7) ScheduleDAGSimple.cpp | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.21 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Mon Dec 11 13:15:36 2006 @@ -713,13 +713,13 @@ void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const { #ifndef NDEBUG SDNode *Node = NI->Node; - O << " " -<< std::hex << Node << std::dec -<< ", Lat=" << NI->Latency -<< ", Slot=" << NI->Slot -<< ", ARITY=(" << Node->getNumOperands() << "," -<< Node->getNumValues() << ")" -<< " " << Node->getOperationName(&DAG); + *(O.stream()) << " " +<< std::hex << Node << std::dec +<< ", Lat=" << NI->Latency +<< ", Slot=" << NI->Slot +<< ", ARITY=(" << Node->getNumOperands() << "," +<< Node->getNumValues() << ")" +<< " " << Node->getOperationName(&DAG); if (isFlagDefiner(Node)) O << "<#"; if (isFlagUser(Node)) O << ">#"; #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.427 -> 1.428 --- Log message: Re-apply changes that were backed out and fix a naughty typo. --- Diffs of the changes: (+15 -10) LegalizeDAG.cpp | 25 +++-- 1 files changed, 15 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.427 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.428 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.427 Mon Dec 11 12:53:38 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 13:27:14 2006 @@ -1547,7 +1547,10 @@ if (Tmp2.getValueType() != MVT::Vector) { SDOperand Lo, Hi; ExpandOp(Tmp2, Lo, Hi); - Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi, Tmp3); + if (Hi.Val) +Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi,Tmp3); + else +Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3); Result = LegalizeOp(Result); } else { SDNode *InVal = Tmp2.Val; @@ -1609,8 +1612,10 @@ ExpandOp(Node->getOperand(i), Lo, Hi); NewValues.push_back(Lo); NewValues.push_back(Node->getOperand(i+1)); - NewValues.push_back(Hi); - NewValues.push_back(Node->getOperand(i+1)); + if (Hi.Val) { +NewValues.push_back(Hi); +NewValues.push_back(Node->getOperand(i+1)); + } break; } case Promote: @@ -4567,18 +4572,16 @@ Tmp = TLI.LowerOperation(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp), DAG); } -MVT::ValueType NVT = Node->getValueType(0); // f32 / f64 must be expanded to i32 / i64. -if (NVT == MVT::f32 || NVT == MVT::f64) { - Lo = DAG.getNode(ISD::BIT_CONVERT, TLI.getTypeToTransformTo(NVT), - Node->getOperand(0)); - Hi = DAG.getConstant(0, TLI.getTypeToTransformTo(NVT)); +if (VT == MVT::f32 || VT == MVT::f64) { + Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); + Hi = SDOperand(); break; } // Turn this into a load/store pair by default. if (Tmp.Val == 0) - Tmp = ExpandBIT_CONVERT(NVT, Node->getOperand(0)); + Tmp = ExpandBIT_CONVERT(VT, Node->getOperand(0)); ExpandOp(Tmp, Lo, Hi); break; @@ -4875,7 +4878,9 @@ // is a type that requires multi-step expansion. if (getTypeAction(NVT) != Expand && NVT != MVT::isVoid) { Lo = LegalizeOp(Lo); -Hi = LegalizeOp(Hi); +if (Hi.Val) + // Don't legalize the high part if it is expanded to a single node. + Hi = LegalizeOp(Hi); } // Remember in a map if the values will be reused later. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
Hi John, Could you please file a bug on this and assign it to me? Thanks! -bw On Dec 11, 2006, at 11:16 AM, John Criswell wrote: > > > Changes in directory llvm/lib/CodeGen/SelectionDAG: > > ScheduleDAGSimple.cpp updated: 1.20 -> 1.21 > --- > Log message: > > It seems the llvm::OStream class does not handle stream manipulators. > For now, just grab the stream and perform the output on it directly. > > > --- > Diffs of the changes: (+7 -7) > > ScheduleDAGSimple.cpp | 14 +++--- > 1 files changed, 7 insertions(+), 7 deletions(-) > > > Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp > diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20 > llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.21 > --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20 Thu > Dec 7 14:04:42 2006 > +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Mon Dec 11 > 13:15:36 2006 > @@ -713,13 +713,13 @@ > void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const { > #ifndef NDEBUG >SDNode *Node = NI->Node; > - O << " " > -<< std::hex << Node << std::dec > -<< ", Lat=" << NI->Latency > -<< ", Slot=" << NI->Slot > -<< ", ARITY=(" << Node->getNumOperands() << "," > -<< Node->getNumValues() << ")" > -<< " " << Node->getOperationName(&DAG); > + *(O.stream()) << " " > +<< std::hex << Node << std::dec > +<< ", Lat=" << NI->Latency > +<< ", Slot=" << NI->Slot > +<< ", ARITY=(" << Node->getNumOperands() << "," > +<< Node->getNumValues() << ")" > +<< " " << Node->getOperationName(&DAG); >if (isFlagDefiner(Node)) O << "<#"; >if (isFlagUser(Node)) O << ">#"; > #endif > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c
Changes in directory llvm-test/SingleSource/UnitTests: 2006-12-11-LoadConstants.c added (r1.1) --- Log message: Loading constants properly test. --- Diffs of the changes: (+189 -0) 2006-12-11-LoadConstants.c | 189 + 1 files changed, 189 insertions(+) Index: llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c diff -c /dev/null llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.1 *** /dev/null Mon Dec 11 14:22:54 2006 --- llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c Mon Dec 11 14:22:44 2006 *** *** 0 --- 1,189 + #include + + long zz() { return 0xL; } + long zs() { return 0xL; } + long zu() { return 0x7fffL; } + long sz() { return 0xL; } + long ss() { return 0xL; } + long su() { return 0x7fffL; } + long uz() { return 0x7fffL; } + long us() { return 0x7fffL; } + long uu() { return 0x7fff7fffL; } + + long long () { return 0xLL; } + long long zzzs() { return 0xLL; } + long long zzzu() { return 0x7fffLL; } + long long zzsz() { return 0xLL; } + long long zzss() { return 0xLL; } + long long zzsu() { return 0x7fffLL; } + long long zzuz() { return 0x7fffLL; } + long long zzus() { return 0x7fffLL; } + long long zzuu() { return 0x7fff7fffLL; } + long long zszz() { return 0xLL; } + long long zszs() { return 0xLL; } + long long zszu() { return 0x7fffLL; } + long long zssz() { return 0xLL; } + long long zsss() { return 0xLL; } + long long zssu() { return 0x7fffLL; } + long long zsuz() { return 0x7fffLL; } + long long zsus() { return 0x7fffLL; } + long long zsuu() { return 0x7fff7fffLL; } + long long zuzz() { return 0x7fffLL; } + long long zuzs() { return 0x7fffLL; } + long long zuzu() { return 0x7fff7fffLL; } + long long zusz() { return 0x7fffLL; } + long long zuss() { return 0x7fffLL; } + long long zusu() { return 0x7fff7fffLL; } + long long zuuz() { return 0x7fff7fffLL; } + long long zuus() { return 0x7fff7fffLL; } + long long zuuu() { return 0x7fff7fff7fffLL; } + long long szzz() { return 0xLL; } + long long szzs() { return 0xLL; } + long long szzu() { return 0x7fffLL; } + long long szsz() { return 0xLL; } + long long szss() { return 0xLL; } + long long szsu() { return 0x7fffLL; } + long long szuz() { return 0x7fffLL; } + long long szus() { return 0x7fffLL; } + long long szuu() { return 0x7fff7fffLL; } + long long sszz() { return 0xLL; } + long long sszs() { return 0xLL; } + long long sszu() { return 0x7fffLL; } + long long sssz() { return 0xLL; } + long long () { return 0xLL; } + long long sssu() { return 0x7fffLL; } + long long ssuz() { return 0x7fffLL; } + long long ssus() { return 0x7fffLL; } + long long ssuu() { return 0x7fff7fffLL; } + long long suzz() { return 0x7fffLL; } + long long suzs() { return 0x7fffLL; } + long long suzu() { return 0x7fff7fffLL; } + long long susz() { return 0x7fffLL; } + long long suss() { return 0x7fffLL; } + long long susu() { return 0x7fff7fffLL; } + long long suuz() { return 0x7fff7fffLL; } + long long suus() { return 0x7fff7fffLL; } + long long suuu() { return 0x7fff7fff7fffLL; } + long long uzzz() { return 0x7fffLL; } + long long uzzs() { return 0x7fffLL; } + long long uzzu() { return 0x7fff7fffLL; } + long long uzsz() { return 0x7fffLL; } + long long uzss() { return 0x7fffLL; } + long long uzsu() { return 0x7fff7fffLL; } + long long uzuz() { return 0x7fff7fffLL; } + long long uzus() { return 0x7fff7fffLL; } + long long uzuu() { return 0x7fff7fff7fffLL; } + long long uszz() { return 0x7fffLL; } + long long uszs() { return 0x7fffLL; } + long long uszu() { return 0x7fff7fffLL; } + long long ussz() { return 0x7fffLL; } + long long usss() { return 0x7fffLL; } + long long ussu() { return 0x7fff7fffLL; } + long long usuz() { return 0x7fff7fffLL; } + long long usus() { return 0x7fff7fffLL; } + long long usuu() { return 0x7fff7fff7fffLL; } + long long uuzz() { return 0x7fff7fffLL; } + long long uuzs() { return 0x7fff7fffLL; } + long long uuzu() { return 0x7fff7fff7fffLL; } + long long uusz() { return 0x7fff7fffLL; } + long long uuss() { return 0x7fff7fffLL; } + long long uusu() { re
[llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll
Changes in directory llvm/test/Regression/CodeGen/CBackend: 2006-12-11-Float-Bitcast.ll added (r1.1) --- Log message: Provide a test for int<->float and long<->double bitcasts. --- Diffs of the changes: (+48 -0) 2006-12-11-Float-Bitcast.ll | 48 1 files changed, 48 insertions(+) Index: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll diff -c /dev/null llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.1 *** /dev/null Mon Dec 11 14:40:38 2006 --- llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll Mon Dec 11 14:40:28 2006 *** *** 0 --- 1,48 + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=c && + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep '__BITCAST' | wc -l | grep 14 + + int %test1(float %F) { +%X = bitcast float %F to int +ret int %X + } + + float %test2(int %I) { + %X = bitcast int %I to float + ret float %X + } + + long %test3(double %D) { + %X = bitcast double %D to long + ret long %X + } + + double %test4(long %L) { + %X = bitcast long %L to double + ret double %X + } + + double %test5(double %D) { + %X = bitcast double %D to double + %Y = add double %X, 2.0 + %Z = bitcast double %Y to long + %res = bitcast long %Z to double + ret double %res + } + + float %test6(float %F) { + %X = bitcast float %F to float + %Y = add float %X, 2.0 + %Z = bitcast float %Y to int + %res = bitcast int %Z to float + ret float %res + } + + int %main(int %argc, sbyte** %argv) { + %a = call int %test1(float 3.1415926) + %b = call float %test2(int %a) + %c = call long %test3(double 3.1415926) + %d = call double %test4(long %c) + %e = call double %test5(double 7.0) + %f = call float %test6(float 7.0) + ret int %a + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.295 -> 1.296 --- Log message: Implement correct bitcast of int<->float and long<->double by using a union to perform the bitcast. --- Diffs of the changes: (+58 -14) Writer.cpp | 72 + 1 files changed, 58 insertions(+), 14 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.295 llvm/lib/Target/CBackend/Writer.cpp:1.296 --- llvm/lib/Target/CBackend/Writer.cpp:1.295 Sun Dec 10 17:12:42 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Dec 11 14:39:15 2006 @@ -169,7 +169,7 @@ // Must not be used in inline asm if (I.hasOneUse() && isInlineAsm(*I.use_back())) return false; - // Only inline instruction it it's use is in the same BB as the inst. + // Only inline instruction it if it's use is in the same BB as the inst. return I.getParent() == cast(I.use_back())->getParent(); } @@ -1508,6 +1508,16 @@ /// type name is found, emit its declaration... /// void CWriter::printModuleTypes(const SymbolTable &ST) { + Out << "/* Helper union for bitcasts */\n"; + Out << "typedef union {\n"; + Out << " unsigned int UInt;\n"; + Out << "signed int SInt;\n"; + Out << " unsigned long ULong;\n"; + Out << "signed long SLong;\n"; + Out << " float Float;\n"; + Out << " double Double;\n"; + Out << "} llvmBitCastUnion;\n"; + // We are only interested in the type plane of the symbol table. SymbolTable::type_const_iterator I = ST.type_begin(); SymbolTable::type_const_iterator End = ST.type_end(); @@ -1704,6 +1714,15 @@ Out << ";\n"; } PrintedVar = true; +} else if (isa(*I) && + ((I->getType()->isFloatingPoint() && + I->getOperand(0)->getType()->isInteger()) || +(I->getType()->isInteger() && + I->getOperand(0)->getType()->isFloatingPoint( { + // We need a temporary for the BitCast to use so it can pluck a + // value out of a union to do the BitCast. + Out << " llvmBitCastUnion " << Mang->getValueName(&*I) + << "__BITCAST_TEMPORARY;\n"; } if (PrintedVar) @@ -1986,23 +2005,48 @@ } } +static const char * getFloatBitCastField(const Type *Ty) { + switch (Ty->getTypeID()) { +default: assert(0 && "Invalid Type"); +case Type::FloatTyID: return "Float"; +case Type::UIntTyID: return "UInt"; +case Type::IntTyID: return "SInt"; +case Type::DoubleTyID:return "Double"; +case Type::ULongTyID: return "ULong"; +case Type::LongTyID: return "SLong"; + } +} + void CWriter::visitCastInst(CastInst &I) { const Type *DstTy = I.getType(); const Type *SrcTy = I.getOperand(0)->getType(); Out << '('; - printCast(I.getOpcode(), SrcTy, DstTy); - if (I.getOpcode() == Instruction::SExt && SrcTy == Type::BoolTy) { -// Make sure we really get a sext from bool by subtracing the bool from 0 -Out << "0-"; - } - writeOperand(I.getOperand(0)); - if (DstTy == Type::BoolTy && - (I.getOpcode() == Instruction::Trunc || - I.getOpcode() == Instruction::FPToUI || - I.getOpcode() == Instruction::FPToSI || - I.getOpcode() == Instruction::PtrToInt)) { -// Make sure we really get a trunc to bool by anding the operand with 1 -Out << "&1u"; + if (isa(I) && + ((I.getType()->isFloatingPoint() && +I.getOperand(0)->getType()->isInteger()) || + (I.getType()->isInteger() && +I.getOperand(0)->getType()->isFloatingPoint( { +// These int<->float and long<->double casts need to be handled specially +Out << Mang->getValueName(&I) << "__BITCAST_TEMPORARY." +<< getFloatBitCastField(I.getOperand(0)->getType()) << " = "; +writeOperand(I.getOperand(0)); +Out << ", " << Mang->getValueName(&I) << "__BITCAST_TEMPORARY." +<< getFloatBitCastField(I.getType()); + } else { +printCast(I.getOpcode(), SrcTy, DstTy); +if (I.getOpcode() == Instruction::SExt && SrcTy == Type::BoolTy) { + // Make sure we really get a sext from bool by subtracing the bool from 0 + Out << "0-"; +} +writeOperand(I.getOperand(0)); +if (DstTy == Type::BoolTy && +(I.getOpcode() == Instruction::Trunc || + I.getOpcode() == Instruction::FPToUI || + I.getOpcode() == Instruction::FPToSI || + I.getOpcode() == Instruction::PtrToInt)) { + // Make sure we really get a trunc to bool by anding the operand with 1 + Out << "&1u"; +} } Out << ')'; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Feature/fold-fpcast.ll
Changes in directory llvm/test/Feature: fold-fpcast.ll added (r1.1) --- Log message: Add a test for constant folding of bitcast to/from floating point. --- Diffs of the changes: (+18 -0) fold-fpcast.ll | 18 ++ 1 files changed, 18 insertions(+) Index: llvm/test/Feature/fold-fpcast.ll diff -c /dev/null llvm/test/Feature/fold-fpcast.ll:1.1 *** /dev/null Mon Dec 11 15:25:20 2006 --- llvm/test/Feature/fold-fpcast.llMon Dec 11 15:25:10 2006 *** *** 0 --- 1,18 + ; RUN: llvm-as < %s | llvm-dis | not grep bitcast + + int %test1() { +ret int bitcast(float 3.7 to int) + } + + float %test2() { + ret float bitcast(int 17 to float) + } + + long %test3() { + ret long bitcast (double 3.1415926 to long) + } + + double %test4() { + ret double bitcast (long 42 to double) + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Thanks Reid! -Chris On Dec 11, 2006, at 1:27 PM, Reid Spencer wrote: > > > Changes in directory llvm/lib/VMCore: > > ConstantFolding.cpp updated: 1.112 -> 1.113 > --- > Log message: > > Fix constant folding of FP->int due to cut & paste error in last > commit. > > > --- > Diffs of the changes: (+3 -2) > > ConstantFolding.cpp |5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > > Index: llvm/lib/VMCore/ConstantFolding.cpp > diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.112 llvm/lib/VMCore/ > ConstantFolding.cpp:1.113 > --- llvm/lib/VMCore/ConstantFolding.cpp:1.112 Mon Dec 11 12:30:27 2006 > +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 11 15:27:28 2006 > @@ -983,9 +983,10 @@ > if (const ConstantFP *FP = dyn_cast(V)) { >// FP -> Integral. >if (DestTy->isIntegral()) { > -if (DestTy == Type::FloatTy) > +if (DestTy == Type::IntTy || DestTy == Type::UIntTy) >return ConstantInt::get(DestTy, FloatToBits(FP->getValue > ())); > -assert(DestTy == Type::DoubleTy && "Unknown FP type!"); > +assert((DestTy == Type::LongTy || DestTy == Type::ULongTy) > + && "Incorrect integer type for bitcast!"); > return ConstantInt::get(DestTy, DoubleToBits(FP->getValue > ())); >} > } > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.112 -> 1.113 --- Log message: Fix constant folding of FP->int due to cut & paste error in last commit. --- Diffs of the changes: (+3 -2) ConstantFolding.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.112 llvm/lib/VMCore/ConstantFolding.cpp:1.113 --- llvm/lib/VMCore/ConstantFolding.cpp:1.112 Mon Dec 11 12:30:27 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 11 15:27:28 2006 @@ -983,9 +983,10 @@ if (const ConstantFP *FP = dyn_cast(V)) { // FP -> Integral. if (DestTy->isIntegral()) { -if (DestTy == Type::FloatTy) +if (DestTy == Type::IntTy || DestTy == Type::UIntTy) return ConstantInt::get(DestTy, FloatToBits(FP->getValue())); -assert(DestTy == Type::DoubleTy && "Unknown FP type!"); +assert((DestTy == Type::LongTy || DestTy == Type::ULongTy) + && "Incorrect integer type for bitcast!"); return ConstantInt::get(DestTy, DoubleToBits(FP->getValue())); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCSubtarget.h
Changes in directory llvm/lib/Target/PowerPC: PPCSubtarget.h updated: 1.17 -> 1.18 --- Log message: getInstrItineraryData shouldn't copy the itineraries --- Diffs of the changes: (+1 -1) PPCSubtarget.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCSubtarget.h diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.17 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.18 --- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.17 Fri Jul 14 20:24:23 2006 +++ llvm/lib/Target/PowerPC/PPCSubtarget.h Mon Dec 11 15:42:55 2006 @@ -57,7 +57,7 @@ /// getInstrItins - Return the instruction itineraies based on subtarget /// selection. - const InstrItineraryData getInstrItineraryData() const { return InstrItins; } + const InstrItineraryData &getInstrItineraryData() const { return InstrItins; } /// getTargetDataString - Return the pointer size and type alignment /// properties of this subtarget. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.212 -> 1.213 --- Log message: Create the cast constant expression that was read instead of attempting to infer the cast from its operand and type. This fixes: test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll --- Diffs of the changes: (+2 -1) Reader.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.212 llvm/lib/Bytecode/Reader/Reader.cpp:1.213 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.212 Fri Dec 8 12:06:15 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Dec 11 17:20:20 2006 @@ -1325,7 +1325,8 @@ if (!Instruction::isCast(Opcode)) error("Only cast instruction has one argument for ConstantExpr"); - Constant *Result = ConstantExpr::getCast(ArgVec[0], getType(TypeID)); + Constant *Result = ConstantExpr::getCast(Opcode, ArgVec[0], + getType(TypeID)); if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result); return Result; } else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp PPCISelLowering.cpp PPCSubtarget.cpp PPCSubtarget.h PPCTargetMachine.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCCodeEmitter.cpp updated: 1.72 -> 1.73 PPCISelLowering.cpp updated: 1.243 -> 1.244 PPCSubtarget.cpp updated: 1.26 -> 1.27 PPCSubtarget.h updated: 1.18 -> 1.19 PPCTargetMachine.cpp updated: 1.109 -> 1.110 --- Log message: Another step forward in PPC64 JIT support: we now no-longer need stubs emitted for external globals in PPC64-JIT-PIC mode (which is good because we didn't handle them before!). This also fixes a bug handling the picbase delta, which we would get wrong in some cases. --- Diffs of the changes: (+83 -33) PPCCodeEmitter.cpp | 52 +++ PPCISelLowering.cpp |3 -- PPCSubtarget.cpp | 38 + PPCSubtarget.h | 18 +++-- PPCTargetMachine.cpp |5 +++- 5 files changed, 83 insertions(+), 33 deletions(-) Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.72 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.73 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.72 Thu Dec 7 22:54:03 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Mon Dec 11 17:22:44 2006 @@ -136,15 +136,9 @@ if (MI.getOpcode() == PPC::BL || MI.getOpcode() == PPC::BL8) Reloc = PPC::reloc_pcrel_bx; else { - // If in PIC mode, we need to encode the negated address of the - // 'movepctolr' into the unrelocated field. After relocation, we'll have - // &gv-&movepctolr in the imm field. Once &movepctolr is added to the imm - // field, we get &gv. if (TM.getRelocationModel() == Reloc::PIC_) { assert(MovePCtoLROffset && "MovePCtoLR not seen yet?"); -rv = -(intptr_t)MovePCtoLROffset - 4; } - switch (MI.getOpcode()) { default: MI.dump(); assert(0 && "Unknown instruction for relocation!"); case PPC::LIS: @@ -152,7 +146,6 @@ case PPC::ADDIS: case PPC::ADDIS8: Reloc = PPC::reloc_absolute_high; // Pointer to symbol -rv >>= 16; break; case PPC::LI: case PPC::LI8: @@ -173,7 +166,6 @@ case PPC::STFS: case PPC::STFD: Reloc = PPC::reloc_absolute_low; -rv &= 0x; break; case PPC::LWA: @@ -181,25 +173,37 @@ case PPC::STD: case PPC::STD_32: Reloc = PPC::reloc_absolute_low_ix; -rv &= 0x; -rv >>= 2; break; } } -if (MO.isGlobalAddress()) - MCE.addRelocation(MachineRelocation::getGV(MCE.getCurrentPCOffset(), - Reloc, MO.getGlobal(), 0)); -else if (MO.isExternalSymbol()) - MCE.addRelocation(MachineRelocation::getExtSym(MCE.getCurrentPCOffset(), - Reloc, MO.getSymbolName(), 0)); -else if (MO.isConstantPoolIndex()) - MCE.addRelocation(MachineRelocation::getConstPool( - MCE.getCurrentPCOffset(), - Reloc, MO.getConstantPoolIndex(), 0)); -else // isJumpTableIndex - MCE.addRelocation(MachineRelocation::getJumpTable( - MCE.getCurrentPCOffset(), - Reloc, MO.getJumpTableIndex(), 0)); + +MachineRelocation R; +if (MO.isGlobalAddress()) { + R = MachineRelocation::getGV(MCE.getCurrentPCOffset(), Reloc, + MO.getGlobal(), 0); +} else if (MO.isExternalSymbol()) { + R = MachineRelocation::getExtSym(MCE.getCurrentPCOffset(), + Reloc, MO.getSymbolName(), 0); +} else if (MO.isConstantPoolIndex()) { + R = MachineRelocation::getConstPool(MCE.getCurrentPCOffset(), + Reloc, MO.getConstantPoolIndex(), 0); +} else { + assert(MO.isJumpTableIndex()); + R = MachineRelocation::getJumpTable(MCE.getCurrentPCOffset(), + Reloc, MO.getJumpTableIndex(), 0); +} + +// If in PIC mode, we need to encode the negated address of the +// 'movepctolr' into the unrelocated field. After relocation, we'll have +// &gv-&movepctolr-4 in the imm field. Once &movepctolr is added to the imm +// field, we get &gv. This doesn't happen for branch relocations, which are +// always implicitly pc relative. +if (TM.getRelocationModel() == Reloc::PIC_ && Reloc != PPC::reloc_pcrel_bx){ + assert(MovePCtoLROffset && "MovePCtoLR not seen yet?"); + R.setConstantVal(-(intptr_t)MovePCtoLROffset - 4); +} +MCE.addRelocation(R); + } else if (MO.isMachineBasicBlock()) { unsigned Reloc = 0; unsigned Opcode = MI.getOpcode(); Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.243 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.244 --- ll
[llvm-commits] CVS: llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll
Changes in directory llvm/test/Regression/Bytecode: 2006-12-11-Cast-ConstExpr.ll added (r1.1) --- Log message: Test case for ensuring correct reading back of cast constant expressions. --- Diffs of the changes: (+8 -0) 2006-12-11-Cast-ConstExpr.ll |8 1 files changed, 8 insertions(+) Index: llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll diff -c /dev/null llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll:1.1 *** /dev/null Mon Dec 11 17:20:03 2006 --- llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll Mon Dec 11 17:19:53 2006 *** *** 0 --- 1,8 + ; This test ensures that we get a bitcast constant expression in and out, + ; not a sitofp constant expression. + ; RUN: llvm-as < %s | llvm-dis | grep 'bitcast (' + %G = external global int + + float %tryit(int %A) { +ret float bitcast( int ptrtoint (int* %G to int) to float) + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
> Create the cast constant expression that was read instead of > attempting > to infer the cast from its operand and type. This fixes: > test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll Is there any hope that that getCast method will go away soon? -Chris > > --- > Diffs of the changes: (+2 -1) > > Reader.cpp |3 ++- > 1 files changed, 2 insertions(+), 1 deletion(-) > > > Index: llvm/lib/Bytecode/Reader/Reader.cpp > diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.212 llvm/lib/Bytecode/ > Reader/Reader.cpp:1.213 > --- llvm/lib/Bytecode/Reader/Reader.cpp:1.212 Fri Dec 8 12:06:15 2006 > +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Dec 11 17:20:20 2006 > @@ -1325,7 +1325,8 @@ >if (!Instruction::isCast(Opcode)) > error("Only cast instruction has one argument for > ConstantExpr"); > > - Constant *Result = ConstantExpr::getCast(ArgVec[0], getType > (TypeID)); > + Constant *Result = ConstantExpr::getCast(Opcode, ArgVec[0], > + getType(TypeID)); >if (Handler) Handler->handleConstantExpression(Opcode, > ArgVec, Result); >return Result; > } else if (Opcode == Instruction::GetElementPtr) { // > GetElementPtr > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
> Implement correct bitcast of int<->float and long<->double by using a > union to perform the bitcast. > @@ -1508,6 +1508,16 @@ > /// type name is found, emit its declaration... > /// > void CWriter::printModuleTypes(const SymbolTable &ST) { > + Out << "/* Helper union for bitcasts */\n"; > + Out << "typedef union {\n"; > + Out << " unsigned int UInt;\n"; > + Out << "signed int SInt;\n"; > + Out << " unsigned long ULong;\n"; > + Out << "signed long SLong;\n"; > + Out << " float Float;\n"; > + Out << " double Double;\n"; > + Out << "} llvmBitCastUnion;\n" This is wrong for 32-bit targets. ULong should be 'unsigned long long'. SLong should be 'signed long long'. Thanks Reid, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/README.txt
Changes in directory llvm/lib/Target/ARM: README.txt updated: 1.8 -> 1.9 --- Log message: add note --- Diffs of the changes: (+13 -0) README.txt | 13 + 1 files changed, 13 insertions(+) Index: llvm/lib/Target/ARM/README.txt diff -u llvm/lib/Target/ARM/README.txt:1.8 llvm/lib/Target/ARM/README.txt:1.9 --- llvm/lib/Target/ARM/README.txt:1.8 Tue Oct 17 08:36:07 2006 +++ llvm/lib/Target/ARM/README.txt Mon Dec 11 17:56:10 2006 @@ -27,6 +27,19 @@ mov r1, r1, lsl r2 add r0, r1, r0 +- +%tmp1 = shl int %b, ubyte 4 +%tmp2 = add int %a, %tmp1 + +compiles to + +mov r2, #4 +add r0, r0, r1, lsl r2 + +should be + +add r0, r0, r1, lsl #4 + -- add an offset to FLDS/FLDD/FSTD/FSTS addressing mode ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
On Mon, 2006-12-11 at 15:23 -0800, Chris Lattner wrote: > > Create the cast constant expression that was read instead of > > attempting > > to infer the cast from its operand and type. This fixes: > > test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll > > Is there any hope that that getCast method will go away soon? My focus this week is cleanup. I'm starting with the 63 getCast calls. This was the first. I'm about to commit CodeGen/AsmPrinter.cpp. Next up is createInferredCast. Then I'll be looking for useless bitcasts, and etc. Reid > > -Chris > > > > > --- > > Diffs of the changes: (+2 -1) > > > > Reader.cpp |3 ++- > > 1 files changed, 2 insertions(+), 1 deletion(-) > > > > > > Index: llvm/lib/Bytecode/Reader/Reader.cpp > > diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.212 llvm/lib/Bytecode/ > > Reader/Reader.cpp:1.213 > > --- llvm/lib/Bytecode/Reader/Reader.cpp:1.212 Fri Dec 8 12:06:15 2006 > > +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Dec 11 17:20:20 2006 > > @@ -1325,7 +1325,8 @@ > >if (!Instruction::isCast(Opcode)) > > error("Only cast instruction has one argument for > > ConstantExpr"); > > > > - Constant *Result = ConstantExpr::getCast(ArgVec[0], getType > > (TypeID)); > > + Constant *Result = ConstantExpr::getCast(Opcode, ArgVec[0], > > + getType(TypeID)); > >if (Handler) Handler->handleConstantExpression(Opcode, > > ArgVec, Result); > >return Result; > > } else if (Opcode == Instruction::GetElementPtr) { // > > GetElementPtr > > > > > > > > ___ > > llvm-commits mailing list > > llvm-commits@cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.296 -> 1.297 --- Log message: Fix the BitCastUnion type for 32-bit targets. --- Diffs of the changes: (+6 -6) Writer.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.296 llvm/lib/Target/CBackend/Writer.cpp:1.297 --- llvm/lib/Target/CBackend/Writer.cpp:1.296 Mon Dec 11 14:39:15 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Dec 11 18:11:08 2006 @@ -1510,12 +1510,12 @@ void CWriter::printModuleTypes(const SymbolTable &ST) { Out << "/* Helper union for bitcasts */\n"; Out << "typedef union {\n"; - Out << " unsigned int UInt;\n"; - Out << "signed int SInt;\n"; - Out << " unsigned long ULong;\n"; - Out << "signed long SLong;\n"; - Out << " float Float;\n"; - Out << " double Double;\n"; + Out << " unsigned int UInt;\n"; + Out << " signed int SInt;\n"; + Out << " unsigned long long ULong;\n"; + Out << " signed long long SLong;\n"; + Out << " float Float;\n"; + Out << " double Double;\n"; Out << "} llvmBitCastUnion;\n"; // We are only interested in the type plane of the symbol table. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
On Dec 11, 2006, at 3:56 PM, Reid Spencer wrote: > On Mon, 2006-12-11 at 15:23 -0800, Chris Lattner wrote: >>> Create the cast constant expression that was read instead of >>> attempting >>> to infer the cast from its operand and type. This fixes: >>> test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll >> >> Is there any hope that that getCast method will go away soon? > > My focus this week is cleanup. I'm starting with the 63 getCast calls. > This was the first. I'm about to commit CodeGen/AsmPrinter.cpp. > Next up > is createInferredCast. Then I'll be looking for useless bitcasts, and > etc. Sounds great, thanks Reid! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.td
Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.76 -> 1.77 --- Log message: add mvn --- Diffs of the changes: (+3 -0) ARMInstrInfo.td |3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.76 llvm/lib/Target/ARM/ARMInstrInfo.td:1.77 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.76Fri Dec 8 12:41:21 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Mon Dec 11 18:37:38 2006 @@ -190,6 +190,9 @@ def MOV : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), "mov $dst, $src", [(set IntRegs:$dst, addr_mode1:$src)]>; +def MVN : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), + "mvn $dst, $src", [(set IntRegs:$dst, (not addr_mode1:$src))]>; + def ADD : Addr1BinOp<"add", add>; def ADCS: Addr1BinOp<"adcs", adde>; def ADDS: Addr1BinOp<"adds", addc>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/mvn.ll
Changes in directory llvm/test/Regression/CodeGen/ARM: mvn.ll added (r1.1) --- Log message: add mvn --- Diffs of the changes: (+55 -0) mvn.ll | 55 +++ 1 files changed, 55 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/mvn.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/mvn.ll:1.1 *** /dev/null Mon Dec 11 18:37:48 2006 --- llvm/test/Regression/CodeGen/ARM/mvn.ll Mon Dec 11 18:37:38 2006 *** *** 0 --- 1,55 + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 4 + + ;int %f1() { + ;entry: + ; ret int -1 + ;} + + int %f2(int %a) { + entry: + %tmpnot = xor int %a, -1; [#uses=1] + ret int %tmpnot + } + + ;int %f3(int %a) { + ;entry: + ; %tmp1 = shl int %a, ubyte 2 ; [#uses=1] + ; %tmp1not = xor int %tmp1, -1; [#uses=1] + ; ret int %tmp1not + ;} + + int %f4(int %a, ubyte %b) { + entry: + %tmp3 = shl int %a, ubyte %b; [#uses=1] + %tmp3not = xor int %tmp3, -1; [#uses=1] + ret int %tmp3not + } + + ;uint %f5(uint %a) { + ;entry: + ; %tmp1 = lshr uint %a, ubyte 2 ; [#uses=1] + ; %tmp1not = xor uint %tmp1, 4294967295 ; [#uses=1] + ; ret uint %tmp1not + ;} + + uint %f6(uint %a, ubyte %b) { + entry: + %tmp2 = lshr uint %a, ubyte %b ; [#uses=1] + %tmp2not = xor uint %tmp2, 4294967295 ; [#uses=1] + ret uint %tmp2not + } + + ;int %f7(int %a) { + ;entry: + ; %tmp1 = ashr int %a, ubyte 2; [#uses=1] + ; %tmp1not = xor int %tmp1, -1; [#uses=1] + ; ret int %tmp1not + ;} + + int %f8(int %a, ubyte %b) { + entry: + %tmp3 = ashr int %a, ubyte %b ; [#uses=1] + %tmp3not = xor int %tmp3, -1; [#uses=1] + ret int %tmp3not + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp
Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.54 -> 1.55 --- Log message: Implement createIntegerCast and createFPCast factory methods for handling integer and floating point cast creation. createIntegerCast generates ZExt/SExt, BitCast or Trunc. createFPCast generates FPExt, Bitcast, or FPTrunc. --- Diffs of the changes: (+52 -0) Instructions.cpp | 52 1 files changed, 52 insertions(+) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.54 llvm/lib/VMCore/Instructions.cpp:1.55 --- llvm/lib/VMCore/Instructions.cpp:1.54 Wed Dec 6 22:18:31 2006 +++ llvm/lib/VMCore/Instructions.cppMon Dec 11 18:49:44 2006 @@ -1580,6 +1580,58 @@ return create(Instruction::BitCast, S, Ty, Name, InsertBefore); } +CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty, + bool isSigned, const std::string &Name, + Instruction *InsertBefore) { + assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = +(SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::Trunc : + (isSigned ? Instruction::SExt : Instruction::ZExt))); + return create(opcode, C, Ty, Name, InsertBefore); +} + +CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty, + bool isSigned, const std::string &Name, + BasicBlock *InsertAtEnd) { + assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = +(SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::Trunc : + (isSigned ? Instruction::SExt : Instruction::ZExt))); + return create(opcode, C, Ty, Name, InsertAtEnd); +} + +CastInst *CastInst::createFPCast(Value *C, const Type *Ty, + const std::string &Name, + Instruction *InsertBefore) { + assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() && + "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = +(SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + return create(opcode, C, Ty, Name, InsertBefore); +} + +CastInst *CastInst::createFPCast(Value *C, const Type *Ty, + const std::string &Name, + BasicBlock *InsertAtEnd) { + assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() && + "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = +(SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + return create(opcode, C, Ty, Name, InsertAtEnd); +} + // Provide a way to get a "cast" where the cast opcode is inferred from the // types and size of the operand. This, basically, is a parallel of the // logic in the checkCast function below. This axiom should hold: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h
Changes in directory llvm/include/llvm: InstrTypes.h updated: 1.53 -> 1.54 --- Log message: Implement createIntegerCast and createFPCast factory methods for handling integer and floating point cast creation. createIntegerCast generates ZExt/SExt, BitCast or Trunc. createFPCast generates FPExt, Bitcast, or FPTrunc. --- Diffs of the changes: (+34 -0) InstrTypes.h | 34 ++ 1 files changed, 34 insertions(+) Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.53 llvm/include/llvm/InstrTypes.h:1.54 --- llvm/include/llvm/InstrTypes.h:1.53 Wed Dec 6 22:18:31 2006 +++ llvm/include/llvm/InstrTypes.h Mon Dec 11 18:49:44 2006 @@ -339,6 +339,40 @@ Instruction *InsertBefore = 0 ///< Place to insert the instruction ); + /// @brief Create a ZExt, BitCast, or Trunc for int -> int casts. + static CastInst *createIntegerCast( +Value *S,///< The pointer value to be casted (operand 0) +const Type *Ty, ///< The type to which cast should be made +bool isSigned, ///< Whether to regard S as signed or not +const std::string &Name = "", ///< Name for the instruction +Instruction *InsertBefore = 0 ///< Place to insert the instruction + ); + + /// @brief Create a ZExt, BitCast, or Trunc for int -> int casts. + static CastInst *createIntegerCast( +Value *S,///< The integer value to be casted (operand 0) +const Type *Ty, ///< The integer type to which operand is casted +bool isSigned, ///< Whether to regard S as signed or not +const std::string &Name, ///< The name for the instruction +BasicBlock *InsertAtEnd ///< The block to insert the instruction into + ); + + /// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts + static CastInst *createFPCast( +Value *S,///< The floating point value to be casted +const Type *Ty, ///< The floating point type to cast to +const std::string &Name = "", ///< Name for the instruction +Instruction *InsertBefore = 0 ///< Place to insert the instruction + ); + + /// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts + static CastInst *createFPCast( +Value *S,///< The floating point value to be casted +const Type *Ty, ///< The floating point type to cast to +const std::string &Name, ///< The name for the instruction +BasicBlock *InsertAtEnd ///< The block to insert the instruction into + ); + /// @brief Create a SExt or BitCast cast instruction static CastInst *createSExtOrBitCast( Value *S,///< The value to be casted (operand 0) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.184 -> 1.185 --- Log message: Implement getIntegerCast and getFPCast for ConstantExpr. These are similar to the createIntegerCast and createFPCast for CastInst instructions. --- Diffs of the changes: (+23 -0) Constants.cpp | 23 +++ 1 files changed, 23 insertions(+) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.184 llvm/lib/VMCore/Constants.cpp:1.185 --- llvm/lib/VMCore/Constants.cpp:1.184 Fri Dec 8 12:06:15 2006 +++ llvm/lib/VMCore/Constants.cpp Mon Dec 11 18:51:07 2006 @@ -1514,6 +1514,29 @@ return getCast(Instruction::BitCast, S, Ty); } +Constant *ConstantExpr::getIntegerCast(Constant *C, const Type *Ty, + bool isSigned) { + assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = +(SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::Trunc : + (isSigned ? Instruction::SExt : Instruction::ZExt))); + return getCast(opcode, C, Ty); +} + +Constant *ConstantExpr::getFPCast(Constant *C, const Type *Ty) { + assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() && + "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = +(SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + return getCast(opcode, C, Ty); +} + Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) { assert(C->getType()->isInteger() && "Trunc operand must be integer"); assert(Ty->isIntegral() && "Trunc produces only integral"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-config/Makefile
Changes in directory llvm/tools/llvm-config: Makefile updated: 1.18 -> 1.19 --- Log message: Fix PR1040: http://llvm.org/PR1040 : Don't rebuild llvm-config if none of the library dependencies changed. --- Diffs of the changes: (+8 -3) Makefile | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm/tools/llvm-config/Makefile diff -u llvm/tools/llvm-config/Makefile:1.18 llvm/tools/llvm-config/Makefile:1.19 --- llvm/tools/llvm-config/Makefile:1.18Tue Dec 5 23:39:18 2006 +++ llvm/tools/llvm-config/Makefile Mon Dec 11 18:43:38 2006 @@ -29,11 +29,16 @@ FinalLibDeps = $(PROJ_OBJ_DIR)/FinalLibDeps.txt LibDeps = $(PROJ_OBJ_DIR)/LibDeps.txt +LibDepsTemp = $(PROJ_OBJ_DIR)/LibDeps.txt.tmp GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl -$(LibDeps): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o) - $(Echo) "Regenerating LibDeps.txt" - $(Verb) $(GenLibDeps) -flat $(LibDir) $(NM_PATH) > $(LibDeps) +$(LibDepsTemp): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o) + $(Echo) "Regenerating LibDeps.txt.tmp" + $(Verb) $(GenLibDeps) -flat $(LibDir) $(NM_PATH) > $(LibDepsTemp) + +$(LibDeps): $(LibDepsTemp) + $(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \ + $(EchoCmd) Updated LibDeps.txt because dependencies changes ) # Find all the cyclic dependencies between various LLVM libraries, so we # don't have to process them at runtime. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll
Changes in directory llvm/test/Regression/CodeGen/CBackend: 2006-12-11-Float-Bitcast.ll updated: 1.1 -> 1.2 --- Log message: Don't bother upgrading this. --- Diffs of the changes: (+2 -2) 2006-12-11-Float-Bitcast.ll |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll diff -u llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.1 llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.2 --- llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.1 Mon Dec 11 14:40:28 2006 +++ llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll Mon Dec 11 18:53:31 2006 @@ -1,5 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep '__BITCAST' | wc -l | grep 14 +; RUN: llvm-as < %s | llc -march=c && +; RUN: llvm-as < %s | llc -march=c | grep '__BITCAST' | wc -l | grep 14 int %test1(float %F) { %X = bitcast float %F to int ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Constants.h
Changes in directory llvm/include/llvm: Constants.h updated: 1.105 -> 1.106 --- Log message: Implement getIntegerCast and getFPCast for ConstantExpr. These are similar to the createIntegerCast and createFPCast for CastInst instructions. --- Diffs of the changes: (+13 -0) Constants.h | 13 + 1 files changed, 13 insertions(+) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.105 llvm/include/llvm/Constants.h:1.106 --- llvm/include/llvm/Constants.h:1.105 Fri Dec 8 12:06:14 2006 +++ llvm/include/llvm/Constants.h Mon Dec 11 18:51:07 2006 @@ -559,6 +559,19 @@ const Type *Ty ///< The type to which cast should be made ); + /// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts + static Constant *getIntegerCast( +Constant *C,///< The integer constant to be casted +const Type *Ty, ///< The integer type to cast to +bool isSigned ///< Whether C should be treated as signed or not + ); + + /// @brief Create a FPExt, Bitcast or FPTrunc for fp -> fp casts + static Constant *getFPCast( +Constant *C,///< The integer constant to be casted +const Type *Ty ///< The integer type to cast to + ); + static Constant *getCast(Constant *C, const Type *Ty); /// @brief Return true if this is a convert constant expression ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ARMInstrInfo.td
Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.88 -> 1.89 ARMInstrInfo.td updated: 1.77 -> 1.78 --- Log message: use MVN to handle small negative constants --- Diffs of the changes: (+32 -0) ARMISelDAGToDAG.cpp | 21 + ARMInstrInfo.td | 11 +++ 2 files changed, 32 insertions(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.88 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.89 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.88Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Dec 11 19:03:11 2006 @@ -781,6 +781,8 @@ virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); bool SelectAddrMode1(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Shift, SDOperand &ShiftType); + bool SelectAddrMode1a(SDOperand Op, SDOperand N, SDOperand &Arg, + SDOperand &Shift, SDOperand &ShiftType); bool SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Offset); bool SelectAddrMode5(SDOperand Op, SDOperand N, SDOperand &Arg, @@ -883,6 +885,25 @@ return true; } +bool ARMDAGToDAGISel::SelectAddrMode1a(SDOperand Op, + SDOperand N, + SDOperand &Arg, + SDOperand &Shift, + SDOperand &ShiftType) { + if (N.getOpcode() != ISD::Constant) +return false; + + uint32_t val = ~cast(N)->getValue(); + if(!isRotInt8Immediate(val)) +return false; + + Arg = CurDAG->getTargetConstant(val,MVT::i32); + Shift = CurDAG->getTargetConstant(0, MVT::i32); + ShiftType = CurDAG->getTargetConstant(ARMShift::LSL, MVT::i32); + + return true; +} + bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Offset) { //TODO: complete and cleanup! Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.77 llvm/lib/Target/ARM/ARMInstrInfo.td:1.78 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.77Mon Dec 11 18:37:38 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Mon Dec 11 19:03:11 2006 @@ -18,6 +18,11 @@ let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm); } +def op_addr_mode1a : Operand { + let PrintMethod = "printAddrMode1"; + let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm); +} + def op_addr_mode2 : Operand { let PrintMethod = "printAddrMode2"; let MIOperandInfo = (ops ptr_rc, i32imm); @@ -33,6 +38,9 @@ def addr_mode1 : ComplexPattern; +//Addressing Mode 1a: MVN hack +def addr_mode1a : ComplexPattern; + //Addressing Mode 2: Load and Store Word or Unsigned Byte def addr_mode2 : ComplexPattern; @@ -193,6 +201,9 @@ def MVN : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), "mvn $dst, $src", [(set IntRegs:$dst, (not addr_mode1:$src))]>; +def MVN2: InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), + "mvn $dst, $src", [(set IntRegs:$dst, addr_mode1a:$src)]>; + def ADD : Addr1BinOp<"add", add>; def ADCS: Addr1BinOp<"adcs", adde>; def ADDS: Addr1BinOp<"adds", addc>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/long.ll mvn.ll
Changes in directory llvm/test/Regression/CodeGen/ARM: long.ll updated: 1.8 -> 1.9 mvn.ll updated: 1.1 -> 1.2 --- Log message: use MVN to handle small negative constants --- Diffs of the changes: (+7 -7) long.ll |4 ++-- mvn.ll | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/test/Regression/CodeGen/ARM/long.ll diff -u llvm/test/Regression/CodeGen/ARM/long.ll:1.8 llvm/test/Regression/CodeGen/ARM/long.ll:1.9 --- llvm/test/Regression/CodeGen/ARM/long.ll:1.8Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/ARM/long.llMon Dec 11 19:03:11 2006 @@ -1,9 +1,9 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r1, #0" | wc -l | grep 4 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1" | wc -l | grep 1 && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*2147483647" | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r0, #-2147483648" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-2147483648" | wc -l | grep 1 && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*4294967295" | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r1, #-2147483648" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adds" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adcs" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "subs" | wc -l | grep 1 && Index: llvm/test/Regression/CodeGen/ARM/mvn.ll diff -u llvm/test/Regression/CodeGen/ARM/mvn.ll:1.1 llvm/test/Regression/CodeGen/ARM/mvn.ll:1.2 --- llvm/test/Regression/CodeGen/ARM/mvn.ll:1.1 Mon Dec 11 18:37:38 2006 +++ llvm/test/Regression/CodeGen/ARM/mvn.ll Mon Dec 11 19:03:11 2006 @@ -1,10 +1,10 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 4 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 5 -;int %f1() { -;entry: -; ret int -1 -;} +int %f1() { +entry: + ret int -1 +} int %f2(int %a) { entry: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp IntrinsicLowering.cpp MachineDebugInfo.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.120 -> 1.121 IntrinsicLowering.cpp updated: 1.49 -> 1.50 MachineDebugInfo.cpp updated: 1.63 -> 1.64 --- Log message: Change inferred cast creation calls to more specific cast creations. --- Diffs of the changes: (+11 -7) AsmPrinter.cpp|6 +- IntrinsicLowering.cpp |2 +- MachineDebugInfo.cpp | 10 +- 3 files changed, 11 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.120 llvm/lib/CodeGen/AsmPrinter.cpp:1.121 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.120 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 19:17:40 2006 @@ -446,7 +446,11 @@ // integer type. This promotes constant folding and simplifies this code. if (isa(Ty)) { const Type *IntPtrTy = TD->getIntPtrType(); -Op = ConstantExpr::getCast(Op, IntPtrTy); +Instruction::CastOps opcode = Instruction::CastOps(CE->getOpcode()); +if (opcode == Instruction::IntToPtr) + Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/); +else + Op = ConstantExpr::getCast(Instruction::PtrToInt, Op, IntPtrTy); return EmitConstantValueOnly(Op); } Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.49 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.50 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.49 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Dec 11 19:17:40 2006 @@ -239,7 +239,7 @@ for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) { Value *MaskCst = - ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), + ConstantExpr::getTruncOrBitCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), V->getType()); Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP); Value *VShift = new ShiftInst(Instruction::LShr, V, Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.63 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.64 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.63 Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Mon Dec 11 19:17:40 2006 @@ -292,7 +292,7 @@ if (GV) { // Set to pointer to global. - Elements.push_back(ConstantExpr::getCast(GV, EmptyTy)); + Elements.push_back(ConstantExpr::getBitCast(GV, EmptyTy)); } else { // Use NULL. Elements.push_back(ConstantPointerNull::get(EmptyTy)); @@ -301,7 +301,7 @@ virtual void Apply(GlobalVariable *&Field) { const PointerType *EmptyTy = SR.getEmptyStructPtrType(); if (Field) { - Elements.push_back(ConstantExpr::getCast(Field, EmptyTy)); + Elements.push_back(ConstantExpr::getBitCast(Field, EmptyTy)); } else { Elements.push_back(ConstantPointerNull::get(EmptyTy)); } @@ -315,7 +315,7 @@ for (unsigned i = 0, N = Field.size(); i < N; ++i) { if (DebugInfoDesc *Element = Field[i]) { GlobalVariable *GVE = SR.Serialize(Element); -Constant *CE = ConstantExpr::getCast(GVE, EmptyTy); +Constant *CE = ConstantExpr::getBitCast(GVE, EmptyTy); ArrayElements.push_back(cast(CE)); } else { ArrayElements.push_back(ConstantPointerNull::get(EmptyTy)); @@ -328,7 +328,7 @@ CA, "llvm.dbg.array", SR.getModule()); CAGV->setSection("llvm.metadata"); -Constant *CAE = ConstantExpr::getCast(CAGV, EmptyTy); +Constant *CAE = ConstantExpr::getBitCast(CAGV, EmptyTy); Elements.push_back(CAE); } }; @@ -1323,7 +1323,7 @@ ConstStr, "str", M); StrGV->setSection("llvm.metadata"); // Convert to generic string pointer. -Slot = ConstantExpr::getCast(StrGV, getStrPtrType()); +Slot = ConstantExpr::getBitCast(StrGV, getStrPtrType()); } return Slot; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp
Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.82 -> 1.83 --- Log message: Change inferred cast creation calls to more specific cast creations. --- Diffs of the changes: (+1 -1) JIT.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.82 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.83 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.82 Thu Dec 7 14:04:42 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cppMon Dec 11 19:17:41 2006 @@ -212,7 +212,7 @@ } else { C = ConstantInt::get(Type::LongTy, (intptr_t)ArgPtr); } - C = ConstantExpr::getCast(C, ArgTy); // Cast the integer to pointer + C = ConstantExpr::getIntToPtr(C, ArgTy); // Cast the integer to pointer break; } Args.push_back(C); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.428 -> 1.429 --- Log message: Change inferred cast creation calls to more specific cast creations. --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.428 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.428 Mon Dec 11 13:27:14 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 19:17:40 2006 @@ -790,7 +790,7 @@ // Only do this if the target has a native EXTLOAD instruction from // f32. TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { -LLVMC = cast(ConstantExpr::getCast(LLVMC, Type::FloatTy)); +LLVMC = cast(ConstantExpr::getFPCast(LLVMC, Type::FloatTy)); VT = MVT::f32; Extend = true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.121 -> 1.122 --- Log message: Tidy up a bit. --- Diffs of the changes: (+1 -1) AsmPrinter.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.121 llvm/lib/CodeGen/AsmPrinter.cpp:1.122 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.121 Mon Dec 11 19:17:40 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 19:32:02 2006 @@ -450,7 +450,7 @@ if (opcode == Instruction::IntToPtr) Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/); else - Op = ConstantExpr::getCast(Instruction::PtrToInt, Op, IntPtrTy); + Op = ConstantExpr::getPtrToInt(Op, IntPtrTy); return EmitConstantValueOnly(Op); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.23 -> 1.24 --- Log message: Generate the correct cast opcode for constant expressions. --- Diffs of the changes: (+17 -2) CppWriter.cpp | 19 +-- 1 files changed, 17 insertions(+), 2 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.23 llvm/tools/llvm2cpp/CppWriter.cpp:1.24 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.23 Tue Dec 5 19:18:01 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Mon Dec 11 19:31:37 2006 @@ -761,8 +761,23 @@ } else if (CE->isCast()) { printConstant(CE->getOperand(0)); Out << "Constant* " << constName << " = ConstantExpr::getCast("; - Out << getCppName(CE->getOperand(0)) << ", " << getCppName(CE->getType()) - << ");"; + switch (CE->getOpcode()) { +default: assert(0 && "Invalid cast opcode"); +case Instruction::Trunc: Out << "Instruction::Trunc"; break; +case Instruction::ZExt: Out << "Instruction::ZExt"; break; +case Instruction::SExt: Out << "Instruction::SExt"; break; +case Instruction::FPTrunc: Out << "Instruction::FPTrunc"; break; +case Instruction::FPExt: Out << "Instruction::FPExt"; break; +case Instruction::FPToUI: Out << "Instruction::FPToUI"; break; +case Instruction::FPToSI: Out << "Instruction::FPToSI"; break; +case Instruction::UIToFP: Out << "Instruction::UIToFP"; break; +case Instruction::SIToFP: Out << "Instruction::SIToFP"; break; +case Instruction::PtrToInt: Out << "Instruction::PtrToInt"; break; +case Instruction::IntToPtr: Out << "Instruction::IntToPtr"; break; +case Instruction::BitCast: Out << "Instruction::BitCast"; break; + } + Out << ", " << getCppName(CE->getOperand(0)) << ", " + << getCppName(CE->getType()) << ");"; } else { unsigned N = CE->getNumOperands(); for (unsigned i = 0; i < N; ++i ) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.68 -> 1.69 --- Log message: teach scev to analyze X*4|1 like X*4+c. This allows us to produce: LBB1_1: #bb movdqa (%esi), %xmm2 movaps %xmm2, %xmm3 punpcklbw %xmm0, %xmm3 movaps %xmm3, %xmm4 punpcklwd %xmm0, %xmm4 cvtdq2ps %xmm4, %xmm4 mulps %xmm1, %xmm4 movaps %xmm4, (%edi) leal 1(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 2(,%eax,4), %ebx shll $4, %ebx punpckhbw %xmm0, %xmm2 movaps %xmm2, %xmm3 punpcklwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 3(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm2 cvtdq2ps %xmm2, %xmm2 mulps %xmm1, %xmm2 movaps %xmm2, (%edx,%ebx) addl $64, %edi incl %eax addl $16, %esi cmpl %ecx, %eax jne LBB1_1 #bb instead of: LBB1_1: #bb movdqa (%esi), %xmm2 movaps %xmm2, %xmm3 punpcklbw %xmm0, %xmm3 movaps %xmm3, %xmm4 punpcklwd %xmm0, %xmm4 cvtdq2ps %xmm4, %xmm4 mulps %xmm1, %xmm4 movaps %xmm4, (%edi) leal 1(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 2(,%eax,4), %ebx shll $4, %ebx punpckhbw %xmm0, %xmm2 movaps %xmm2, %xmm3 punpcklwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 3(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm2 cvtdq2ps %xmm2, %xmm2 mulps %xmm1, %xmm2 movaps %xmm2, (%edx,%ebx) addl $64, %edi incl %eax addl $16, %esi cmpl %ecx, %eax jne LBB1_1 #bb for a testcase. --- Diffs of the changes: (+59 -1) ScalarEvolution.cpp | 60 +++- 1 files changed, 59 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.68 llvm/lib/Analysis/ScalarEvolution.cpp:1.69 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.68 Sun Dec 10 18:12:31 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Dec 11 20:26:09 2006 @@ -1339,6 +1339,49 @@ return SCEVUnknown::get(PN); } +/// GetConstantFactor - Determine the largest constant factor that S has. For +/// example, turn {4,+,8} -> 4.(S umod result) should always equal zero. +static uint64_t GetConstantFactor(SCEVHandle S) { + if (SCEVConstant *C = dyn_cast(S)) { +if (uint64_t V = C->getValue()->getZExtValue()) + return V; +else // Zero is a multiple of everything. + return 1ULL << (S->getType()->getPrimitiveSizeInBits()-1); + } + + if (SCEVTruncateExpr *T = dyn_cast(S)) +return GetConstantFactor(T->getOperand()) & + T->getType()->getIntegralTypeMask(); + if (SCEVZeroExtendExpr *E = dyn_cast(S)) +return GetConstantFactor(E->getOperand()); + + if (SCEVAddExpr *A = dyn_cast(S)) { +// The result is the min of all operands. +uint64_t Res = GetConstantFactor(A->getOperand(0)); +for (unsigned i = 1, e = A->getNumOperands(); i != e && Res > 1; ++i) + Res = std::min(Res, GetConstantFactor(A->getOperand(i))); +return Res; + } + + if (SCEVMulExpr *M = dyn_cast(S)) { +// The result is the product of all the operands. +uint64_t Res = GetConstantFactor(M->getOperand(0)); +for (unsigned i = 1, e = M->getNumOperands(); i != e; ++i) + Res *= GetConstantFactor(M->getOperand(i)); +return Res; + } + + if (SCEVAddRecExpr *A = dyn_cast(S)) { +// FIXME: Generalize. +if (A->getNumOperands() == 2) + return std::min(GetConstantFactor(A->getOperand(0)), + GetConstantFactor(A->getOperand(1))); +// ? + } + + // SCEVSDivExpr, SCEVUnknown. + return 1; +} /// createSCEV - We know that there is no SCEV for the specified value. /// Analyze the expression. @@ -1360,7 +1403,22 @@ case Instruction::Sub: return SCEV::getMinusSCEV(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); - +case Instruction::Or: + // If the RHS of the Or is a constant, we may have something like: + // X*4+1 which got turned into X*4|1. Handle this as an add so loop + // optimizations will transparently handle this case. + if (ConstantInt *CI = dyn_cast(I->getOperand(1))) { +SCEVHandle LHS = getSCEV(I->getOperand(0)); +uint64_t CommonFact = GetConstantFactor(LHS); +assert(CommonFact && "Common factor should at least be 1!"); +if (CommonFact > CI->getZExtValue()) { + // If the
[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/store-fp-constant.ll
Changes in directory llvm/test/Regression/CodeGen/X86: store-fp-constant.ll updated: 1.2 -> 1.3 --- Log message: This should check for darwin literal sections as well. --- Diffs of the changes: (+2 -1) store-fp-constant.ll |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/X86/store-fp-constant.ll diff -u llvm/test/Regression/CodeGen/X86/store-fp-constant.ll:1.2 llvm/test/Regression/CodeGen/X86/store-fp-constant.ll:1.3 --- llvm/test/Regression/CodeGen/X86/store-fp-constant.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/X86/store-fp-constant.ll Mon Dec 11 21:59:46 2006 @@ -1,4 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep rodata +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep rodata && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep literal ; ; Check that no FP constants in this testcase ends up in the ; constant pool. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.260 -> 1.261 --- Log message: make this code more aggressive about turning store fpimm into store int imm. This is not sufficient to fix X86/store-fp-constant.ll --- Diffs of the changes: (+32 -9) DAGCombiner.cpp | 41 - 1 files changed, 32 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.260 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.261 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.260 Mon Dec 11 11:25:19 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Dec 11 22:16:14 2006 @@ -3038,15 +3038,38 @@ if (ConstantFPSDNode *CFP = dyn_cast(Value)) { if (Value.getOpcode() != ISD::TargetConstantFP) { SDOperand Tmp; - if (CFP->getValueType(0) == MVT::f32) { -Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); -return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), -ST->getSrcValueOffset()); - } else if (TLI.isTypeLegal(MVT::i64)) { -assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); -Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); -return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), -ST->getSrcValueOffset()); + switch (CFP->getValueType(0)) { + default: assert(0 && "Unknown FP type"); + case MVT::f32: +if (!AfterLegalize || TLI.isTypeLegal(MVT::i32)) { + Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); + return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); +} +break; + case MVT::f64: +if (!AfterLegalize || TLI.isTypeLegal(MVT::i64)) { + Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); + return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); +} else if (TLI.isTypeLegal(MVT::i32)) { + // Many FP stores are not make apparent until after legalize, e.g. for + // argument passing. Since this is so common, custom legalize the + // 64-bit integer store into two 32-bit stores. + uint64_t Val = DoubleToBits(CFP->getValue()); + SDOperand Lo = DAG.getConstant(Val & 0x, MVT::i32); + SDOperand Hi = DAG.getConstant(Val >> 32, MVT::i32); + if (!TLI.isLittleEndian()) std::swap(Lo, Hi); + + SDOperand St0 = DAG.getStore(Chain, Lo, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, +DAG.getConstant(4, Ptr.getValueType())); + SDOperand St1 = DAG.getStore(Chain, Hi, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()+4); + return DAG.getNode(ISD::TokenFactor, MVT::Other, St0, St1); +} +break; } } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.429 -> 1.430 --- Log message: Revert Nate's patch to fix X86/store-fp-constant.ll. With the dag combiner and legalizer separated like they currently are, I don't see a way to handle this xform. --- Diffs of the changes: (+18 -0) LegalizeDAG.cpp | 18 ++ 1 files changed, 18 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.430 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429 Mon Dec 11 19:17:40 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 22:18:56 2006 @@ -1648,6 +1648,24 @@ Tmp2 = LegalizeOp(ST->getBasePtr()); // Legalize the pointer. if (!ST->isTruncatingStore()) { + // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' + // FIXME: We shouldn't do this for TargetConstantFP's. + // FIXME: move this to the DAG Combiner! Note that we can't regress due + // to phase ordering between legalized code and the dag combiner. This + // probably means that we need to integrate dag combiner and legalizer + // together. + if (ConstantFPSDNode *CFP = dyn_cast(ST->getValue())) { +if (CFP->getValueType(0) == MVT::f32) { + Tmp3 = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); +} else { + assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); + Tmp3 = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); +} +Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + ST->getSrcValueOffset()); +break; + } + switch (getTypeAction(ST->getStoredVT())) { case Legal: { Tmp3 = LegalizeOp(ST->getValue()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll
Changes in directory llvm/test/Regression/Transforms/ScalarRepl: 2006-12-11-SROA-Crash.ll added (r1.1) --- Log message: new testcase for pr1045: http://llvm.org/PR1045 --- Diffs of the changes: (+24 -0) 2006-12-11-SROA-Crash.ll | 24 1 files changed, 24 insertions(+) Index: llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll diff -c /dev/null llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll:1.1 *** /dev/null Mon Dec 11 22:24:27 2006 --- llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll Mon Dec 11 22:24:17 2006 *** *** 0 --- 1,24 + ; RUN: llvm-as < %s | opt -scalarrepl -disable-output + ; PR1045 + + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>" = type { "struct.__gnu_cxx::bitmap_allocator::_Alloc_block"* } + "struct.__gnu_cxx::bitmap_allocator" = type { ubyte } + "struct.__gnu_cxx::bitmap_allocator::_Alloc_block" = type { [8 x sbyte] } + + implementation ; Functions: + + void %_ZN9__gnu_cxx16bitmap_allocatorIwE27_M_deallocate_single_objectEPw() { + entry: + %this_addr.i = alloca "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"**> [#uses=3] + %tmp = alloca "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>", align 4 ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"*> [#uses=1] + store "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* %tmp, "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"** %this_addr.i + %tmp.i = load "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"** %this_addr.i ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"*> [#uses=1] + %tmp.i = bitcast "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* %tmp.i to "struct.__gnu_cxx::bitmap_allocator"*; <"struct.__gnu_cxx::bitmap_allocator"*> [#uses=0] + %tmp1.i = load "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"** %this_addr.i ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"*> [#uses=1] + %tmp.i = getelementptr "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* %tmp1.i, int 0, uint 0 ; <"struct.__gnu_cxx::bitmap_allocator::_Alloc_block"**> [#uses=0] + unreachable + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.55 -> 1.56 --- Log message: Patch for PR1045: http://llvm.org/PR1045 and Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll --- Diffs of the changes: (+2 -0) ScalarReplAggregates.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.55 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.56 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.55Sun Dec 10 19:17:00 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Dec 11 22:24:41 2006 @@ -433,6 +433,8 @@ const PackedType *PTy; if (Accum == Type::VoidTy || In == Accum) { Accum = In; + } else if (In == Type::VoidTy) { +// Noop. } else if (In->isIntegral() && Accum->isIntegral()) { // integer union. // Otherwise pick whichever type is larger. if (In->getTypeID() > Accum->getTypeID()) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp LowerInvoke.cpp
Changes in directory llvm/lib/Transforms/Utils: LowerAllocations.cpp updated: 1.64 -> 1.65 LowerInvoke.cpp updated: 1.45 -> 1.46 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+9 -4) LowerAllocations.cpp |5 +++-- LowerInvoke.cpp |8 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.65 --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Mon Dec 11 23:05:00 2006 @@ -122,14 +122,15 @@ MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize(AllocTy)); else MallocArg = ConstantExpr::getSizeOf(AllocTy); - MallocArg = ConstantExpr::getCast(cast(MallocArg), IntPtrTy); + MallocArg = ConstantExpr::getIntegerCast(cast(MallocArg), + IntPtrTy, true /*SExt*/); if (MI->isArrayAllocation()) { if (isa(MallocArg) && cast(MallocArg)->getZExtValue() == 1) { MallocArg = MI->getOperand(0); // Operand * 1 = Operand } else if (Constant *CO = dyn_cast(MI->getOperand(0))) { - CO = ConstantExpr::getCast(CO, IntPtrTy); + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true /*SExt*/); MallocArg = ConstantExpr::getMul(CO, cast(MallocArg)); } else { Value *Scale = MI->getOperand(0); Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.45 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.46 --- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.45 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LowerInvoke.cpp Mon Dec 11 23:05:00 2006 @@ -215,8 +215,12 @@ unsigned NumArgs = FT->getNumParams(); for (unsigned i = 0; i != 3; ++i) if (i < NumArgs && FT->getParamType(i) != Args[i]->getType()) -Args[i] = ConstantExpr::getCast(cast(Args[i]), -FT->getParamType(i)); +if (Args[i]->getType()->isInteger()) + Args[i] = ConstantExpr::getIntegerCast(cast(Args[i]), + FT->getParamType(i), true); +else + Args[i] = ConstantExpr::getBitCast(cast(Args[i]), + FT->getParamType(i)); (new CallInst(WriteFn, Args, "", IB))->setTailCall(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.69 -> 1.70 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+9 -3) ScalarEvolution.cpp | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.69 llvm/lib/Analysis/ScalarEvolution.cpp:1.70 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.69 Mon Dec 11 20:26:09 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Dec 11 23:04:59 2006 @@ -1566,7 +1566,9 @@ // comparison. ConstantInt *CompVal = RHSC->getValue(); const Type *RealTy = ExitCond->getOperand(0)->getType(); -CompVal = dyn_cast(ConstantExpr::getCast(CompVal, RealTy)); +CompVal = dyn_cast( + ConstantExpr::getIntegerCast(CompVal, RealTy, + CompVal->getType()->isSigned())); if (CompVal) { // Form the constant range. ConstantRange CompRange(Cond, CompVal); @@ -1575,8 +1577,12 @@ // range. if (CompRange.getLower()->getType()->isSigned()) { const Type *NewTy = RHSC->getValue()->getType(); -Constant *NewL = ConstantExpr::getCast(CompRange.getLower(), NewTy); -Constant *NewU = ConstantExpr::getCast(CompRange.getUpper(), NewTy); +Constant *NewL = + ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy, + CompRange.getLower()->getType()->isSigned()); +Constant *NewU = + ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy, + CompRange.getUpper()->getType()->isSigned()); CompRange = ConstantRange(NewL, NewU); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.297 -> 1.298 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+2 -2) Writer.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.297 llvm/lib/Target/CBackend/Writer.cpp:1.298 --- llvm/lib/Target/CBackend/Writer.cpp:1.297 Mon Dec 11 18:11:08 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Dec 11 23:04:59 2006 @@ -296,7 +296,7 @@ if (!X.second) { // Found a conflict, replace this global with the previous one. GlobalValue *OldGV = X.first->second; -GV->replaceAllUsesWith(ConstantExpr::getCast(OldGV, GV->getType())); +GV->replaceAllUsesWith(ConstantExpr::getBitCast(OldGV, GV->getType())); GV->eraseFromParent(); Changed = true; } @@ -312,7 +312,7 @@ if (!X.second) { // Found a conflict, replace this global with the previous one. GlobalValue *OldGV = X.first->second; -GV->replaceAllUsesWith(ConstantExpr::getCast(OldGV, GV->getType())); +GV->replaceAllUsesWith(ConstantExpr::getBitCast(OldGV, GV->getType())); GV->eraseFromParent(); Changed = true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp SCCP.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.98 -> 1.99 SCCP.cpp updated: 1.140 -> 1.141 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+9 -3) LoopStrengthReduce.cpp |9 +++-- SCCP.cpp |3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.98 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.99 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.98 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Dec 11 23:04:59 2006 @@ -200,12 +200,17 @@ return new LoopStrengthReduce(TLI); } -/// getCastedVersionOf - Return the specified value casted to uintptr_t. +/// getCastedVersionOf - Return the specified value casted to uintptr_t. This +/// assumes that the Value* V is of integer or pointer type only. /// Value *LoopStrengthReduce::getCastedVersionOf(Value *V) { if (V->getType() == UIntPtrTy) return V; if (Constant *CB = dyn_cast(V)) -return ConstantExpr::getCast(CB, UIntPtrTy); +if (CB->getType()->isInteger()) + return ConstantExpr::getIntegerCast(CB, UIntPtrTy, + CB->getType()->isSigned()); +else + return ConstantExpr::getPtrToInt(CB, UIntPtrTy); Value *&New = CastedPointers[V]; if (New) return New; Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 llvm/lib/Transforms/Scalar/SCCP.cpp:1.141 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Dec 11 23:04:59 2006 @@ -589,7 +589,8 @@ if (VState.isOverdefined()) // Inherit overdefinedness of operand markOverdefined(&I); else if (VState.isConstant())// Propagate constant value -markConstant(&I, ConstantExpr::getCast(VState.getConstant(), I.getType())); +markConstant(&I, ConstantExpr::getCast(I.getOpcode(), + VState.getConstant(), I.getType())); } void SCCPSolver::visitSelectInst(SelectInst &I) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp
Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.63 -> 1.64 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+2 -2) FunctionResolution.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.63 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.64 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.63 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Mon Dec 11 23:04:59 2006 @@ -103,7 +103,7 @@ if (!Old->use_empty()) { Value *Replacement = Concrete; if (Concrete->getType() != Old->getType()) - Replacement = ConstantExpr::getCast(Concrete, Old->getType()); + Replacement = ConstantExpr::getBitCast(Concrete, Old->getType()); NumResolved += Old->getNumUses(); Old->replaceAllUsesWith(Replacement); } @@ -122,7 +122,7 @@ for (unsigned i = 0; i != Globals.size(); ++i) if (Globals[i] != Concrete) { - Constant *Cast = ConstantExpr::getCast(Concrete, Globals[i]->getType()); + Constant *Cast = ConstantExpr::getBitCast(Concrete,Globals[i]->getType()); Globals[i]->replaceAllUsesWith(Cast); // Since there are no uses of Old anymore, remove it from the module. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.122 -> 1.123 --- Log message: the operand of a bitcast is always the right size, just emit it in place. --- Diffs of the changes: (+4 -2) AsmPrinter.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.122 llvm/lib/CodeGen/AsmPrinter.cpp:1.123 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.122 Mon Dec 11 19:32:02 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 23:14:13 2006 @@ -434,9 +434,11 @@ case Instruction::FPToSI: assert(0 && "FIXME: Don't yet support this kind of constant cast expr"); break; +case Instruction::BitCast: + return EmitConstantValueOnly(CE->getOperand(0)); + case Instruction::IntToPtr: -case Instruction::PtrToInt: -case Instruction::BitCast: { +case Instruction::PtrToInt:{ // Support only foldable casts to/from pointers that can be eliminated by // changing the pointer to the appropriately sized integer type. Constant *Op = CE->getOperand(0); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp
Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.122 -> 1.123 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+6 -6) LinkModules.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.122 llvm/lib/Linker/LinkModules.cpp:1.123 --- llvm/lib/Linker/LinkModules.cpp:1.122 Thu Dec 7 17:41:45 2006 +++ llvm/lib/Linker/LinkModules.cpp Mon Dec 11 23:04:59 2006 @@ -508,7 +508,8 @@ DGV->isConstant(), DGV->getLinkage()); NewDGV->setAlignment(DGV->getAlignment()); Dest->getGlobalList().insert(DGV, NewDGV); -DGV->replaceAllUsesWith(ConstantExpr::getCast(NewDGV, DGV->getType())); +DGV->replaceAllUsesWith( +ConstantExpr::getBitCast(NewDGV, DGV->getType())); DGV->eraseFromParent(); NewDGV->setName(SGV->getName()); DGV = NewDGV; @@ -529,9 +530,8 @@ SGV->setInitializer(0); } - ValueMap.insert(std::make_pair(SGV, - ConstantExpr::getCast(DGV, - SGV->getType(; + ValueMap.insert( +std::make_pair(SGV, ConstantExpr::getBitCast(DGV, SGV->getType(; } } return false; @@ -807,8 +807,8 @@ // FIXME: This should rewrite simple/straight-forward uses such as // getelementptr instructions to not use the Cast! - G1->replaceAllUsesWith(ConstantExpr::getCast(NG, G1->getType())); - G2->replaceAllUsesWith(ConstantExpr::getCast(NG, G2->getType())); + G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G1->getType())); + G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G2->getType())); // Remove the two globals from the module now... M->getGlobalList().erase(G1); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.123 -> 1.124 --- Log message: split up inttoptr from ptrtoint handling, the cases aren't similar at all. --- Diffs of the changes: (+15 -22) AsmPrinter.cpp | 37 +++-- 1 files changed, 15 insertions(+), 22 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.123 llvm/lib/CodeGen/AsmPrinter.cpp:1.124 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.123 Mon Dec 11 23:14:13 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 23:18:19 2006 @@ -437,33 +437,26 @@ case Instruction::BitCast: return EmitConstantValueOnly(CE->getOperand(0)); -case Instruction::IntToPtr: -case Instruction::PtrToInt:{ +case Instruction::IntToPtr: { + // Handle casts to pointers by changing them into casts to the appropriate + // integer type. This promotes constant folding and simplifies this code. + Constant *Op = CE->getOperand(0); + Op = ConstantExpr::getIntegerCast(Op, TD->getIntPtrType(), false/*ZExt*/); + return EmitConstantValueOnly(Op); +} + + +case Instruction::PtrToInt: { // Support only foldable casts to/from pointers that can be eliminated by // changing the pointer to the appropriately sized integer type. Constant *Op = CE->getOperand(0); - const Type *OpTy = Op->getType(), *Ty = CE->getType(); + const Type *Ty = CE->getType(); - // Handle casts to pointers by changing them into casts to the appropriate - // integer type. This promotes constant folding and simplifies this code. - if (isa(Ty)) { -const Type *IntPtrTy = TD->getIntPtrType(); -Instruction::CastOps opcode = Instruction::CastOps(CE->getOpcode()); -if (opcode == Instruction::IntToPtr) - Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/); -else - Op = ConstantExpr::getPtrToInt(Op, IntPtrTy); + // We can emit the pointer value into this slot if the slot is an + // integer slot greater or equal to the size of the pointer. + if (Ty->isIntegral() && + Ty->getPrimitiveSize() >= TD->getTypeSize(Op->getType())) return EmitConstantValueOnly(Op); - } - - // We know the dest type is not a pointer. Is the src value a pointer or - // integral? - if (isa(OpTy) || OpTy->isIntegral()) { -// We can emit the pointer value into this slot if the slot is an -// integer slot greater or equal to the size of the pointer. -if (Ty->isIntegral() && TD->getTypeSize(Ty) >= TD->getTypeSize(OpTy)) - return EmitConstantValueOnly(Op); - } assert(0 && "FIXME: Don't yet support this kind of constant cast expr"); EmitConstantValueOnly(Op); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.50 -> 1.51 --- Log message: This case isn't needed with recent changes to ConstantInt::get --- Diffs of the changes: (+1 -3) IntrinsicLowering.cpp |4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.50 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.51 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.50 Mon Dec 11 19:17:40 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Dec 11 23:19:46 2006 @@ -238,9 +238,7 @@ unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) { -Value *MaskCst = - ConstantExpr::getTruncOrBitCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), - V->getType()); +Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]); Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP); Value *VShift = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy, i), "ctpop.sh", IP); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.431 -> 1.432 --- Log message: fit in 80 cols --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.431 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.432 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.431 Mon Dec 11 23:21:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 23:22:21 2006 @@ -790,7 +790,7 @@ // Only do this if the target has a native EXTLOAD instruction from // f32. TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { -LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC, Type::FloatTy)); +LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC,Type::FloatTy)); VT = MVT::f32; Extend = true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
> Index: llvm/lib/Analysis/ScalarEvolution.cpp > diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.69 llvm/lib/ > Analysis/ScalarEvolution.cpp:1.70 > --- llvm/lib/Analysis/ScalarEvolution.cpp:1.69Mon Dec 11 20:26:09 > 2006 > +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Dec 11 23:04:59 2006 > @@ -1566,7 +1566,9 @@ > // comparison. > ConstantInt *CompVal = RHSC->getValue(); > const Type *RealTy = ExitCond->getOperand(0)->getType(); > -CompVal = dyn_cast(ConstantExpr::getCast > (CompVal, RealTy)); > +CompVal = dyn_cast( > + ConstantExpr::getIntegerCast(CompVal, RealTy, > + CompVal->getType()->isSigned > ())); > if (CompVal) { >// Form the constant range. >ConstantRange CompRange(Cond, CompVal); > @@ -1575,8 +1577,12 @@ >// range. >if (CompRange.getLower()->getType()->isSigned()) { > const Type *NewTy = RHSC->getValue()->getType(); > -Constant *NewL = ConstantExpr::getCast > (CompRange.getLower(), NewTy); > -Constant *NewU = ConstantExpr::getCast > (CompRange.getUpper(), NewTy); > +Constant *NewL = > + ConstantExpr::getIntegerCast(CompRange.getLower(), > NewTy, > + CompRange.getLower()->getType()->isSigned()); > +Constant *NewU = > + ConstantExpr::getIntegerCast(CompRange.getUpper(), > NewTy, > + CompRange.getUpper()->getType()->isSigned()); > CompRange = ConstantRange(NewL, NewU); >} I believe all of these are bitcasts. The later two certainly are. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp LowerInvoke.cpp
> Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp > diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 llvm/ > lib/Transforms/Utils/LowerAllocations.cpp:1.65 > --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 Wed Dec 6 > 11:46:33 2006 > +++ llvm/lib/Transforms/Utils/LowerAllocations.cppMon Dec 11 > 23:05:00 2006 > @@ -122,14 +122,15 @@ > MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize > (AllocTy)); >else > MallocArg = ConstantExpr::getSizeOf(AllocTy); > - MallocArg = ConstantExpr::getCast(cast(MallocArg), > IntPtrTy); > + MallocArg = ConstantExpr::getIntegerCast(cast > (MallocArg), > + IntPtrTy, true / > *SExt*/); This is always trunc or bitcast. >if (MI->isArrayAllocation()) { > if (isa(MallocArg) && > cast(MallocArg)->getZExtValue() == 1) { >MallocArg = MI->getOperand(0); // Operand * 1 = > Operand > } else if (Constant *CO = dyn_cast(MI->getOperand > (0))) { > - CO = ConstantExpr::getCast(CO, IntPtrTy); > + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true / > *SExt*/); This should zext, not sext. >MallocArg = ConstantExpr::getMul(CO, cast > (MallocArg)); > } else { >Value *Scale = MI->getOperand(0); > -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.430 -> 1.431 --- Log message: this can only be fptrunc. --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.430 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.431 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.430 Mon Dec 11 22:18:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 23:21:51 2006 @@ -790,7 +790,7 @@ // Only do this if the target has a native EXTLOAD instruction from // f32. TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { -LLVMC = cast(ConstantExpr::getFPCast(LLVMC, Type::FloatTy)); +LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC, Type::FloatTy)); VT = MVT::f32; Extend = true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.185 -> 1.186 --- Log message: Don't create usless casts for same-bith-width floating point casts. --- Diffs of the changes: (+3 -2) Constants.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.185 llvm/lib/VMCore/Constants.cpp:1.186 --- llvm/lib/VMCore/Constants.cpp:1.185 Mon Dec 11 18:51:07 2006 +++ llvm/lib/VMCore/Constants.cpp Mon Dec 11 23:38:50 2006 @@ -1531,9 +1531,10 @@ "Invalid cast"); unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); unsigned DstBits = Ty->getPrimitiveSizeInBits(); + if (SrcBits == DstBits) +return C; // Avoid a useless cast Instruction::CastOps opcode = -(SrcBits == DstBits ? Instruction::BitCast : - (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt); return getCast(opcode, C, Ty); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp SCCP.cpp
> -/// getCastedVersionOf - Return the specified value casted to > uintptr_t. > +/// getCastedVersionOf - Return the specified value casted to > uintptr_t. This > +/// assumes that the Value* V is of integer or pointer type only. > /// > Value *LoopStrengthReduce::getCastedVersionOf(Value *V) { >if (V->getType() == UIntPtrTy) return V; >if (Constant *CB = dyn_cast(V)) > -return ConstantExpr::getCast(CB, UIntPtrTy); > +if (CB->getType()->isInteger()) > + return ConstantExpr::getIntegerCast(CB, UIntPtrTy, > + CB->getType()->isSigned()); You're going to have to decide on the signedness at some point. Considering that this is used for gep indices, I'd guess they must be signed. > +else > + return ConstantExpr::getPtrToInt(CB, UIntPtrTy); > >Value *&New = CastedPointers[V]; >if (New) return New; > > > Index: llvm/lib/Transforms/Scalar/SCCP.cpp > diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 llvm/lib/ > Transforms/Scalar/SCCP.cpp:1.141 > --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 Wed Dec 6 19:30:31 2006 > +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Dec 11 23:04:59 2006 > @@ -589,7 +589,8 @@ >if (VState.isOverdefined()) // Inherit overdefinedness > of operand > markOverdefined(&I); >else if (VState.isConstant())// Propagate constant value > -markConstant(&I, ConstantExpr::getCast(VState.getConstant(), > I.getType())); > +markConstant(&I, ConstantExpr::getCast(I.getOpcode(), > + VState.getConstant(), > I.getType())); > } Nice bug. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.327 -> 1.328 --- Log message: Expand formal arguments and call arguments recursively: e.g. f64 -> i64 -> 2 x i32. --- Diffs of the changes: (+76 -45) SelectionDAGISel.cpp | 121 --- 1 files changed, 76 insertions(+), 45 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.327 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.328 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.327Sun Dec 10 17:12:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Dec 12 01:27:38 2006 @@ -2860,6 +2860,32 @@ DAG.getSrcValue(I.getOperand(2; } +/// ExpandScalarFormalArgs - Recursively expand the formal_argument node, either +/// bit_convert it or join a pair of them with a BUILD_PAIR when appropriate. +static SDOperand ExpandScalarFormalArgs(MVT::ValueType VT, SDNode *Arg, +unsigned &i, SelectionDAG &DAG, +TargetLowering &TLI) { + if (TLI.getTypeAction(VT) != TargetLowering::Expand) +return SDOperand(Arg, i++); + + MVT::ValueType EVT = TLI.getTypeToTransformTo(VT); + unsigned NumVals = MVT::getSizeInBits(VT) / MVT::getSizeInBits(EVT); + if (NumVals == 1) { +return DAG.getNode(ISD::BIT_CONVERT, VT, + ExpandScalarFormalArgs(EVT, Arg, i, DAG, TLI)); + } else if (NumVals == 2) { +SDOperand Lo = ExpandScalarFormalArgs(EVT, Arg, i, DAG, TLI); +SDOperand Hi = ExpandScalarFormalArgs(EVT, Arg, i, DAG, TLI); +if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); +return DAG.getNode(ISD::BUILD_PAIR, VT, Lo, Hi); + } else { +// Value scalarized into many values. Unimp for now. +assert(0 && "Cannot expand i64 -> i16 yet!"); + } + return SDOperand(); +} + /// TargetLowering::LowerArguments - This is the default LowerArguments /// implementation, which just inserts a FORMAL_ARGUMENTS node. FIXME: When all /// targets are migrated to using FORMAL_ARGUMENTS, this hook should be @@ -2890,8 +2916,12 @@ // If this is a large integer, it needs to be broken up into small // integers. Figure out what the destination type is and how many small // integers it turns into. -MVT::ValueType NVT = getTypeToTransformTo(VT); -unsigned NumVals = MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); +MVT::ValueType NVT = VT; +unsigned NumVals = 1; +while (getTypeAction(NVT) == Expand) { + NVT = getTypeToTransformTo(NVT); + NumVals *= MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); +} for (unsigned i = 0; i != NumVals; ++i) RetVals.push_back(NVT); } else { @@ -2949,26 +2979,10 @@ } case Expand: if (VT != MVT::Vector) { -// If this is a large integer, it needs to be reassembled from small -// integers. Figure out what the source elt type is and how many small -// integers it is. -MVT::ValueType NVT = getTypeToTransformTo(VT); -unsigned NumVals = MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); -if (NumVals == 1) { - SDOperand Tmp = SDOperand(Result, i++); - Ops.push_back(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp)); -} else if (NumVals == 2) { - SDOperand Lo = SDOperand(Result, i++); - SDOperand Hi = SDOperand(Result, i++); - - if (!isLittleEndian()) -std::swap(Lo, Hi); - - Ops.push_back(DAG.getNode(ISD::BUILD_PAIR, VT, Lo, Hi)); -} else { - // Value scalarized into many values. Unimp for now. - assert(0 && "Cannot expand i64 -> i16 yet!"); -} +// If this is a large integer or a floating point node that needs to be +// expanded, it needs to be reassembled from small integers. Figure out +// what the source elt type is and how many small integers it is. +Ops.push_back(ExpandScalarFormalArgs(VT, Result, i, DAG, *this)); } else { // Otherwise, this is a vector type. We only support legal vectors // right now. @@ -2998,6 +3012,39 @@ } +/// ExpandScalarCallArgs - Recursively expand call argument node by +/// bit_converting it or extract a pair of elements from the larger node. +static void ExpandScalarCallArgs(MVT::ValueType VT, SDOperand Arg, + bool isSigned, + SmallVector &Ops, + SelectionDAG &DAG, + TargetLowering &TLI) { + if (TLI.getTypeAction(VT) != TargetLowering::Expand) { +Ops.push_back(Arg); +Ops.push_back(DAG.getConstant(isSigned, MVT::i32)); +return; + } + + MVT::ValueType EVT = TLI.getTypeToTransformTo(VT); + unsig