[Hoisting] Add FP test for indirect modification in loop

Reviewed By: mbouaziz

Differential Revision: D10288095

fbshipit-source-id: 55cd2870a
master
Ezgi Çiçek 6 years ago committed by Facebook Github Bot
parent affe3d1d60
commit 8a51a70162

@ -0,0 +1,40 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class HoistNoIndirectMod {
int id = 0;
public int increment() {
id = calcNext();
return id;
}
public int calcNext() {
return (id + 1);
}
public int calcSame() {
return id;
}
public int increment_dont_hoist_FP(int n) {
for (int i = 0; i < n; i++) {
id = calcNext(); // shouldn't be hoisted
}
return id;
}
public int modify_and_increment_dont_hoist_FP(int n) {
int p = 0;
for (int i = 0; i < n; i++) {
p += calcNext();
id = i;
}
return p;
}
}

@ -32,3 +32,7 @@ codetoanalyze/java/hoisting/HoistIndirect.java, HoistIndirect.get_ith(int,int[])
codetoanalyze/java/hoisting/HoistIndirect.java, HoistIndirect.nested_change_dont_hoist_FP(int[][],int,int[]):void, 2, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to int HoistIndirect.regionFirst(int[]) at line 152]
codetoanalyze/java/hoisting/HoistIndirect.java, HoistIndirect.regionFirst(int[]):int, 0, PURE_FUNCTION, no_bucket, ERROR, [Side-effect free function int HoistIndirect.regionFirst(int[])]
codetoanalyze/java/hoisting/HoistIndirect.java, HoistIndirect.this_modification_outside_hoist(int):int, 4, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to int HoistIndirect.get() at line 111]
codetoanalyze/java/hoisting/HoistNoIndirectMod.java, HoistNoIndirectMod.calcNext():int, 0, PURE_FUNCTION, no_bucket, ERROR, [Side-effect free function int HoistNoIndirectMod.calcNext()]
codetoanalyze/java/hoisting/HoistNoIndirectMod.java, HoistNoIndirectMod.calcSame():int, 0, PURE_FUNCTION, no_bucket, ERROR, [Side-effect free function int HoistNoIndirectMod.calcSame()]
codetoanalyze/java/hoisting/HoistNoIndirectMod.java, HoistNoIndirectMod.increment_dont_hoist_FP(int):int, 2, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to int HoistNoIndirectMod.calcNext() at line 27]
codetoanalyze/java/hoisting/HoistNoIndirectMod.java, HoistNoIndirectMod.modify_and_increment_dont_hoist_FP(int):int, 3, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to int HoistNoIndirectMod.calcNext() at line 35]

Loading…
Cancel
Save