[cfe-dev] [LLVMdev] proposal for exploiting undefined behavior much more aggressively

Chris Lattner clattner at apple.com
Fri Jul 27 10:02:13 PDT 2012


On Jul 27, 2012, at 1:44 AM, Chandler Carruth wrote:
> I think[1] that the primary issue is that it should never be the *goal* to exploit undefined behavior. The goal should be faster generated code, smaller generated code, or some other valuable thing for a compiler. Then, if the undefined behavior gives a particular opportunity to reach that goal, we should consider taking that opportunity. To simply willfully transform code with undefined behavior code into ludicrous constructs is to put the cart before the horse.

Yep, I completely agree.  If we could do everything we wanted purely analytically, it would be best to *not* depend on UB ever.  Unfortunately, there are some things that UB makes possible that are otherwise infeasible, and these *are* generally useful for most well behaved programs (type based alias analysis is one example).

-Chris




More information about the cfe-dev mailing list