Rework codegen of case ranges
 - Fix multiple issues with the way case ranges were emitted, see test
   cases details about the specific issues.

 - The root issue was not being careful about how basic blocks were
   emitted which led to them being chained together incorrectly,
   resulting in improper control flow.

 - Fixes <rdar://problem/6098585>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54006 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/rdr-6098585-unsigned-caserange.c b/test/CodeGen/rdr-6098585-unsigned-caserange.c
new file mode 100644
index 0000000..adf825c
--- /dev/null
+++ b/test/CodeGen/rdr-6098585-unsigned-caserange.c
@@ -0,0 +1,12 @@
+// RUN: clang --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t &&
+// RUN: grep "ret i32" %t | count 1 &&
+// RUN: grep "ret i32 3" %t | count 1
+
+int f2(unsigned x) {
+  switch(x) {
+  default:
+    return 3;
+  case 0xFFFFFFFF ... 1: // This range should be empty because x is unsigned.
+    return 0;
+  }
+}