On Fri, Oct 12, 2012 at 9:25 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote: > On Wed, Oct 10, 2012 at 7:33 PM, Jonathan Neuschäfer > <j.neuschaefer@xxxxxxx> wrote: >> I can't say with certainty that it's safe either, so I probably should >> have marked the patch with "request for comments". >> >> AFAICT there are three reasons an instruction cannot be moved up or down >> within a basic block: >> 1. If it takes previous SSA values as arguments, it can't be moved >> above the corresponding intructions. >> 2. If its value is used as an argument of an instruction further down >> in the BB, it can't be moved below that instruction. >> 3. Swapping two instructions that influence or are influenced by the >> "global state" (sorry for the loose wording), e.g. by doing memory >> accesses, performing I/O, or calling functions (which in turn can >> do about anything in general), is generally unsafe. >> >> Case 1 doesn't apply because PHI nodes don't use values computed in the >> same invocation of their basic block. Case 2 doesn't apply as I'm not >> moving the PHI nodes down. Case 3 doesn't seem to apply either. >> >> That's how I think this patch is safe. > > Sounds plausible but I'm still uneasy with the idea that LLVM backend > needs to reshuffle instructions like this. > > Would it be possible to solve this in the frontend? Linus, Chris, any thoughts on this? -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html