1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[FileCheck] Don't scan past the closing CHECK-DAG for CHECK-NOT inside CHECK-DAG

If there's enough data in fron of it the skipped region would just
become arbitrarily large, and we scan for the CHECK-NOT everywhere.

llvm-svn: 304900
This commit is contained in:
Benjamin Kramer 2017-06-07 12:06:45 +00:00
parent 16203cc75a
commit 8fcc607c3a
2 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,10 @@ add r11, r3, r4
add r10, r1, r2
mul r5, r10, r11
# begin
# end
xor
; CHECK-DAG: add [[REG1:r[0-9]+]], r1, r2
; CHECK-DAG: add [[REG2:r[0-9]+]], r3, r4
; CHECK: mul r5, [[REG1]], [[REG2]]
@ -24,3 +28,8 @@ mul r5, r10, r11
; CHECK-DAG: add [[REG2:r[0-9]+]], r3, r4
; CHECK-NOT: xor
; CHECK-DAG: mul r5, [[REG1]], [[REG2]]
; CHECK-DAG: begin
; CHECK-NOT: xor
; CHECK-DAG: end
; CHECK: xor

View File

@ -1203,7 +1203,7 @@ size_t CheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,
// If there's CHECK-NOTs between two CHECK-DAGs or from CHECK to
// CHECK-DAG, verify that there's no 'not' strings occurred in that
// region.
StringRef SkippedRegion = Buffer.substr(LastPos, MatchPos);
StringRef SkippedRegion = Buffer.slice(LastPos, MatchPos);
if (CheckNot(SM, SkippedRegion, NotStrings, VariableTable))
return StringRef::npos;
// Clear "not strings".