search for: pure_div

Displaying 2 results from an estimated 2 matches for "pure_div".

2020 Aug 13
3
Deterministic function return attribute
Hi! I'm interested in what attributes in LLVM mean, specifically how to say that the result is always the same for the given input parameters. The main thing would be to merge two calls with the same parameters when the function is declared but not defined. (just like two stores). I'll call this property mergability. %1 := call @test(%0) %2 := call @test(%0) and the optimization would
2020 Aug 14
2
Fwd: Deterministic function return attribute
...ttps://godbolt.org/z/hnY71v >> >> `speculatable` means it is `readnone` and doesn't cause UB. As a >> consequence it is allowed to eagerly execute the function. `readnone` >> (aka `__attribute__((const))`) is not sufficient because of things like >> this: `int pure_div(int a, int b) { return a / b; }` >> While there is certainly no memory access or anything else that would >> make it not only depend on the arguments, you cannot hoist a call to >> `pure_div` out of a conditional like `if (b != 0) r = pure_div(a, b);`. >> >> `read...