[llvm-commits] [llvm] r52472 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Owen Anderson
resistor at mac.com
Thu Jun 19 00:34:38 PDT 2008
Evan,
Could you send me a bugpoint reduction? I don't have povray setup on
my machine.
--Owen
On Jun 18, 2008, at 11:26 PM, Evan Cheng wrote:
> Hi Owen,
>
> This broke povray. Can you fix?
>
> /Users/echeng/LLVM/llvm/Release/bin/opt -std-compile-opts -time-passes
> -info-output-file=/Volumes/Vadar/LLVM/llvm/projects/llvm-test/
> External/
> Povray/Output/povray.linked.bc.info Output/povray.linked.rbc -o
> Outp\
> ut/povray.linked.bc -f
> Assertion failed: (getType() == V->getType() && "All operands to PHI
> node must be the same type as the PHI node!"), function addIncoming,
> file /Users/echeng/LLVM/llvm/include/llvm/Instructions.h, line 1914.
> 0 opt 0x0039c1cc
> _ZN4llvm3sys18RemoveFileOnSignalERKNS0_4PathEPSs + 844^@
> 1 libSystem.B.dylib 0x9232209b _sigtramp + 43^@
> 2 ??? 0xffffffff 0x0 + 4294967295^@
> 3 libSystem.B.dylib 0x9239aec2 raise + 26^@
> 4 libSystem.B.dylib 0x923aa47f abort + 73^@
> 5 libSystem.B.dylib 0x9239c063 __assert_rtn +
> 101^@
> 6 opt 0x00093de2
> _ZN4llvm7PHINode11addIncomingEPNS_5ValueEPNS_10BasicBlockE + 386^@
> 7 opt 0x000683b5
> _ZN4llvm8df_beginIPNS_15DomTreeNodeBaseINS_10BasicBlockEEEEENS_11df_iteratorIT_NS_11SmallPtrSetIPNS_11GraphTraitsIS6_E8NodeTypeELj8EEELb0ES9_EERKS6_
> + 6565^@
> 8 opt 0x00072310
> _ZN4llvm13createGVNPassEv + 22624^@
> 9 opt 0x000727af
> _ZN4llvm13createGVNPassEv + 23807^@
> 10 opt 0x00331ae6
> _ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE + 518^@
> 11 opt 0x0020e612
> _ZN49_GLOBAL__N_CallGraphSCCPass
> .cpp_00000000_62117D2D13CGPassManager11runOnModuleERN4llvm6ModuleE +
> 1250^@
> 12 opt 0x00332561
> _ZN4llvm13MPPassManager11runOnModuleERNS_6ModuleE + 369^@
> 13 opt 0x00332974
> _ZN4llvm15PassManagerImpl3runERNS_6ModuleE + 132^@
> 14 opt 0x003329eb
> _ZN4llvm11PassManager3runERNS_6ModuleE + 27^@
> 15 opt 0x00008b87 main + 2583^@
> 16 opt 0x00002196 start + 54^@
>
> Evan
>
> On Jun 18, 2008, at 2:59 PM, Owen Anderson wrote:
>
>> Author: resistor
>> Date: Wed Jun 18 16:59:00 2008
>> New Revision: 52472
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=52472&view=rev
>> Log:
>> Add support for extractvalue and insertvalue instructions in GVN.
>>
>> Modified:
>> llvm/trunk/lib/Transforms/Scalar/GVN.cpp
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=52472&r1=52471&r2=52472&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Jun 18 16:59:00 2008
>> @@ -59,7 +59,7 @@
>> SHUFFLE, SELECT, TRUNC, ZEXT, SEXT,
>> FPTOUI,
>> FPTOSI, UITOFP, SITOFP, FPTRUNC, FPEXT,
>> PTRTOINT, INTTOPTR, BITCAST, GEP, CALL,
>> CONSTANT,
>> - EMPTY, TOMBSTONE };
>> + EXTRACTVALUE, INSERTVALUE, EMPTY,
>> TOMBSTONE };
>>
>> ExpressionOpcode opcode;
>> const Type* type;
>> @@ -150,6 +150,8 @@
>> Expression create_expression(GetElementPtrInst* G);
>> Expression create_expression(CallInst* C);
>> Expression create_expression(Constant* C);
>> + Expression create_expression(InsertValueInst* I);
>> + Expression create_expression(ExtractValueInst* I);
>> public:
>> ValueTable() : nextValueNumber(1) { }
>> uint32_t lookup_or_add(Value* V);
>> @@ -284,6 +286,40 @@
>> }
>> }
>>
>> +Expression ValueTable::create_expression(InsertValueInst* I) {
>> + Expression e;
>> +
>> + e.type = I->getType();
>> + e.firstVN = lookup_or_add(I->getOperand(0));
>> + e.secondVN = lookup_or_add(I->getOperand(1));
>> + e.thirdVN = 0;
>> + e.function = 0;
>> + e.opcode = Expression::INSERTVALUE;
>> +
>> + for (InsertValueInst::op_iterator OI = I->op_begin()+2,
>> + OE = I->op_end(); OI != OE; ++OI)
>> + e.varargs.push_back(lookup_or_add(I));
>> +
>> + return e;
>> +}
>> +
>> +Expression ValueTable::create_expression(ExtractValueInst* I) {
>> + Expression e;
>> +
>> + e.type = I->getType();
>> + e.firstVN = lookup_or_add(I->getOperand(0));
>> + e.secondVN = lookup_or_add(I->getOperand(1));
>> + e.thirdVN = 0;
>> + e.function = 0;
>> + e.opcode = Expression::EXTRACTVALUE;
>> +
>> + for (InsertValueInst::op_iterator OI = I->op_begin()+2,
>> + OE = I->op_end(); OI != OE; ++OI)
>> + e.varargs.push_back(lookup_or_add(I));
>> +
>> + return e;
>> +}
>> +
>> Expression ValueTable::create_expression(CallInst* C) {
>> Expression e;
>>
>> @@ -541,6 +577,32 @@
>> valueNumbering.insert(std::make_pair(V, nextValueNumber));
>> return nextValueNumber++;
>> }
>> + } else if (InsertValueInst* II = dyn_cast<InsertValueInst>(V)) {
>> + Expression e = create_expression(II);
>> +
>> + DenseMap<Expression, uint32_t>::iterator EI =
>> expressionNumbering.find(e);
>> + if (EI != expressionNumbering.end()) {
>> + valueNumbering.insert(std::make_pair(V, EI->second));
>> + return EI->second;
>> + } else {
>> + expressionNumbering.insert(std::make_pair(e,
>> nextValueNumber));
>> + valueNumbering.insert(std::make_pair(V, nextValueNumber));
>> +
>> + return nextValueNumber++;
>> + }
>> + } else if (ExtractValueInst* E = dyn_cast<ExtractValueInst>(V)) {
>> + Expression e = create_expression(E);
>> +
>> + DenseMap<Expression, uint32_t>::iterator EI =
>> expressionNumbering.find(e);
>> + if (EI != expressionNumbering.end()) {
>> + valueNumbering.insert(std::make_pair(V, EI->second));
>> + return EI->second;
>> + } else {
>> + expressionNumbering.insert(std::make_pair(e,
>> nextValueNumber));
>> + valueNumbering.insert(std::make_pair(V, nextValueNumber));
>> +
>> + return nextValueNumber++;
>> + }
>> } else if (BinaryOperator* BO = dyn_cast<BinaryOperator>(V)) {
>> Expression e = create_expression(BO);
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080619/ffd8f82a/attachment.bin>
More information about the llvm-commits
mailing list