generalize the sadd creation code to not require that the
authorChris Lattner <sabre@nondot.org>
Sun, 19 Dec 2010 18:35:09 +0000 (18:35 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 19 Dec 2010 18:35:09 +0000 (18:35 +0000)
commit0a62474830f50b423329470caeb9a4e4da14a607
treeff08ba86ca2158565d9c438e174ba0d1239d9d54
parentdd7e83737491b14ebf98e09fa6cb9b515f9f2e3e
generalize the sadd creation code to not require that the
sadd formed is half the size of the original type. We can
now compile this into a sadd.i8:

unsigned char X(char a, char b) {
  int res = a+b;
  if ((unsigned )(res+128) > 255U)
    abort();
  return res;
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122178 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/overflow.ll