[llvm] [Instrumentor] Add instruction flags to NumericIO (PR #200709)

Ethan Luis McDonough via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 00:03:27 PDT 2026


https://github.com/EthanLuisMcDonough updated https://github.com/llvm/llvm-project/pull/200709

>From 00092e212696f0c89048bbe8cf9e8c152192bbe5 Mon Sep 17 00:00:00 2001
From: Ethan Luis McDonough <ethanluismcdonough at gmail.com>
Date: Sat, 30 May 2026 17:53:42 -0500
Subject: [PATCH 1/2] Add numeric instruction property flags

---
 .../llvm/Transforms/IPO/Instrumentor.h        |  24 +++
 llvm/lib/Transforms/IPO/Instrumentor.cpp      | 140 ++++++++++++++++
 .../Instrumentor/default_config.json          |  28 ++++
 .../Instrumentor/module_and_globals.ll        |   8 +-
 .../{operations.ll => numeric.ll}             | 158 +++++++++---------
 .../{operations.json => numeric_config.json}  |  14 ++
 6 files changed, 289 insertions(+), 83 deletions(-)
 rename llvm/test/Instrumentation/Instrumentor/{operations.ll => numeric.ll} (58%)
 rename llvm/test/Instrumentation/Instrumentor/{operations.json => numeric_config.json} (53%)

diff --git a/llvm/include/llvm/Transforms/IPO/Instrumentor.h b/llvm/include/llvm/Transforms/IPO/Instrumentor.h
index 997eea8d933ff..084a8c7617468 100644
--- a/llvm/include/llvm/Transforms/IPO/Instrumentor.h
+++ b/llvm/include/llvm/Transforms/IPO/Instrumentor.h
@@ -1106,6 +1106,13 @@ struct NumericIO : public InstructionIO<
     ReplaceResult,
     PassLeft,
     PassRight,
+    PassHasNoUnsignedWrap,
+    PassHasNoSignedWrap,
+    PassIsExact,
+    PassIsDisjoint,
+    PassHasNoNaNs,
+    PassHasNoInfs,
+    PassHasNoSignedZeros,
     PassId,
     NumConfig,
   };
@@ -1122,6 +1129,23 @@ struct NumericIO : public InstructionIO<
                         InstrumentorIRBuilderTy &IIRB);
   static Value *getRight(Value &V, Type &Ty, InstrumentationConfig &IConf,
                          InstrumentorIRBuilderTy &IIRB);
+  static Value *hasNoUnsignedWrap(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
+  static Value *hasNoSignedWrap(Value &V, Type &Ty,
+                                InstrumentationConfig &IConf,
+                                InstrumentorIRBuilderTy &IIRB);
+  static Value *isExact(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                        InstrumentorIRBuilderTy &IIRB);
+  static Value *isDisjoint(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                           InstrumentorIRBuilderTy &IIRB);
+  static Value *hasNoNaNs(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                          InstrumentorIRBuilderTy &IIRB);
+  static Value *hasNoInfs(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                          InstrumentorIRBuilderTy &IIRB);
+  static Value *hasNoSignedZeros(Value &V, Type &Ty,
+                                 InstrumentationConfig &IConf,
+                                 InstrumentorIRBuilderTy &IIRB);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
diff --git a/llvm/lib/Transforms/IPO/Instrumentor.cpp b/llvm/lib/Transforms/IPO/Instrumentor.cpp
index 9f6d82c5fefbd..9d61951c2ab3d 100644
--- a/llvm/lib/Transforms/IPO/Instrumentor.cpp
+++ b/llvm/lib/Transforms/IPO/Instrumentor.cpp
@@ -1705,6 +1705,104 @@ Value *NumericIO::getRight(Value &V, Type &Ty, InstrumentationConfig &IConf,
     return PoisonValue::get(&Ty);
 }
 
+Value *NumericIO::hasNoUnsignedWrap(Value &V, Type &Ty,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB) {
+  auto &I = cast<Instruction>(V);
+  switch (I.getOpcode()) {
+  case Instruction::Add:
+  case Instruction::Sub:
+  case Instruction::Mul:
+  case Instruction::Shl:
+    return getCI(&Ty, I.hasNoUnsignedWrap());
+  default:
+    return PoisonValue::get(&Ty);
+  }
+}
+
+Value *NumericIO::hasNoSignedWrap(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB) {
+  auto &I = cast<Instruction>(V);
+  switch (I.getOpcode()) {
+  case Instruction::Add:
+  case Instruction::Sub:
+  case Instruction::Mul:
+  case Instruction::Shl:
+    return getCI(&Ty, I.hasNoSignedWrap());
+  default:
+    return PoisonValue::get(&Ty);
+  }
+}
+
+Value *NumericIO::isExact(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                          InstrumentorIRBuilderTy &IIRB) {
+  auto &I = cast<Instruction>(V);
+  switch (I.getOpcode()) {
+  case Instruction::AShr:
+  case Instruction::LShr:
+  case Instruction::SDiv:
+  case Instruction::UDiv:
+    return getCI(&Ty, I.isExact());
+  default:
+    return PoisonValue::get(&Ty);
+  }
+}
+
+Value *NumericIO::isDisjoint(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                             InstrumentorIRBuilderTy &IIRB) {
+  if (auto *DI = dyn_cast<PossiblyDisjointInst>(&V))
+    return getCI(&Ty, DI->isDisjoint());
+  else
+    return PoisonValue::get(&Ty);
+}
+
+Value *NumericIO::hasNoNaNs(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                            InstrumentorIRBuilderTy &IIRB) {
+  auto &I = cast<Instruction>(V);
+  switch (I.getOpcode()) {
+  case Instruction::FAdd:
+  case Instruction::FSub:
+  case Instruction::FMul:
+  case Instruction::FDiv:
+  case Instruction::FNeg:
+    return getCI(&Ty, I.hasNoNaNs());
+  default:
+    return PoisonValue::get(&Ty);
+  }
+}
+
+Value *NumericIO::hasNoInfs(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                            InstrumentorIRBuilderTy &IIRB) {
+  auto &I = cast<Instruction>(V);
+  switch (I.getOpcode()) {
+  case Instruction::FAdd:
+  case Instruction::FSub:
+  case Instruction::FMul:
+  case Instruction::FDiv:
+  case Instruction::FNeg:
+    return getCI(&Ty, I.hasNoInfs());
+  default:
+    return PoisonValue::get(&Ty);
+  }
+}
+
+Value *NumericIO::hasNoSignedZeros(Value &V, Type &Ty,
+                                   InstrumentationConfig &IConf,
+                                   InstrumentorIRBuilderTy &IIRB) {
+  auto &I = cast<Instruction>(V);
+  switch (I.getOpcode()) {
+  case Instruction::FAdd:
+  case Instruction::FSub:
+  case Instruction::FMul:
+  case Instruction::FDiv:
+  case Instruction::FNeg:
+    return getCI(&Ty, I.hasNoSignedZeros());
+  default:
+    return PoisonValue::get(&Ty);
+  }
+}
+
 void NumericIO::init(InstrumentationConfig &IConf,
                      InstrumentorIRBuilderTy &IIRB, ConfigTy *UserConfig) {
   if (UserConfig)
@@ -1737,6 +1835,48 @@ void NumericIO::init(InstrumentationConfig &IConf,
         IRTArg(IIRB.Int64Ty, "result", "Result of the operation.",
                IRTArg::REPLACABLE | ValArgOpts, getValue,
                Config.has(ReplaceResult) ? replaceValue : nullptr));
+  if (Config.has(PassHasNoUnsignedWrap))
+    IRTArgs.push_back(IRTArg(IIRB.Int8Ty, "has_no_unsigned_wrap",
+                             "Flag indicating the presence of the nuw "
+                             "keyword. This value is poison for "
+                             "instructions that do not support this keyword.",
+                             IRTArg::NONE, hasNoUnsignedWrap));
+  if (Config.has(PassHasNoSignedWrap))
+    IRTArgs.push_back(IRTArg(IIRB.Int8Ty, "has_no_signed_wrap",
+                             "Flag indicating the presence of the nsw "
+                             "keyword. This value is poison for "
+                             "instructions that do not support this keyword.",
+                             IRTArg::NONE, hasNoSignedWrap));
+  if (Config.has(PassIsExact))
+    IRTArgs.push_back(IRTArg(IIRB.Int8Ty, "is_exact",
+                             "Flag indicating the presence of the exact "
+                             "keyword. This value is poison for "
+                             "instructions that do not support this keyword.",
+                             IRTArg::NONE, isExact));
+  if (Config.has(PassIsDisjoint))
+    IRTArgs.push_back(IRTArg(IIRB.Int8Ty, "is_disjoint",
+                             "Flag indicating the presence of the disjoint "
+                             "keyword. This value is poison for "
+                             "instructions that do not support this keyword.",
+                             IRTArg::NONE, isDisjoint));
+  if (Config.has(PassHasNoNaNs))
+    IRTArgs.push_back(IRTArg(IIRB.Int8Ty, "has_no_nans",
+                             "Flag indicating the presence of the nnan "
+                             "fast math flag. This value is poison for "
+                             "instructions that do not support this keyword.",
+                             IRTArg::NONE, hasNoNaNs));
+  if (Config.has(PassHasNoInfs))
+    IRTArgs.push_back(IRTArg(IIRB.Int8Ty, "has_no_infs",
+                             "Flag indicating the presence of the ninf "
+                             "fast math flag. This value is poison for "
+                             "instructions that do not support this keyword.",
+                             IRTArg::NONE, hasNoInfs));
+  if (Config.has(PassHasNoSignedZeros))
+    IRTArgs.push_back(IRTArg(IIRB.Int8Ty, "has_no_signed_zeros",
+                             "Flag indicating the presence of the nsz "
+                             "fast math flag. This value is poison for "
+                             "instructions that do not support this keyword.",
+                             IRTArg::NONE, hasNoSignedZeros));
   addCommonArgs(IConf, IIRB.Ctx, Config.has(PassId));
   IConf.addChoice(*this, IIRB.Ctx);
 }
diff --git a/llvm/test/Instrumentation/Instrumentor/default_config.json b/llvm/test/Instrumentation/Instrumentor/default_config.json
index 8357389c9c43b..6063f707aeca9 100644
--- a/llvm/test/Instrumentation/Instrumentor/default_config.json
+++ b/llvm/test/Instrumentation/Instrumentor/default_config.json
@@ -238,6 +238,20 @@
       "left.description": "The operation's left operand.",
       "right": true,
       "right.description": "The operation's right operand. This value is poison for unary operations.",
+      "has_no_unsigned_wrap": true,
+      "has_no_unsigned_wrap.description": "Flag indicating the presence of the nuw keyword. This value is poison for instructions that do not support this keyword.",
+      "has_no_signed_wrap": true,
+      "has_no_signed_wrap.description": "Flag indicating the presence of the nsw keyword. This value is poison for instructions that do not support this keyword.",
+      "is_exact": true,
+      "is_exact.description": "Flag indicating the presence of the exact keyword. This value is poison for instructions that do not support this keyword.",
+      "is_disjoint": true,
+      "is_disjoint.description": "Flag indicating the presence of the disjoint keyword. This value is poison for instructions that do not support this keyword.",
+      "has_no_nans": true,
+      "has_no_nans.description": "Flag indicating the presence of the nnan fast math flag. This value is poison for instructions that do not support this keyword.",
+      "has_no_infs": true,
+      "has_no_infs.description": "Flag indicating the presence of the ninf fast math flag. This value is poison for instructions that do not support this keyword.",
+      "has_no_signed_zeros": true,
+      "has_no_signed_zeros.description": "Flag indicating the presence of the nsz fast math flag. This value is poison for instructions that do not support this keyword.",
       "id": true,
       "id.description": "A unique ID associated with the given instrumentor call"
     }
@@ -351,6 +365,20 @@
       "result": true,
       "result.replace": true,
       "result.description": "Result of the operation.",
+      "has_no_unsigned_wrap": true,
+      "has_no_unsigned_wrap.description": "Flag indicating the presence of the nuw keyword. This value is poison for instructions that do not support this keyword.",
+      "has_no_signed_wrap": true,
+      "has_no_signed_wrap.description": "Flag indicating the presence of the nsw keyword. This value is poison for instructions that do not support this keyword.",
+      "is_exact": true,
+      "is_exact.description": "Flag indicating the presence of the exact keyword. This value is poison for instructions that do not support this keyword.",
+      "is_disjoint": true,
+      "is_disjoint.description": "Flag indicating the presence of the disjoint keyword. This value is poison for instructions that do not support this keyword.",
+      "has_no_nans": true,
+      "has_no_nans.description": "Flag indicating the presence of the nnan fast math flag. This value is poison for instructions that do not support this keyword.",
+      "has_no_infs": true,
+      "has_no_infs.description": "Flag indicating the presence of the ninf fast math flag. This value is poison for instructions that do not support this keyword.",
+      "has_no_signed_zeros": true,
+      "has_no_signed_zeros.description": "Flag indicating the presence of the nsz fast math flag. This value is poison for instructions that do not support this keyword.",
       "id": true,
       "id.description": "A unique ID associated with the given instrumentor call"
     }
diff --git a/llvm/test/Instrumentation/Instrumentor/module_and_globals.ll b/llvm/test/Instrumentation/Instrumentor/module_and_globals.ll
index 2e5730c39cc68..0577c34226060 100644
--- a/llvm/test/Instrumentation/Instrumentor/module_and_globals.ll
+++ b/llvm/test/Instrumentation/Instrumentor/module_and_globals.ll
@@ -56,17 +56,17 @@ entry:
 ; CHECK-NEXT:    [[TMP28:%.*]] = trunc i64 [[TMP27]] to i32
 ; CHECK-NEXT:    [[TMP29:%.*]] = zext i32 [[TMP14]] to i64
 ; CHECK-NEXT:    [[TMP30:%.*]] = zext i32 [[TMP25]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 14, i64 [[TMP29]], i64 [[TMP30]], i32 12) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 14, i64 [[TMP29]], i64 [[TMP30]], i8 0, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 12) #[[ATTR0]]
 ; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP14]], [[TMP25]]
 ; CHECK-NEXT:    [[TMP17:%.*]] = zext i32 [[ADD]] to i64
-; CHECK-NEXT:    [[TMP18:%.*]] = call i64 @__instrumentor_post_numeric(i64 12, i32 4, i32 14, i64 [[TMP29]], i64 [[TMP30]], i64 [[TMP17]], i32 -12) #[[ATTR0]]
+; CHECK-NEXT:    [[TMP18:%.*]] = call i64 @__instrumentor_post_numeric(i64 12, i32 4, i32 14, i64 [[TMP29]], i64 [[TMP30]], i64 [[TMP17]], i8 0, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -12) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP19:%.*]] = trunc i64 [[TMP18]] to i32
 ; CHECK-NEXT:    [[TMP20:%.*]] = zext i32 [[TMP19]] to i64
 ; CHECK-NEXT:    [[TMP24:%.*]] = zext i32 [[TMP28]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 14, i64 [[TMP20]], i64 [[TMP24]], i32 13) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 14, i64 [[TMP20]], i64 [[TMP24]], i8 0, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 13) #[[ATTR0]]
 ; CHECK-NEXT:    [[ADD3:%.*]] = add nsw i32 [[TMP19]], [[TMP28]]
 ; CHECK-NEXT:    [[TMP22:%.*]] = zext i32 [[ADD3]] to i64
-; CHECK-NEXT:    [[TMP23:%.*]] = call i64 @__instrumentor_post_numeric(i64 12, i32 4, i32 14, i64 [[TMP20]], i64 [[TMP24]], i64 [[TMP22]], i32 -13) #[[ATTR0]]
+; CHECK-NEXT:    [[TMP23:%.*]] = call i64 @__instrumentor_post_numeric(i64 12, i32 4, i32 14, i64 [[TMP20]], i64 [[TMP24]], i64 [[TMP22]], i8 0, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -13) #[[ATTR0]]
 ; CHECK-NEXT:    [[ADD2:%.*]] = trunc i64 [[TMP23]] to i32
 ; CHECK-NEXT:    call void @__instrumentor_post_function(ptr @foo, ptr @__instrumentor_.str.5, i32 0, ptr null, i8 0, i32 -15) #[[ATTR0]]
 ; CHECK-NEXT:    ret i32 [[ADD2]]
diff --git a/llvm/test/Instrumentation/Instrumentor/operations.ll b/llvm/test/Instrumentation/Instrumentor/numeric.ll
similarity index 58%
rename from llvm/test/Instrumentation/Instrumentor/operations.ll
rename to llvm/test/Instrumentation/Instrumentor/numeric.ll
index 8a4e67b00cee5..1c5ba9f60ec64 100644
--- a/llvm/test/Instrumentation/Instrumentor/operations.ll
+++ b/llvm/test/Instrumentation/Instrumentor/numeric.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
-; RUN: opt < %s -passes=instrumentor -instrumentor-read-config-files=%S/operations.json -S | FileCheck %s
+; RUN: opt < %s -passes=instrumentor -instrumentor-read-config-files=%S/numeric_config.json -S | FileCheck %s
 
 define float @test_float(float %p1, float %p2) {
 ; CHECK-LABEL: define float @test_float(
@@ -9,52 +9,52 @@ define float @test_float(float %p1, float %p2) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[TMP0]] to i64
 ; CHECK-NEXT:    [[TMP2:%.*]] = bitcast float [[P2]] to i32
 ; CHECK-NEXT:    [[TMP3:%.*]] = zext i32 [[TMP2]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 15, i64 [[TMP1]], i64 [[TMP3]], i32 1) #[[ATTR0:[0-9]+]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 15, i64 [[TMP1]], i64 [[TMP3]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 1) #[[ATTR0:[0-9]+]]
 ; CHECK-NEXT:    [[A1:%.*]] = fadd float [[P1]], [[P2]]
 ; CHECK-NEXT:    [[TMP4:%.*]] = bitcast float [[A1]] to i32
 ; CHECK-NEXT:    [[TMP5:%.*]] = zext i32 [[TMP4]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 15, i64 [[TMP1]], i64 [[TMP3]], i64 [[TMP5]], i32 -1) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 15, i64 [[TMP1]], i64 [[TMP3]], i64 [[TMP5]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -1) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP6:%.*]] = bitcast float [[P1]] to i32
 ; CHECK-NEXT:    [[TMP7:%.*]] = zext i32 [[TMP6]] to i64
 ; CHECK-NEXT:    [[TMP8:%.*]] = bitcast float [[A1]] to i32
 ; CHECK-NEXT:    [[TMP9:%.*]] = zext i32 [[TMP8]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 19, i64 [[TMP7]], i64 [[TMP9]], i32 2) #[[ATTR0]]
-; CHECK-NEXT:    [[A2:%.*]] = fmul float [[P1]], [[A1]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 19, i64 [[TMP7]], i64 [[TMP9]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 1, i8 0, i32 2) #[[ATTR0]]
+; CHECK-NEXT:    [[A2:%.*]] = fmul ninf float [[P1]], [[A1]]
 ; CHECK-NEXT:    [[TMP10:%.*]] = bitcast float [[A2]] to i32
 ; CHECK-NEXT:    [[TMP11:%.*]] = zext i32 [[TMP10]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 19, i64 [[TMP7]], i64 [[TMP9]], i64 [[TMP11]], i32 -2) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 19, i64 [[TMP7]], i64 [[TMP9]], i64 [[TMP11]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 1, i8 0, i32 -2) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP12:%.*]] = bitcast float [[A2]] to i32
 ; CHECK-NEXT:    [[TMP13:%.*]] = zext i32 [[TMP12]] to i64
 ; CHECK-NEXT:    [[TMP14:%.*]] = bitcast float [[P2]] to i32
 ; CHECK-NEXT:    [[TMP15:%.*]] = zext i32 [[TMP14]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 22, i64 [[TMP13]], i64 [[TMP15]], i32 3) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 22, i64 [[TMP13]], i64 [[TMP15]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 3) #[[ATTR0]]
 ; CHECK-NEXT:    [[A3:%.*]] = fdiv float [[A2]], [[P2]]
 ; CHECK-NEXT:    [[TMP16:%.*]] = bitcast float [[A3]] to i32
 ; CHECK-NEXT:    [[TMP17:%.*]] = zext i32 [[TMP16]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 22, i64 [[TMP13]], i64 [[TMP15]], i64 [[TMP17]], i32 -3) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 22, i64 [[TMP13]], i64 [[TMP15]], i64 [[TMP17]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -3) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP18:%.*]] = bitcast float [[A3]] to i32
 ; CHECK-NEXT:    [[TMP19:%.*]] = zext i32 [[TMP18]] to i64
 ; CHECK-NEXT:    [[TMP20:%.*]] = bitcast float [[A1]] to i32
 ; CHECK-NEXT:    [[TMP21:%.*]] = zext i32 [[TMP20]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 17, i64 [[TMP19]], i64 [[TMP21]], i32 4) #[[ATTR0]]
-; CHECK-NEXT:    [[A4:%.*]] = fsub float [[A3]], [[A1]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 17, i64 [[TMP19]], i64 [[TMP21]], i8 poison, i8 poison, i8 poison, i8 poison, i8 1, i8 0, i8 0, i32 4) #[[ATTR0]]
+; CHECK-NEXT:    [[A4:%.*]] = fsub nnan float [[A3]], [[A1]]
 ; CHECK-NEXT:    [[TMP22:%.*]] = bitcast float [[A4]] to i32
 ; CHECK-NEXT:    [[TMP23:%.*]] = zext i32 [[TMP22]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 17, i64 [[TMP19]], i64 [[TMP21]], i64 [[TMP23]], i32 -4) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 17, i64 [[TMP19]], i64 [[TMP21]], i64 [[TMP23]], i8 poison, i8 poison, i8 poison, i8 poison, i8 1, i8 0, i8 0, i32 -4) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP24:%.*]] = bitcast float [[A4]] to i32
 ; CHECK-NEXT:    [[TMP25:%.*]] = zext i32 [[TMP24]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 13, i64 [[TMP25]], i64 poison, i32 5) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 2, i32 4, i32 13, i64 [[TMP25]], i64 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 5) #[[ATTR0]]
 ; CHECK-NEXT:    [[A5:%.*]] = fneg float [[A4]]
 ; CHECK-NEXT:    [[TMP26:%.*]] = bitcast float [[A5]] to i32
 ; CHECK-NEXT:    [[TMP27:%.*]] = zext i32 [[TMP26]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 13, i64 [[TMP25]], i64 poison, i64 [[TMP27]], i32 -5) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 2, i32 4, i32 13, i64 [[TMP25]], i64 poison, i64 [[TMP27]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -5) #[[ATTR0]]
 ; CHECK-NEXT:    ret float [[A5]]
 ;
 entry:
   %a1 = fadd float %p1, %p2
-  %a2 = fmul float %p1, %a1
+  %a2 = fmul ninf float %p1, %a1
   %a3 = fdiv float %a2, %p2
-  %a4 = fsub float %a3, %a1
+  %a4 = fsub nnan float %a3, %a1
   %a5 = fneg float %a4
   ret float %a5
 }
@@ -65,40 +65,40 @@ define double @test_double(double %p1, double %p2) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast double [[P1]] to i64
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast double [[P2]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 15, i64 [[TMP0]], i64 [[TMP1]], i32 6) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 15, i64 [[TMP0]], i64 [[TMP1]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 6) #[[ATTR0]]
 ; CHECK-NEXT:    [[A1:%.*]] = fadd double [[P1]], [[P2]]
 ; CHECK-NEXT:    [[TMP2:%.*]] = bitcast double [[A1]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 15, i64 [[TMP0]], i64 [[TMP1]], i64 [[TMP2]], i32 -6) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 15, i64 [[TMP0]], i64 [[TMP1]], i64 [[TMP2]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -6) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP3:%.*]] = bitcast double [[P1]] to i64
 ; CHECK-NEXT:    [[TMP4:%.*]] = bitcast double [[A1]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 19, i64 [[TMP3]], i64 [[TMP4]], i32 7) #[[ATTR0]]
-; CHECK-NEXT:    [[A2:%.*]] = fmul double [[P1]], [[A1]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 19, i64 [[TMP3]], i64 [[TMP4]], i8 poison, i8 poison, i8 poison, i8 poison, i8 1, i8 1, i8 1, i32 7) #[[ATTR0]]
+; CHECK-NEXT:    [[A2:%.*]] = fmul fast double [[P1]], [[A1]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = bitcast double [[A2]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 19, i64 [[TMP3]], i64 [[TMP4]], i64 [[TMP5]], i32 -7) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 19, i64 [[TMP3]], i64 [[TMP4]], i64 [[TMP5]], i8 poison, i8 poison, i8 poison, i8 poison, i8 1, i8 1, i8 1, i32 -7) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP6:%.*]] = bitcast double [[A2]] to i64
 ; CHECK-NEXT:    [[TMP7:%.*]] = bitcast double [[P2]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 25, i64 [[TMP6]], i64 [[TMP7]], i32 8) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 25, i64 [[TMP6]], i64 [[TMP7]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 8) #[[ATTR0]]
 ; CHECK-NEXT:    [[A3:%.*]] = frem double [[A2]], [[P2]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = bitcast double [[A3]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 25, i64 [[TMP6]], i64 [[TMP7]], i64 [[TMP8]], i32 -8) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 25, i64 [[TMP6]], i64 [[TMP7]], i64 [[TMP8]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -8) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP9:%.*]] = bitcast double [[A3]] to i64
 ; CHECK-NEXT:    [[TMP10:%.*]] = bitcast double [[A1]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 17, i64 [[TMP9]], i64 [[TMP10]], i32 9) #[[ATTR0]]
-; CHECK-NEXT:    [[A4:%.*]] = fsub double [[A3]], [[A1]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 17, i64 [[TMP9]], i64 [[TMP10]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 1, i32 9) #[[ATTR0]]
+; CHECK-NEXT:    [[A4:%.*]] = fsub nsz double [[A3]], [[A1]]
 ; CHECK-NEXT:    [[TMP11:%.*]] = bitcast double [[A4]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 17, i64 [[TMP9]], i64 [[TMP10]], i64 [[TMP11]], i32 -9) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 17, i64 [[TMP9]], i64 [[TMP10]], i64 [[TMP11]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 1, i32 -9) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP12:%.*]] = bitcast double [[A4]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 13, i64 [[TMP12]], i64 poison, i32 10) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 3, i32 8, i32 13, i64 [[TMP12]], i64 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 10) #[[ATTR0]]
 ; CHECK-NEXT:    [[A5:%.*]] = fneg double [[A4]]
 ; CHECK-NEXT:    [[TMP13:%.*]] = bitcast double [[A5]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 13, i64 [[TMP12]], i64 poison, i64 [[TMP13]], i32 -10) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 3, i32 8, i32 13, i64 [[TMP12]], i64 poison, i64 [[TMP13]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -10) #[[ATTR0]]
 ; CHECK-NEXT:    ret double [[A5]]
 ;
 entry:
   %a1 = fadd double %p1, %p2
-  %a2 = fmul double %p1, %a1
+  %a2 = fmul fast double %p1, %a1
   %a3 = frem double %a2, %p2
-  %a4 = fsub double %a3, %a1
+  %a4 = fsub nsz double %a3, %a1
   %a5 = fneg double %a4
   ret double %a5
 }
@@ -113,34 +113,34 @@ define fp128 @test_fp128(fp128 %p1, fp128 %p2) {
 ; CHECK-NEXT:    [[TMP3:%.*]] = alloca fp128, align 16
 ; CHECK-NEXT:    store fp128 [[P1]], ptr [[TMP3]], align 16
 ; CHECK-NEXT:    store fp128 [[P2]], ptr [[TMP2]], align 16
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 15, ptr [[TMP3]], ptr [[TMP2]], i32 11) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 15, ptr [[TMP3]], ptr [[TMP2]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 11) #[[ATTR0]]
 ; CHECK-NEXT:    [[A1:%.*]] = fadd fp128 [[P1]], [[P2]]
 ; CHECK-NEXT:    store fp128 [[A1]], ptr [[TMP1]], align 16
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 15, ptr [[TMP3]], ptr [[TMP2]], ptr [[TMP1]], i32 -11) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 15, ptr [[TMP3]], ptr [[TMP2]], ptr [[TMP1]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -11) #[[ATTR0]]
 ; CHECK-NEXT:    store fp128 [[P1]], ptr [[TMP3]], align 16
 ; CHECK-NEXT:    store fp128 [[A1]], ptr [[TMP1]], align 16
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 19, ptr [[TMP3]], ptr [[TMP1]], i32 12) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 19, ptr [[TMP3]], ptr [[TMP1]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 12) #[[ATTR0]]
 ; CHECK-NEXT:    [[A2:%.*]] = fmul fp128 [[P1]], [[A1]]
 ; CHECK-NEXT:    store fp128 [[A2]], ptr [[TMP2]], align 16
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 19, ptr [[TMP3]], ptr [[TMP1]], ptr [[TMP2]], i32 -12) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 19, ptr [[TMP3]], ptr [[TMP1]], ptr [[TMP2]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -12) #[[ATTR0]]
 ; CHECK-NEXT:    store fp128 [[A2]], ptr [[TMP3]], align 16
 ; CHECK-NEXT:    store fp128 [[P2]], ptr [[TMP2]], align 16
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 22, ptr [[TMP3]], ptr [[TMP2]], i32 13) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 22, ptr [[TMP3]], ptr [[TMP2]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 13) #[[ATTR0]]
 ; CHECK-NEXT:    [[A3:%.*]] = fdiv fp128 [[A2]], [[P2]]
 ; CHECK-NEXT:    store fp128 [[A3]], ptr [[TMP1]], align 16
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 22, ptr [[TMP3]], ptr [[TMP2]], ptr [[TMP1]], i32 -13) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 22, ptr [[TMP3]], ptr [[TMP2]], ptr [[TMP1]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -13) #[[ATTR0]]
 ; CHECK-NEXT:    store fp128 [[A3]], ptr [[TMP3]], align 16
 ; CHECK-NEXT:    store fp128 [[A1]], ptr [[TMP1]], align 16
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 17, ptr [[TMP3]], ptr [[TMP1]], i32 14) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 17, ptr [[TMP3]], ptr [[TMP1]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 14) #[[ATTR0]]
 ; CHECK-NEXT:    [[A4:%.*]] = fsub fp128 [[A3]], [[A1]]
 ; CHECK-NEXT:    store fp128 [[A4]], ptr [[TMP2]], align 16
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 17, ptr [[TMP3]], ptr [[TMP1]], ptr [[TMP2]], i32 -14) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 17, ptr [[TMP3]], ptr [[TMP1]], ptr [[TMP2]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -14) #[[ATTR0]]
 ; CHECK-NEXT:    store fp128 [[A4]], ptr [[TMP3]], align 16
 ; CHECK-NEXT:    store i64 poison, ptr [[TMP0]], align 4
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 13, ptr [[TMP3]], ptr [[TMP0]], i32 15) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 5, i32 16, i32 13, ptr [[TMP3]], ptr [[TMP0]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 15) #[[ATTR0]]
 ; CHECK-NEXT:    [[A5:%.*]] = fneg fp128 [[A4]]
 ; CHECK-NEXT:    store fp128 [[A5]], ptr [[TMP2]], align 16
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 13, ptr [[TMP3]], ptr [[TMP0]], ptr [[TMP2]], i32 -15) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 5, i32 16, i32 13, ptr [[TMP3]], ptr [[TMP0]], ptr [[TMP2]], i8 poison, i8 poison, i8 poison, i8 poison, i8 0, i8 0, i8 0, i32 -15) #[[ATTR0]]
 ; CHECK-NEXT:    ret fp128 [[A5]]
 ;
 entry:
@@ -158,34 +158,34 @@ define i32 @test_i32(i32 %p1, i32 %p2) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    [[TMP0:%.*]] = zext i32 [[P1]] to i64
 ; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[P2]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 14, i64 [[TMP0]], i64 [[TMP1]], i32 16) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 14, i64 [[TMP0]], i64 [[TMP1]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 16) #[[ATTR0]]
 ; CHECK-NEXT:    [[A1:%.*]] = add i32 [[P1]], [[P2]]
 ; CHECK-NEXT:    [[TMP2:%.*]] = zext i32 [[A1]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 14, i64 [[TMP0]], i64 [[TMP1]], i64 [[TMP2]], i32 -16) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 14, i64 [[TMP0]], i64 [[TMP1]], i64 [[TMP2]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -16) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP3:%.*]] = zext i32 [[P1]] to i64
 ; CHECK-NEXT:    [[TMP4:%.*]] = zext i32 [[A1]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 18, i64 [[TMP3]], i64 [[TMP4]], i32 17) #[[ATTR0]]
-; CHECK-NEXT:    [[A2:%.*]] = mul i32 [[P1]], [[A1]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 18, i64 [[TMP3]], i64 [[TMP4]], i8 1, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 17) #[[ATTR0]]
+; CHECK-NEXT:    [[A2:%.*]] = mul nuw i32 [[P1]], [[A1]]
 ; CHECK-NEXT:    [[TMP5:%.*]] = zext i32 [[A2]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 18, i64 [[TMP3]], i64 [[TMP4]], i64 [[TMP5]], i32 -17) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 18, i64 [[TMP3]], i64 [[TMP4]], i64 [[TMP5]], i8 1, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -17) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP6:%.*]] = zext i32 [[A2]] to i64
 ; CHECK-NEXT:    [[TMP7:%.*]] = zext i32 [[P2]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 21, i64 [[TMP6]], i64 [[TMP7]], i32 18) #[[ATTR0]]
-; CHECK-NEXT:    [[A3:%.*]] = sdiv i32 [[A2]], [[P2]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 21, i64 [[TMP6]], i64 [[TMP7]], i8 poison, i8 poison, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i32 18) #[[ATTR0]]
+; CHECK-NEXT:    [[A3:%.*]] = sdiv exact i32 [[A2]], [[P2]]
 ; CHECK-NEXT:    [[TMP8:%.*]] = zext i32 [[A3]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 21, i64 [[TMP6]], i64 [[TMP7]], i64 [[TMP8]], i32 -18) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 21, i64 [[TMP6]], i64 [[TMP7]], i64 [[TMP8]], i8 poison, i8 poison, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i32 -18) #[[ATTR0]]
 ; CHECK-NEXT:    [[TMP9:%.*]] = zext i32 [[A3]] to i64
 ; CHECK-NEXT:    [[TMP10:%.*]] = zext i32 [[A1]] to i64
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 16, i64 [[TMP9]], i64 [[TMP10]], i32 19) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 4, i32 16, i64 [[TMP9]], i64 [[TMP10]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 19) #[[ATTR0]]
 ; CHECK-NEXT:    [[A4:%.*]] = sub i32 [[A3]], [[A1]]
 ; CHECK-NEXT:    [[TMP11:%.*]] = zext i32 [[A4]] to i64
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 16, i64 [[TMP9]], i64 [[TMP10]], i64 [[TMP11]], i32 -19) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 4, i32 16, i64 [[TMP9]], i64 [[TMP10]], i64 [[TMP11]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -19) #[[ATTR0]]
 ; CHECK-NEXT:    ret i32 [[A4]]
 ;
 entry:
   %a1 = add i32 %p1, %p2
-  %a2 = mul i32 %p1, %a1
-  %a3 = sdiv i32 %a2, %p2
+  %a2 = mul nuw i32 %p1, %a1
+  %a3 = sdiv exact i32 %a2, %p2
   %a4 = sub i32 %a3, %a1
   ret i32 %a4
 }
@@ -194,24 +194,24 @@ define i64 @test_i64(i64 %p1, i64 %p2) {
 ; CHECK-LABEL: define i64 @test_i64(
 ; CHECK-SAME: i64 [[P1:%.*]], i64 [[P2:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 14, i64 [[P1]], i64 [[P2]], i32 20) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 14, i64 [[P1]], i64 [[P2]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 20) #[[ATTR0]]
 ; CHECK-NEXT:    [[A1:%.*]] = add i64 [[P1]], [[P2]]
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 14, i64 [[P1]], i64 [[P2]], i64 [[A1]], i32 -20) #[[ATTR0]]
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 18, i64 [[P1]], i64 [[A1]], i32 21) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 14, i64 [[P1]], i64 [[P2]], i64 [[A1]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -20) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 18, i64 [[P1]], i64 [[A1]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 21) #[[ATTR0]]
 ; CHECK-NEXT:    [[A2:%.*]] = mul i64 [[P1]], [[A1]]
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 18, i64 [[P1]], i64 [[A1]], i64 [[A2]], i32 -21) #[[ATTR0]]
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 20, i64 [[A2]], i64 [[P2]], i32 22) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 18, i64 [[P1]], i64 [[A1]], i64 [[A2]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -21) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 20, i64 [[A2]], i64 [[P2]], i8 poison, i8 poison, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i32 22) #[[ATTR0]]
 ; CHECK-NEXT:    [[A3:%.*]] = udiv i64 [[A2]], [[P2]]
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 20, i64 [[A2]], i64 [[P2]], i64 [[A3]], i32 -22) #[[ATTR0]]
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 16, i64 [[A3]], i64 [[A1]], i32 23) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 20, i64 [[A2]], i64 [[P2]], i64 [[A3]], i8 poison, i8 poison, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i32 -22) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 16, i64 [[A3]], i64 [[A1]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 23) #[[ATTR0]]
 ; CHECK-NEXT:    [[A4:%.*]] = sub i64 [[A3]], [[A1]]
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 16, i64 [[A3]], i64 [[A1]], i64 [[A4]], i32 -23) #[[ATTR0]]
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 29, i64 [[A4]], i64 [[A2]], i32 24) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 16, i64 [[A3]], i64 [[A1]], i64 [[A4]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -23) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 29, i64 [[A4]], i64 [[A2]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 24) #[[ATTR0]]
 ; CHECK-NEXT:    [[A5:%.*]] = and i64 [[A4]], [[A2]]
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 29, i64 [[A4]], i64 [[A2]], i64 [[A5]], i32 -24) #[[ATTR0]]
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 31, i64 [[A5]], i64 [[A3]], i32 25) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 29, i64 [[A4]], i64 [[A2]], i64 [[A5]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -24) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric(i64 12, i32 8, i32 31, i64 [[A5]], i64 [[A3]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 25) #[[ATTR0]]
 ; CHECK-NEXT:    [[A6:%.*]] = xor i64 [[A5]], [[A3]]
-; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 31, i64 [[A5]], i64 [[A3]], i64 [[A6]], i32 -25) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric(i64 12, i32 8, i32 31, i64 [[A5]], i64 [[A3]], i64 [[A6]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -25) #[[ATTR0]]
 ; CHECK-NEXT:    ret i64 [[A6]]
 ;
 entry:
@@ -233,48 +233,48 @@ define i128 @test_i128(i128 %p1, i128 %p2) {
 ; CHECK-NEXT:    [[TMP2:%.*]] = alloca i128, align 8
 ; CHECK-NEXT:    store i128 [[P1]], ptr [[TMP2]], align 4
 ; CHECK-NEXT:    store i128 [[P2]], ptr [[TMP1]], align 4
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 14, ptr [[TMP2]], ptr [[TMP1]], i32 26) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 14, ptr [[TMP2]], ptr [[TMP1]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 26) #[[ATTR0]]
 ; CHECK-NEXT:    [[A1:%.*]] = add i128 [[P1]], [[P2]]
 ; CHECK-NEXT:    store i128 [[A1]], ptr [[TMP0]], align 4
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 14, ptr [[TMP2]], ptr [[TMP1]], ptr [[TMP0]], i32 -26) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 14, ptr [[TMP2]], ptr [[TMP1]], ptr [[TMP0]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -26) #[[ATTR0]]
 ; CHECK-NEXT:    store i128 [[P1]], ptr [[TMP2]], align 4
 ; CHECK-NEXT:    store i128 [[A1]], ptr [[TMP0]], align 4
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 18, ptr [[TMP2]], ptr [[TMP0]], i32 27) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 18, ptr [[TMP2]], ptr [[TMP0]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 27) #[[ATTR0]]
 ; CHECK-NEXT:    [[A2:%.*]] = mul i128 [[P1]], [[A1]]
 ; CHECK-NEXT:    store i128 [[A2]], ptr [[TMP1]], align 4
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 18, ptr [[TMP2]], ptr [[TMP0]], ptr [[TMP1]], i32 -27) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 18, ptr [[TMP2]], ptr [[TMP0]], ptr [[TMP1]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -27) #[[ATTR0]]
 ; CHECK-NEXT:    store i128 [[A2]], ptr [[TMP2]], align 4
 ; CHECK-NEXT:    store i128 [[P2]], ptr [[TMP1]], align 4
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 24, ptr [[TMP2]], ptr [[TMP1]], i32 28) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 24, ptr [[TMP2]], ptr [[TMP1]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 28) #[[ATTR0]]
 ; CHECK-NEXT:    [[A3:%.*]] = srem i128 [[A2]], [[P2]]
 ; CHECK-NEXT:    store i128 [[A3]], ptr [[TMP0]], align 4
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 24, ptr [[TMP2]], ptr [[TMP1]], ptr [[TMP0]], i32 -28) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 24, ptr [[TMP2]], ptr [[TMP1]], ptr [[TMP0]], i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -28) #[[ATTR0]]
 ; CHECK-NEXT:    store i128 [[A3]], ptr [[TMP2]], align 4
 ; CHECK-NEXT:    store i128 [[A1]], ptr [[TMP0]], align 4
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 16, ptr [[TMP2]], ptr [[TMP0]], i32 29) #[[ATTR0]]
-; CHECK-NEXT:    [[A4:%.*]] = sub i128 [[A3]], [[A1]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 16, ptr [[TMP2]], ptr [[TMP0]], i8 0, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 29) #[[ATTR0]]
+; CHECK-NEXT:    [[A4:%.*]] = sub nsw i128 [[A3]], [[A1]]
 ; CHECK-NEXT:    store i128 [[A4]], ptr [[TMP1]], align 4
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 16, ptr [[TMP2]], ptr [[TMP0]], ptr [[TMP1]], i32 -29) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 16, ptr [[TMP2]], ptr [[TMP0]], ptr [[TMP1]], i8 0, i8 1, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -29) #[[ATTR0]]
 ; CHECK-NEXT:    store i128 [[A4]], ptr [[TMP2]], align 4
 ; CHECK-NEXT:    store i128 [[A2]], ptr [[TMP1]], align 4
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 30, ptr [[TMP2]], ptr [[TMP1]], i32 30) #[[ATTR0]]
-; CHECK-NEXT:    [[A5:%.*]] = or i128 [[A4]], [[A2]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 30, ptr [[TMP2]], ptr [[TMP1]], i8 poison, i8 poison, i8 poison, i8 1, i8 poison, i8 poison, i8 poison, i32 30) #[[ATTR0]]
+; CHECK-NEXT:    [[A5:%.*]] = or disjoint i128 [[A4]], [[A2]]
 ; CHECK-NEXT:    store i128 [[A5]], ptr [[TMP0]], align 4
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 30, ptr [[TMP2]], ptr [[TMP1]], ptr [[TMP0]], i32 -30) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 30, ptr [[TMP2]], ptr [[TMP1]], ptr [[TMP0]], i8 poison, i8 poison, i8 poison, i8 1, i8 poison, i8 poison, i8 poison, i32 -30) #[[ATTR0]]
 ; CHECK-NEXT:    store i128 [[A5]], ptr [[TMP2]], align 4
 ; CHECK-NEXT:    store i128 [[A3]], ptr [[TMP0]], align 4
-; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 26, ptr [[TMP2]], ptr [[TMP0]], i32 31) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_pre_numeric_ind(i64 12, i32 16, i32 26, ptr [[TMP2]], ptr [[TMP0]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 31) #[[ATTR0]]
 ; CHECK-NEXT:    [[A6:%.*]] = shl i128 [[A5]], [[A3]]
 ; CHECK-NEXT:    store i128 [[A6]], ptr [[TMP1]], align 4
-; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 26, ptr [[TMP2]], ptr [[TMP0]], ptr [[TMP1]], i32 -31) #[[ATTR0]]
+; CHECK-NEXT:    call void @__instrumentor_post_numeric_ind(i64 12, i32 16, i32 26, ptr [[TMP2]], ptr [[TMP0]], ptr [[TMP1]], i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 -31) #[[ATTR0]]
 ; CHECK-NEXT:    ret i128 [[A6]]
 ;
 entry:
   %a1 = add i128 %p1, %p2
   %a2 = mul i128 %p1, %a1
   %a3 = srem i128 %a2, %p2
-  %a4 = sub i128 %a3, %a1
-  %a5 = or i128 %a4, %a2
+  %a4 = sub nsw i128 %a3, %a1
+  %a5 = or disjoint i128 %a4, %a2
   %a6 = shl i128 %a5, %a3
   ret i128 %a6
 }
diff --git a/llvm/test/Instrumentation/Instrumentor/operations.json b/llvm/test/Instrumentation/Instrumentor/numeric_config.json
similarity index 53%
rename from llvm/test/Instrumentation/Instrumentor/operations.json
rename to llvm/test/Instrumentation/Instrumentor/numeric_config.json
index 72c9d60669f85..3ed9ec2d331f2 100644
--- a/llvm/test/Instrumentation/Instrumentor/operations.json
+++ b/llvm/test/Instrumentation/Instrumentor/numeric_config.json
@@ -10,6 +10,13 @@
       "opcode": true,
       "left": true,
       "right": true,
+      "has_no_unsigned_wrap": true,
+      "has_no_signed_wrap": true,
+      "is_exact": true,
+      "is_disjoint": true,
+      "has_no_nans": true,
+      "has_no_infs": true,
+      "has_no_signed_zeros": true,
       "id": true
     }
   },
@@ -22,6 +29,13 @@
       "left": true,
       "right": true,
       "result": true,
+      "has_no_unsigned_wrap": true,
+      "has_no_signed_wrap": true,
+      "is_exact": true,
+      "is_disjoint": true,
+      "has_no_nans": true,
+      "has_no_infs": true,
+      "has_no_signed_zeros": true,
       "id": true
     }
   }

>From caae724f93c7ac1f3fa0a0476bae16f2bcaac341 Mon Sep 17 00:00:00 2001
From: Ethan Luis McDonough <ethanluismcdonough at gmail.com>
Date: Mon, 1 Jun 2026 02:03:10 -0500
Subject: [PATCH 2/2] Make NumericIO final

---
 llvm/include/llvm/Transforms/IPO/Instrumentor.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/llvm/include/llvm/Transforms/IPO/Instrumentor.h b/llvm/include/llvm/Transforms/IPO/Instrumentor.h
index 084a8c7617468..3412a18b3a16a 100644
--- a/llvm/include/llvm/Transforms/IPO/Instrumentor.h
+++ b/llvm/include/llvm/Transforms/IPO/Instrumentor.h
@@ -1088,14 +1088,15 @@ struct CastIO final
 /// Instrumentation opportunity for numeric operations. This includes Add, FAdd,
 /// Sub, FSub, Mul, FMul, UDiv, FDiv, SDiv, URem, SRem, FRem, Shl, LShr, AShr,
 /// And, Or, Xor, and FNeg.
-struct NumericIO : public InstructionIO<
-                       Instruction::Add, Instruction::FAdd, Instruction::Sub,
-                       Instruction::FSub, Instruction::Mul, Instruction::FMul,
-                       Instruction::UDiv, Instruction::FDiv, Instruction::SDiv,
-                       Instruction::URem, Instruction::SRem, Instruction::FRem,
-                       Instruction::Shl, Instruction::LShr, Instruction::AShr,
-                       Instruction::And, Instruction::Or, Instruction::Xor,
-                       Instruction::FNeg> {
+struct NumericIO final
+    : public InstructionIO<
+          Instruction::Add, Instruction::FAdd, Instruction::Sub,
+          Instruction::FSub, Instruction::Mul, Instruction::FMul,
+          Instruction::UDiv, Instruction::FDiv, Instruction::SDiv,
+          Instruction::URem, Instruction::SRem, Instruction::FRem,
+          Instruction::Shl, Instruction::LShr, Instruction::AShr,
+          Instruction::And, Instruction::Or, Instruction::Xor,
+          Instruction::FNeg> {
   NumericIO(InstrumentationLocation::KindTy Kind) : InstructionIO(Kind) {}
 
   enum ConfigKind {



More information about the llvm-commits mailing list