search for: foo_bad

Displaying 1 result from an estimated 1 matches for "foo_bad".

Did you mean: foo_bar
2013 Jul 31
4
[LLVMdev] [Proposal] Speculative execution of function calls
...{ sum += temp; } } Because hoisting the addition is safe. However, code that looks like this is more problematic: int bar(int a); int foo(int n) { int sum = 0; for(int i = 0; i < n; ++i) { int temp = bar(n); sum += temp; } } May not, in general, be transformed into int foo_bad(int n) { int sum = 0; int temp = bar(n); for(int i = 0; i < n; ++i) { sum += temp; } } The first issue is that bar() may have side effects, in which case this transformation is clearly unsafe. Unfortunately, even if bar() is marked "readnone, nounwind", this is still not...