[Hoisting] Add test for FP due to no purity check

Reviewed By: ngorogiannis

Differential Revision: D10105786

fbshipit-source-id: 0a8dc9b73
master
Ezgi Çiçek 7 years ago committed by Facebook Github Bot
parent aca0b8e130
commit b54307f5d0

@ -0,0 +1,33 @@
/*
* 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 HoistIndirect {
class Test {
int a = 0;
void set_test(Test test) {
test.a = 5;
}
int get_test(Test test) {
return test.a;
}
int indirect_modification_dont_hoist_FP(int size) {
int d = 0;
Test t = new Test();
for (int i = 0; i < size; i++) {
set_test(t);
d = get_test(t); // don't hoist since t changes
}
return d;
}
}
}

@ -8,3 +8,5 @@ codetoanalyze/java/hoisting/Hoist.java, Hoist.two_function_call_hoist(int):void,
codetoanalyze/java/hoisting/Hoist.java, Hoist.two_function_call_hoist(int):void, 4, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to int Hoist.bar(int) at line 35]
codetoanalyze/java/hoisting/Hoist.java, Hoist.used_in_loop_body_before_def_temp_hoist(int,int[]):void, 6, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to int Hoist.foo(int,int) at line 57]
codetoanalyze/java/hoisting/Hoist.java, Hoist.void_hoist(int):void, 2, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to void Hoist.dumb_foo() at line 183]
codetoanalyze/java/hoisting/HoistIndirect.java, HoistIndirect$Test.indirect_modification_dont_hoist_FP(int):int, 5, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to void HoistIndirect$Test.set_test(HoistIndirect$Test) at line 27]
codetoanalyze/java/hoisting/HoistIndirect.java, HoistIndirect$Test.indirect_modification_dont_hoist_FP(int):int, 6, INVARIANT_CALL, no_bucket, ERROR, [Loop-invariant call to int HoistIndirect$Test.get_test(HoistIndirect$Test) at line 28]

Loading…
Cancel
Save