The complexity there involves the datalayout. Certain forms of constant folding require knowing details about the sizes of types, so constant folding is split into two parts: the part that requires the datalayout, and the part that doesn’t. If you’re interested in the history of it, make DataLayout a mandatory part of Module should give you some idea why it works this way.
1 Like