Skip to content

Commit

Permalink
fix the bug about roll back srcOperand of loadInst in matchDestType
Browse files Browse the repository at this point in the history
Addresses #628.
  • Loading branch information
PeiMu committed Nov 7, 2022
1 parent fda5808 commit 115c8d9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
46 changes: 46 additions & 0 deletions analysis/statistics/2eed18286939bcaf583d5111180c35065f63abe0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

changeset: 1353:2eed18286939bcaf583d5111180c35065f63abe0
char kNewtonVersion[] = "0.3-alpha-1353 (2eed18286939bcaf583d5111180c35065f63abe0) (build 11-07-2022-11:[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)




8 changes: 8 additions & 0 deletions src/newton/newton-irPass-LLVMIR-shrinkTypeByRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,10 @@ matchDestType(State * N, Instruction * inInstruction, BasicBlock & llvmIrBasicBl
typeInfo backType;
backType.signFlag = isSignedValue(inInstruction);
backType.valueType = inInstType;
if (isa<LoadInst>(inInstruction)) {
unsigned ptAddressSpace = srcType->getPointerAddressSpace();
backType.valueType = backType.valueType->getPointerTo(ptAddressSpace);
}
for (size_t id = 0; id < inInstruction->getNumOperands(); id++)
{
auto newTypeValue = rollbackType(N, inInstruction, id, llvmIrBasicBlock, typeChangedInst, backType);
Expand Down Expand Up @@ -974,6 +978,10 @@ matchDestType(State * N, Instruction * inInstruction, BasicBlock & llvmIrBasicBl
/*
* roll back operands to typeInformation.valueType
* */
if (isa<LoadInst>(inInstruction)) {
unsigned ptAddressSpace = srcType->getPointerAddressSpace();
typeInformation.valueType = typeInformation.valueType->getPointerTo(ptAddressSpace);
}
size_t roll_backed_op_num = isa<GetElementPtrInst>(inInstruction) ? 1 : inInstruction->getNumOperands();
for (size_t id = 0; id < roll_backed_op_num; id++)
{
Expand Down

0 comments on commit 115c8d9

Please sign in to comment.