This isn't useful, and it may result in assumes being removed.
This deals with more fallout from the AA change from rL268068.
Differential D20653
LICM: Do not sink or hoist assume intrinsic calls. pcc on May 25 2016, 5:04 PM. Authored by
Details
Diff Detail Event TimelineComment Actions IIUC this is also a correctness fix, right? Since you could have had: volatile boolean always_false = ...; for (...) if (always_false) assume(false); and hoisting out assume(false) to the loop preheader will make the loop appear dead. Comment Actions Never mind, I was mistaken; you can't hoist out a readnone nounwind function out of control flow anyway, and the same logic should hold for assumes. Comment Actions Yes. I was afraid something like this might happen. I think we need to revert r268068 (and the various follow-up fixes). Thoughts? Comment Actions Can we just make assume use the same machinery we are now using for control Comment Actions I'm fine with reverting it if we aren't going to fix it properly ATM. But of course, for the moment that just means special casing assume in Comment Actions Personally I'd be more comfortable with reverting. If we do need special casing at this point, it seems a little safer to special case to allow optimizations than to special case to inhibit them. Comment Actions Yes, an implementation of assume could be void assume(bool cond) { if (!cond) 1/0; }. Comment Actions I wasn't aware of such a restriction -- can you spell it out explicitly? We do have intrinsics like patchpoint and statepoint that can execute arbitrary code, so stating that intrinsics have no UB at all is probably not okay. Comment Actions Good point, although those aren't marked as readnone. I'm quite possibly mistaken on this point, although it seems like we should have some kind of distinction on this front since most readnone intrinsics don't have value-dependent UB. We might need a safe-to-speculate attribute or something like that, however. |