[PATCH] D47424: [MIRParser] Add parser support for 'true' and 'false' i1s.
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 4 17:21:35 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333970: [MIRParser] Add parser support for 'true' and 'false' i1s. (authored by aemerson, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D47424?vs=149607&id=149877#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47424
Files:
llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
llvm/trunk/test/CodeGen/MIR/Generic/parse-integer-true-false.mir
Index: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1373,8 +1373,11 @@
auto Loc = Token.location();
lex();
- if (Token.isNot(MIToken::IntegerLiteral))
- return error("expected an integer literal");
+ if (Token.isNot(MIToken::IntegerLiteral)) {
+ if (Token.isNot(MIToken::Identifier) ||
+ !(Token.range() == "true" || Token.range() == "false"))
+ return error("expected an integer literal");
+ }
const Constant *C = nullptr;
if (parseIRConstant(Loc, C))
return true;
Index: llvm/trunk/test/CodeGen/MIR/Generic/parse-integer-true-false.mir
===================================================================
--- llvm/trunk/test/CodeGen/MIR/Generic/parse-integer-true-false.mir
+++ llvm/trunk/test/CodeGen/MIR/Generic/parse-integer-true-false.mir
@@ -0,0 +1,11 @@
+# RUN: llc -run-pass none -o - %s | FileCheck %s
+# Parse an i1 being a 'true' or 'false'
+---
+name: i1_true_false
+body: |
+ bb.0:
+ ; CHECK: %0:_(s1) = G_CONSTANT i1 true
+ ; CHECK: %1:_(s1) = G_CONSTANT i1 false
+ %0:_(s1) = G_CONSTANT i1 true
+ %1:_(s1) = G_CONSTANT i1 false
+...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47424.149877.patch
Type: text/x-patch
Size: 1274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180605/f3081b2f/attachment.bin>
More information about the llvm-commits
mailing list