[llvm-dev] How and where optimizing of undefined behavior happens

Denis Bakhvalov via llvm-dev llvm-dev at lists.llvm.org
Sat Nov 18 10:35:52 PST 2017


Dear community,

I was wondering how exactly clang/llvm handles undefined behavior (UB).
Because of this experiment: https://godbolt.org/g/cEmGHa,
I tend to think that clang is light-weight in this subject and does
not detect UB.
And all the optimizations related to UB are done in llvm via some
optimization pass (passes).

Is it so? If so than what is the name of that pass? And do different
optimization levels detect different UB cases, i.e. will situation
change with O1, O2, O3?

-- 
Best regards,
Denis.


More information about the llvm-dev mailing list