GetElementPtr and inbounds attibute


I would like to ask about GetElementPtr in the context of bit code generation.
Is there a rule, based on which pointer access is generated as getelementptr inbounds instruction?
I’m especially interested in how it is decided when the instruction should have the inbounds attribute.

Thank you in advance for help,

Best regards
Tomek Kuchta