[PATCH] D139890: [FuzzMutate] InstModStrategy: switch nsw/nuw/inbount instead of repeated setting it

Peter Rong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 20:50:16 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2328c0e071f5: [FuzzMutate] InstModStrategy: switch nsw/nuw/inbount instead of repeated… (authored by Peter).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139890/new/

https://reviews.llvm.org/D139890

Files:
  llvm/lib/FuzzMutate/IRMutator.cpp


Index: llvm/lib/FuzzMutate/IRMutator.cpp
===================================================================
--- llvm/lib/FuzzMutate/IRMutator.cpp
+++ llvm/lib/FuzzMutate/IRMutator.cpp
@@ -224,10 +224,10 @@
   case Instruction::Mul:
   case Instruction::Sub:
   case Instruction::Shl:
-    Modifications.push_back([&Inst]() { Inst.setHasNoSignedWrap(true); });
-    Modifications.push_back([&Inst]() { Inst.setHasNoSignedWrap(false); });
-    Modifications.push_back([&Inst]() { Inst.setHasNoUnsignedWrap(true); });
-    Modifications.push_back([&Inst]() { Inst.setHasNoUnsignedWrap(false); });
+    Modifications.push_back(
+        [&Inst]() { Inst.setHasNoSignedWrap(!Inst.hasNoSignedWrap()); });
+    Modifications.push_back(
+        [&Inst]() { Inst.setHasNoUnsignedWrap(!Inst.hasNoUnsignedWrap()); });
     break;
   case Instruction::ICmp:
     CI = cast<ICmpInst>(&Inst);
@@ -240,8 +240,8 @@
   // Add inbound flag.
   case Instruction::GetElementPtr:
     GEP = cast<GetElementPtrInst>(&Inst);
-    Modifications.push_back([GEP]() { GEP->setIsInBounds(true); });
-    Modifications.push_back([GEP]() { GEP->setIsInBounds(false); });
+    Modifications.push_back(
+        [GEP]() { GEP->setIsInBounds(!GEP->isInBounds()); });
     break;
   // Add exact flag.
   case Instruction::UDiv:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139890.482702.patch
Type: text/x-patch
Size: 1297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221214/52c51874/attachment.bin>


More information about the llvm-commits mailing list