]> granicus.if.org Git - llvm/commitdiff
Remove immarg from llvm.expect
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 17 Mar 2019 23:16:18 +0000 (23:16 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 17 Mar 2019 23:16:18 +0000 (23:16 +0000)
The LangRef claimed this was required to be a constant, but this
appears to be wrong.

Fixes bug 41079.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356353 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LangRef.rst
include/llvm/IR/Intrinsics.td
test/Transforms/LowerExpectIntrinsic/PR33346.ll
test/Verifier/intrinsic-immarg.ll

index 009f8554aef5c8906ae6a10a5585e4989c148ed5..fcea8a482a7a189952097bc437d83b95cb5673b2 100644 (file)
@@ -15819,8 +15819,7 @@ Arguments:
 """"""""""
 
 The ``llvm.expect`` intrinsic takes two arguments. The first argument is
-a value. The second argument is an expected value, this needs to be a
-constant value, variables are not allowed.
+a value. The second argument is an expected value.
 
 Semantics:
 """"""""""
index 680fd145f7523ce67761c551f31cc7859dda6599..b26a26f59ac9c0c8ddf54928784a39303950997b 100644 (file)
@@ -689,13 +689,13 @@ let IntrProperties = [IntrInaccessibleMemOnly] in {
                                                        llvm_metadata_ty ]>;
 }
 // FIXME: Add intrinsics for fcmp, fptrunc, fpext, fptoui and fptosi.
-// FIXME: Add intrinsics for fabs and copysign? 
+// FIXME: Add intrinsics for fabs and copysign?
 
 
 //===------------------------- Expect Intrinsics --------------------------===//
 //
 def int_expect : Intrinsic<[llvm_anyint_ty],
-  [LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem, ImmArg<1>]>;
+  [LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
 
 //===-------------------- Bit Manipulation Intrinsics ---------------------===//
 //
index 5bcf93408b1aae15e146a3a64f166a202ea23436..ca962fbdc8f3cca1a18ab2f246481947c81eef22 100644 (file)
@@ -7,12 +7,12 @@ bb:
   store i64 %arg, i64* %tmp, align 8
   %tmp1 = load i64, i64* %tmp, align 8
   %tmp2 = load i64, i64* %tmp, align 8
-  %tmp3 = call i64 @llvm.expect.i64(i64 %tmp1, i64 123)
+  %tmp3 = call i64 @llvm.expect.i64(i64 %tmp1, i64 %tmp2)
   ret i64 %tmp3
 }
 
 ; Function Attrs: nounwind readnone
-declare i64 @llvm.expect.i64(i64, i64 immarg)
+declare i64 @llvm.expect.i64(i64, i64)
 
 
 !llvm.module.flags = !{!0}
index 4a701ddd419dd861f18b71a319ff0eaed55d2750..0be3999f7adbb5213840b50e14681d1a028997c8 100644 (file)
@@ -65,15 +65,6 @@ define void @objectsize(i8* %ptr, i1 %a, i1 %b, i1 %c) {
   ret void
 }
 
-declare i8 @llvm.expect.i8(i8, i8)
-define i8 @expect(i8 %arg0, i8 %arg1) {
-  ; CHECK: immarg operand has non-immediate parameter
-  ; CHECK-NEXT: i8 %arg1
-  ; CHECK-NEXT: %ret = call i8 @llvm.expect.i8(i8 %arg0, i8 %arg1)
-  %ret = call i8 @llvm.expect.i8(i8 %arg0, i8 %arg1)
-  ret i8 %ret
-}
-
 declare i64 @llvm.smul.fix.i64(i64, i64, i32)
 define i64 @smul_fix(i64 %arg0, i64 %arg1, i32 %arg2) {
   ; CHECK: immarg operand has non-immediate parameter