Skip to content

Commit 0fd81af

Browse files
committed
Remove the verification of cttz & ctlz from the SIL verifier.
This change is related to the effort of enabling the SIL verifier by default in debug builds. This commit removes the code that verifies that the second argument of the cttz and ctlz intrinsics is a constant. The SIL verifier needs to be able to verify SIL in its early stages before optimizations clean it up. The SIL Verifier complains that the value 'false' that we pass to ctlz is non-constant. Right now we don't have a way to pass boolean values to the second parameter of cttz and ctlz without creating SIL-level control flow. This control flow prevents the verifier from detecting that the argument is a constant and verification fails. I tried to re-write our uses of ctlz using builtins, but the result was cryptic. I am removing this check from the verifier mainly because it does not contribute to the safety of our programs. LLVM already verifies that the last argument is a constant and I believe that its okay not to verify this trait at SIL level.
1 parent f181452 commit 0fd81af

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

lib/SIL/Verifier.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
782782
break;
783783
case llvm::Intrinsic::ctlz: // llvm.ctlz
784784
case llvm::Intrinsic::cttz: // llvm.cttz
785-
require(!isa<SILArgument>(BI->getArguments()[1]),
786-
"is_zero_undef argument of bit counting intrinsics must be an "
787-
"integer literal");
788785
break;
789786
case llvm::Intrinsic::memcpy:
790787
case llvm::Intrinsic::memmove:

0 commit comments

Comments
 (0)