[SystemZ] Fix assertion failure in adjustSubwordCmp
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Wed, 16 Dec 2015 18:04:06 +0000 (18:04 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Wed, 16 Dec 2015 18:04:06 +0000 (18:04 +0000)
commit328f32455c29d633f99485b3894c52feaf936091
treece04826a69b78813d527dbb96fb99bf4493fa2b2
parent1a519052e2e91f1024a92c60f44064c17bde63cd
[SystemZ] Fix assertion failure in adjustSubwordCmp

When comparing a zero-extended value against a constant small enough to
be in range of the inner type, it doesn't matter whether a signed or
unsigned compare operation (for the outer type) is being used.  This is
why the code in adjustSubwordCmp had this assertion:

    assert(C.ICmpType == SystemZICMP::Any &&
           "Signedness shouldn't matter here.");

assuming the the caller had already detected that fact.  However, it
turns out that there cases, in particular with always-true or always-
false conditions that have not been eliminated when compiling at -O0,
where this is not true.

Instead of failing an assertion if C.ICmpType is not SystemZICMP::Any
here, we can simply *set* it safely to SystemZICMP::Any, however.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255786 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/SystemZ/SystemZISelLowering.cpp
test/CodeGen/SystemZ/int-cmp-52.ll [new file with mode: 0644]