[PATCH] D61562: [LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set on a non-integer operation.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 4 23:26:48 PDT 2019


craig.topper created this revision.
craig.topper added reviewers: spatel, dblaikie, jyknight, arsenm.
Herald added subscribers: hiraditya, wdng.
Herald added a project: LLVM.

This check appears to be a leftover from when add/sub/mul could be either integer or fp. The NSW/NUW flags are only set for add/sub/mul/shl earlier. And we check that those operations only have integer types just below this. So it seems unnecessary to explicitly error for NUW/NSW being used on a add/sub/mul that have the wrong type that would later error for that.


https://reviews.llvm.org/D61562

Files:
  llvm/lib/AsmParser/LLParser.cpp


Index: llvm/lib/AsmParser/LLParser.cpp
===================================================================
--- llvm/lib/AsmParser/LLParser.cpp
+++ llvm/lib/AsmParser/LLParser.cpp
@@ -3393,12 +3393,6 @@
       return true;
     if (Val0->getType() != Val1->getType())
       return Error(ID.Loc, "operands of constexpr must have same type");
-    if (!Val0->getType()->isIntOrIntVectorTy()) {
-      if (NUW)
-        return Error(ModifierLoc, "nuw only applies to integer operations");
-      if (NSW)
-        return Error(ModifierLoc, "nsw only applies to integer operations");
-    }
     // Check that the type is valid for the operator.
     switch (Opc) {
     case Instruction::Add:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61562.198163.patch
Type: text/x-patch
Size: 690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190505/8170045d/attachment.bin>


More information about the llvm-commits mailing list