Why would one use SExt vs CreateIntCast

I’m seeing many APIs which seemingly do the same thing, but they seem to go through slightly different code paths.

When I think of integer casts I think sign extension, zero extension or truncation. But there seems to be a IntCast … which does the same thing?

Why does CreateIntCast API exist (same for FP methods as well)?

CreateIntCast is just a helper function that creates the correct instruction (SExt, ZExt or Trunc) depending on the number of bits you passed as source and as destination.

So yes, they do the same thing, but the API from IRBuilder just makes things easier.