Skip to content

Commit

Permalink
add some castOp to mergeCast
Browse files Browse the repository at this point in the history
Addresses #628.
  • Loading branch information
PeiMu committed Nov 7, 2022
1 parent 115c8d9 commit 37fb639
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 23 deletions.
46 changes: 46 additions & 0 deletions analysis/statistics/fda580867ec987f9fe22036428b812d69eb5496d.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

changeset: 1354:fda580867ec987f9fe22036428b812d69eb5496d
char kNewtonVersion[] = "0.3-alpha-1354 (fda580867ec987f9fe22036428b812d69eb5496d) (build 11-07-2022-15:[email protected]_64)";
\n./src/noisy/noisy-linux-EN -O0 applications/noisy/helloWorld.n -s
\n./src/newton/newton-linux-EN -v 0 -eP applications/newton/invariants/ViolinWithTemperatureDependence-pigroups.nt

Informational Report:
---------------------
Invariant "ViolinWithTemperatureDependenceForPiGroups" has 2 unique kernels, each with 2 column(s)...

Kernel 0 is a valid kernel:

1 1
-0.5 -0
1 0
0.5 0
0 -1
-0 -1


The ordering of parameters is: P1 P0 P3 P2 P4 P5

Pi group 0, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^( 0) P5^(-0)

Pi group 0, Pi 1 is: P0^(-0) P1^( 1) P2^( 0) P3^( 0) P4^(-1) P5^(-1)


Kernel 1 is a valid kernel:

1 0
-0.5 1
1 -2
0.5 -1
-0 -2
0 -2


The ordering of parameters is: P1 P0 P3 P2 P4 P5

Pi group 1, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^(-0) P5^( 0)

Pi group 1, Pi 1 is: P0^( 1) P1^( 0) P2^(-1) P3^(-2) P4^(-2) P5^(-2)




54 changes: 31 additions & 23 deletions src/newton/newton-irPass-LLVMIR-shrinkTypeByRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ getTypeInfo(State * N, Value * inValue,
switch (inInstType->getTypeID())
{
case Type::IntegerTyID:
typeInformation = getShrinkIntType(N, inValue, vrRangeIt->second);
// typeInformation = getShrinkIntType(N, inValue, vrRangeIt->second);
break;
case Type::FloatTyID:
break;
Expand Down Expand Up @@ -1505,12 +1505,16 @@ mergeCast(State * N, Function & llvmIrFunction,
Instruction * llvmIrInstruction = &*itBB++;
switch (llvmIrInstruction->getOpcode())
{
case Instruction::ZExt:
case Instruction::SExt:
case Instruction::FPExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::BitCast:
case Instruction::FPToUI:
case Instruction::FPToSI:
case Instruction::SIToFP:
case Instruction::UIToFP:
case Instruction::ZExt:
case Instruction::SExt:
case Instruction::FPExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::BitCast:
{
/*
* if the operand(0) is equal to operand(1), remove this inst,
Expand Down Expand Up @@ -1657,12 +1661,16 @@ countCastInst(State * N, Function & llvmIrFunction)
{
switch (llvmIrInstruction.getOpcode())
{
case Instruction::ZExt:
case Instruction::SExt:
case Instruction::FPExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::BitCast:
case Instruction::FPToUI:
case Instruction::FPToSI:
case Instruction::SIToFP:
case Instruction::UIToFP:
case Instruction::ZExt:
case Instruction::SExt:
case Instruction::FPExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::BitCast:
castCountVec[bbId]++;
break;
default:
Expand Down Expand Up @@ -1803,16 +1811,16 @@ getDependencyLink(State * N, Function & llvmIrFunction)
/*match dest with operands*/
insertLink(dependencyLink, llvmIrInstruction.getOperand(0),
&llvmIrInstruction);
case Instruction::FPToUI:
case Instruction::FPToSI:
case Instruction::SIToFP:
case Instruction::UIToFP:
case Instruction::ZExt:
case Instruction::SExt:
case Instruction::FPExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::BitCast:
case Instruction::FPToUI:
case Instruction::FPToSI:
case Instruction::SIToFP:
case Instruction::UIToFP:
case Instruction::ZExt:
case Instruction::SExt:
case Instruction::FPExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::BitCast:
/*check dest*/
break;
case Instruction::Store:
Expand Down

0 comments on commit 37fb639

Please sign in to comment.