OSDN Git Service

[InstCombine] add test to show missed fold using llvm.assume; NFC
authorSanjay Patel <spatel@rotateright.com>
Mon, 9 Jan 2017 20:18:30 +0000 (20:18 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 9 Jan 2017 20:18:30 +0000 (20:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291472 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/assume.ll

index e0506e4..6e69042 100644 (file)
@@ -176,6 +176,19 @@ define i32 @icmp2(i32 %a) #0 {
   ret i32 %lnot.ext
 }
 
+; FIXME: If the 'not' of a condition is known true, then the condition must be false. 
+
+define i1 @assume_not(i1 %cond) {
+; CHECK-LABEL: @assume_not(
+; CHECK-NEXT:    [[NOTCOND:%.*]] = xor i1 [[COND:%.*]], true
+; CHECK-NEXT:    call void @llvm.assume(i1 [[NOTCOND]])
+; CHECK-NEXT:    ret i1 [[COND]]
+;
+  %notcond = xor i1 %cond, true
+  call void @llvm.assume(i1 %notcond)
+  ret i1 %cond
+}
+
 declare void @escape(i32* %a)
 
 ; Canonicalize a nonnull assumption on a load into metadata form.