[llvm] 0517772 - Delete unused PoisonChecking utility pass

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 14:24:01 PST 2024


Author: Philip Reames
Date: 2024-12-19T14:23:38-08:00
New Revision: 0517772b4ac20c5d3a0de0d4703354a179833248

URL: https://github.com/llvm/llvm-project/commit/0517772b4ac20c5d3a0de0d4703354a179833248
DIFF: https://github.com/llvm/llvm-project/commit/0517772b4ac20c5d3a0de0d4703354a179833248.diff

LOG: Delete unused PoisonChecking utility pass

This was introduced ~5yrs ago (by me), and has never really gotten
any adoption.  By now, it's significantly out of sync with new/changed
poison propoagation rules.  The idea is still reasonable, but the
imagined use case is largely covered by alive2 these days anyways.

Added: 
    

Modified: 
    llvm/lib/Passes/PassBuilder.cpp
    llvm/lib/Passes/PassRegistry.def
    llvm/lib/Transforms/Instrumentation/CMakeLists.txt
    llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn

Removed: 
    llvm/include/llvm/Transforms/Instrumentation/PoisonChecking.h
    llvm/lib/Transforms/Instrumentation/PoisonChecking.cpp
    llvm/test/Instrumentation/PoisonChecking/basic-flag-validation.ll
    llvm/test/Instrumentation/PoisonChecking/ub-checks.ll


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Instrumentation/PoisonChecking.h b/llvm/include/llvm/Transforms/Instrumentation/PoisonChecking.h
deleted file mode 100644
index 4ec7ec809db710..00000000000000
--- a/llvm/include/llvm/Transforms/Instrumentation/PoisonChecking.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//===- PoisonChecking.h - ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_POISONCHECKING_H
-#define LLVM_TRANSFORMS_INSTRUMENTATION_POISONCHECKING_H
-
-#include "llvm/IR/PassManager.h"
-
-namespace llvm {
-
-struct PoisonCheckingPass : public PassInfoMixin<PoisonCheckingPass> {
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-};
-
-}
-
-#endif // LLVM_TRANSFORMS_INSTRUMENTATION_POISONCHECKING_H

diff  --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index aa5b9077376e05..d70ac48f251180 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -220,7 +220,6 @@
 #include "llvm/Transforms/Instrumentation/PGOCtxProfLowering.h"
 #include "llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h"
 #include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
-#include "llvm/Transforms/Instrumentation/PoisonChecking.h"
 #include "llvm/Transforms/Instrumentation/RealtimeSanitizer.h"
 #include "llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h"
 #include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"

diff  --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index ecc9f554937103..ba3adcb0e317c0 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -115,7 +115,6 @@ MODULE_PASS("partial-inliner", PartialInlinerPass())
 MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
 MODULE_PASS("pgo-instr-gen", PGOInstrumentationGen())
 MODULE_PASS("pgo-instr-use", PGOInstrumentationUse())
-MODULE_PASS("poison-checking", PoisonCheckingPass())
 MODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass(TM))
 MODULE_PASS("print", PrintModulePass(errs()))
 MODULE_PASS("print-callgraph", CallGraphPrinterPass(errs()))

diff  --git a/llvm/lib/Transforms/Instrumentation/CMakeLists.txt b/llvm/lib/Transforms/Instrumentation/CMakeLists.txt
index 5abc7fc8052834..5c437437fe362d 100644
--- a/llvm/lib/Transforms/Instrumentation/CMakeLists.txt
+++ b/llvm/lib/Transforms/Instrumentation/CMakeLists.txt
@@ -19,7 +19,6 @@ add_llvm_component_library(LLVMInstrumentation
   PGOForceFunctionAttrs.cpp
   PGOInstrumentation.cpp
   PGOMemOPSizeOpt.cpp
-  PoisonChecking.cpp
   SanitizerCoverage.cpp
   SanitizerBinaryMetadata.cpp
   ValueProfileCollector.cpp

diff  --git a/llvm/lib/Transforms/Instrumentation/PoisonChecking.cpp b/llvm/lib/Transforms/Instrumentation/PoisonChecking.cpp
deleted file mode 100644
index e094acdc317813..00000000000000
--- a/llvm/lib/Transforms/Instrumentation/PoisonChecking.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-//===- PoisonChecking.cpp - -----------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// Implements a transform pass which instruments IR such that poison semantics
-// are made explicit.  That is, it provides a (possibly partial) executable
-// semantics for every instruction w.r.t. poison as specified in the LLVM
-// LangRef.  There are obvious parallels to the sanitizer tools, but this pass
-// is focused purely on the semantics of LLVM IR, not any particular source
-// language.   If you're looking for something to see if your C/C++ contains
-// UB, this is not it.
-//
-// The rewritten semantics of each instruction will include the following
-// components:
-//
-// 1) The original instruction, unmodified.
-// 2) A propagation rule which translates dynamic information about the poison
-//    state of each input to whether the dynamic output of the instruction
-//    produces poison.
-// 3) A creation rule which validates any poison producing flags on the
-//    instruction itself (e.g. checks for overflow on nsw).
-// 4) A check rule which traps (to a handler function) if this instruction must
-//    execute undefined behavior given the poison state of it's inputs.
-//
-// This is a must analysis based transform; that is, the resulting code may
-// produce a false negative result (not report UB when actually exists
-// according to the LangRef spec), but should never produce a false positive
-// (report UB where it doesn't exist).
-//
-// Use cases for this pass include:
-// - Understanding (and testing!) the implications of the definition of poison
-//   from the LangRef.
-// - Validating the output of a IR fuzzer to ensure that all programs produced
-//   are well defined on the specific input used.
-// - Finding/confirming poison specific miscompiles by checking the poison
-//   status of an input/IR pair is the same before and after an optimization
-//   transform.
-// - Checking that a bugpoint reduction does not introduce UB which didn't
-//   exist in the original program being reduced.
-//
-// The major sources of inaccuracy are currently:
-// - Most validation rules not yet implemented for instructions with poison
-//   relavant flags.  At the moment, only nsw/nuw on add/sub are supported.
-// - UB which is control dependent on a branch on poison is not yet
-//   reported. Currently, only data flow dependence is modeled.
-// - Poison which is propagated through memory is not modeled.  As such,
-//   storing poison to memory and then reloading it will cause a false negative
-//   as we consider the reloaded value to not be poisoned.
-// - Poison propagation across function boundaries is not modeled.  At the
-//   moment, all arguments and return values are assumed not to be poison.
-// - Undef is not modeled.  In particular, the optimizer's freedom to pick
-//   concrete values for undef bits so as to maximize potential for producing
-//   poison is not modeled.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Transforms/Instrumentation/PoisonChecking.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/Analysis/ValueTracking.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/Module.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-
-#define DEBUG_TYPE "poison-checking"
-
-static cl::opt<bool>
-LocalCheck("poison-checking-function-local",
-           cl::init(false),
-           cl::desc("Check that returns are non-poison (for testing)"));
-
-
-static bool isConstantFalse(Value* V) {
-  assert(V->getType()->isIntegerTy(1));
-  if (auto *CI = dyn_cast<ConstantInt>(V))
-    return CI->isZero();
-  return false;
-}
-
-static Value *buildOrChain(IRBuilder<> &B, ArrayRef<Value*> Ops) {
-  if (Ops.size() == 0)
-    return B.getFalse();
-  unsigned i = 0;
-  for (; i < Ops.size() && isConstantFalse(Ops[i]); i++) {}
-  if (i == Ops.size())
-    return B.getFalse();
-  Value *Accum = Ops[i++];
-  for (Value *Op : llvm::drop_begin(Ops, i))
-    if (!isConstantFalse(Op))
-      Accum = B.CreateOr(Accum, Op);
-  return Accum;
-}
-
-static void generateCreationChecksForBinOp(Instruction &I,
-                                           SmallVectorImpl<Value*> &Checks) {
-  assert(isa<BinaryOperator>(I));
-
-  IRBuilder<> B(&I);
-  Value *LHS = I.getOperand(0);
-  Value *RHS = I.getOperand(1);
-  switch (I.getOpcode()) {
-  default:
-    return;
-  case Instruction::Add: {
-    if (I.hasNoSignedWrap()) {
-      auto *OverflowOp =
-        B.CreateBinaryIntrinsic(Intrinsic::sadd_with_overflow, LHS, RHS);
-      Checks.push_back(B.CreateExtractValue(OverflowOp, 1));
-    }
-    if (I.hasNoUnsignedWrap()) {
-      auto *OverflowOp =
-        B.CreateBinaryIntrinsic(Intrinsic::uadd_with_overflow, LHS, RHS);
-      Checks.push_back(B.CreateExtractValue(OverflowOp, 1));
-    }
-    break;
-  }
-  case Instruction::Sub: {
-    if (I.hasNoSignedWrap()) {
-      auto *OverflowOp =
-        B.CreateBinaryIntrinsic(Intrinsic::ssub_with_overflow, LHS, RHS);
-      Checks.push_back(B.CreateExtractValue(OverflowOp, 1));
-    }
-    if (I.hasNoUnsignedWrap()) {
-      auto *OverflowOp =
-        B.CreateBinaryIntrinsic(Intrinsic::usub_with_overflow, LHS, RHS);
-      Checks.push_back(B.CreateExtractValue(OverflowOp, 1));
-    }
-    break;
-  }
-  case Instruction::Mul: {
-    if (I.hasNoSignedWrap()) {
-      auto *OverflowOp =
-        B.CreateBinaryIntrinsic(Intrinsic::smul_with_overflow, LHS, RHS);
-      Checks.push_back(B.CreateExtractValue(OverflowOp, 1));
-    }
-    if (I.hasNoUnsignedWrap()) {
-      auto *OverflowOp =
-        B.CreateBinaryIntrinsic(Intrinsic::umul_with_overflow, LHS, RHS);
-      Checks.push_back(B.CreateExtractValue(OverflowOp, 1));
-    }
-    break;
-  }
-  case Instruction::UDiv: {
-    if (I.isExact()) {
-      auto *Check =
-        B.CreateICmp(ICmpInst::ICMP_NE, B.CreateURem(LHS, RHS),
-                     ConstantInt::get(LHS->getType(), 0));
-      Checks.push_back(Check);
-    }
-    break;
-  }
-  case Instruction::SDiv: {
-    if (I.isExact()) {
-      auto *Check =
-        B.CreateICmp(ICmpInst::ICMP_NE, B.CreateSRem(LHS, RHS),
-                     ConstantInt::get(LHS->getType(), 0));
-      Checks.push_back(Check);
-    }
-    break;
-  }
-  case Instruction::AShr:
-  case Instruction::LShr:
-  case Instruction::Shl: {
-    Value *ShiftCheck =
-      B.CreateICmp(ICmpInst::ICMP_UGE, RHS,
-                   ConstantInt::get(RHS->getType(),
-                                    LHS->getType()->getScalarSizeInBits()));
-    Checks.push_back(ShiftCheck);
-    break;
-  }
-  };
-}
-
-/// Given an instruction which can produce poison on non-poison inputs
-/// (i.e. canCreatePoison returns true), generate runtime checks to produce
-/// boolean indicators of when poison would result.
-static void generateCreationChecks(Instruction &I,
-                                   SmallVectorImpl<Value*> &Checks) {
-  IRBuilder<> B(&I);
-  if (isa<BinaryOperator>(I) && !I.getType()->isVectorTy())
-    generateCreationChecksForBinOp(I, Checks);
-
-  // Handle non-binops separately
-  switch (I.getOpcode()) {
-  default:
-    // Note there are a couple of missing cases here, once implemented, this
-    // should become an llvm_unreachable.
-    break;
-  case Instruction::ExtractElement: {
-    Value *Vec = I.getOperand(0);
-    auto *VecVTy = dyn_cast<FixedVectorType>(Vec->getType());
-    if (!VecVTy)
-      break;
-    Value *Idx = I.getOperand(1);
-    unsigned NumElts = VecVTy->getNumElements();
-    Value *Check =
-      B.CreateICmp(ICmpInst::ICMP_UGE, Idx,
-                   ConstantInt::get(Idx->getType(), NumElts));
-    Checks.push_back(Check);
-    break;
-  }
-  case Instruction::InsertElement: {
-    Value *Vec = I.getOperand(0);
-    auto *VecVTy = dyn_cast<FixedVectorType>(Vec->getType());
-    if (!VecVTy)
-      break;
-    Value *Idx = I.getOperand(2);
-    unsigned NumElts = VecVTy->getNumElements();
-    Value *Check =
-      B.CreateICmp(ICmpInst::ICMP_UGE, Idx,
-                   ConstantInt::get(Idx->getType(), NumElts));
-    Checks.push_back(Check);
-    break;
-  }
-  };
-}
-
-static Value *getPoisonFor(DenseMap<Value *, Value *> &ValToPoison, Value *V) {
-  auto Itr = ValToPoison.find(V);
-  if (Itr != ValToPoison.end())
-    return Itr->second;
-  if (isa<Constant>(V)) {
-    return ConstantInt::getFalse(V->getContext());
-  }
-  // Return false for unknwon values - this implements a non-strict mode where
-  // unhandled IR constructs are simply considered to never produce poison.  At
-  // some point in the future, we probably want a "strict mode" for testing if
-  // nothing else.
-  return ConstantInt::getFalse(V->getContext());
-}
-
-static void CreateAssert(IRBuilder<> &B, Value *Cond) {
-  assert(Cond->getType()->isIntegerTy(1));
-  if (auto *CI = dyn_cast<ConstantInt>(Cond))
-    if (CI->isAllOnesValue())
-      return;
-
-  Module *M = B.GetInsertBlock()->getModule();
-  M->getOrInsertFunction("__poison_checker_assert",
-                         Type::getVoidTy(M->getContext()),
-                         Type::getInt1Ty(M->getContext()));
-  Function *TrapFunc = M->getFunction("__poison_checker_assert");
-  B.CreateCall(TrapFunc, Cond);
-}
-
-static void CreateAssertNot(IRBuilder<> &B, Value *Cond) {
-  assert(Cond->getType()->isIntegerTy(1));
-  CreateAssert(B, B.CreateNot(Cond));
-}
-
-static bool rewrite(Function &F) {
-  auto * const Int1Ty = Type::getInt1Ty(F.getContext());
-
-  DenseMap<Value *, Value *> ValToPoison;
-
-  for (BasicBlock &BB : F)
-    for (auto I = BB.begin(); isa<PHINode>(&*I); I++) {
-      auto *OldPHI = cast<PHINode>(&*I);
-      auto *NewPHI = PHINode::Create(Int1Ty, OldPHI->getNumIncomingValues());
-      for (unsigned i = 0; i < OldPHI->getNumIncomingValues(); i++)
-        NewPHI->addIncoming(UndefValue::get(Int1Ty),
-                            OldPHI->getIncomingBlock(i));
-      NewPHI->insertBefore(OldPHI);
-      ValToPoison[OldPHI] = NewPHI;
-    }
-
-  for (BasicBlock &BB : F)
-    for (Instruction &I : BB) {
-      if (isa<PHINode>(I)) continue;
-
-      IRBuilder<> B(cast<Instruction>(&I));
-
-      // Note: There are many more sources of documented UB, but this pass only
-      // attempts to find UB triggered by propagation of poison.
-      SmallVector<const Value *, 4> NonPoisonOps;
-      SmallPtrSet<const Value *, 4> SeenNonPoisonOps;
-      getGuaranteedNonPoisonOps(&I, NonPoisonOps);
-      for (const Value *Op : NonPoisonOps)
-        if (SeenNonPoisonOps.insert(Op).second)
-          CreateAssertNot(B,
-                          getPoisonFor(ValToPoison, const_cast<Value *>(Op)));
-
-      if (LocalCheck)
-        if (auto *RI = dyn_cast<ReturnInst>(&I))
-          if (RI->getNumOperands() != 0) {
-            Value *Op = RI->getOperand(0);
-            CreateAssertNot(B, getPoisonFor(ValToPoison, Op));
-          }
-
-      SmallVector<Value*, 4> Checks;
-      for (const Use &U : I.operands()) {
-        if (ValToPoison.count(U) && propagatesPoison(U))
-          Checks.push_back(getPoisonFor(ValToPoison, U));
-      }
-
-      if (canCreatePoison(cast<Operator>(&I)))
-        generateCreationChecks(I, Checks);
-      ValToPoison[&I] = buildOrChain(B, Checks);
-    }
-
-  for (BasicBlock &BB : F)
-    for (auto I = BB.begin(); isa<PHINode>(&*I); I++) {
-      auto *OldPHI = cast<PHINode>(&*I);
-      if (!ValToPoison.count(OldPHI))
-        continue; // skip the newly inserted phis
-      auto *NewPHI = cast<PHINode>(ValToPoison[OldPHI]);
-      for (unsigned i = 0; i < OldPHI->getNumIncomingValues(); i++) {
-        auto *OldVal = OldPHI->getIncomingValue(i);
-        NewPHI->setIncomingValue(i, getPoisonFor(ValToPoison, OldVal));
-      }
-    }
-  return true;
-}
-
-
-PreservedAnalyses PoisonCheckingPass::run(Module &M,
-                                          ModuleAnalysisManager &AM) {
-  bool Changed = false;
-  for (auto &F : M)
-    Changed |= rewrite(F);
-
-  return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
-}
-
-PreservedAnalyses PoisonCheckingPass::run(Function &F,
-                                          FunctionAnalysisManager &AM) {
-  return rewrite(F) ? PreservedAnalyses::none() : PreservedAnalyses::all();
-}
-
-/* Major TODO Items:
-   - Control dependent poison UB
-   - Strict mode - (i.e. must analyze every operand)
-     - Poison through memory
-     - Function ABIs
-     - Full coverage of intrinsics, etc.. (ouch)
-
-   Instructions w/Unclear Semantics:
-   - shufflevector - It would seem reasonable for an out of bounds mask element
-     to produce poison, but the LangRef does not state.
-   - all binary ops w/vector operands - The likely interpretation would be that
-     any element overflowing should produce poison for the entire result, but
-     the LangRef does not state.
-   - Floating point binary ops w/fmf flags other than (nnan, noinfs).  It seems
-     strange that only certian flags should be documented as producing poison.
-
-   Cases of clear poison semantics not yet implemented:
-   - Exact flags on ashr/lshr produce poison
-   - NSW/NUW flags on shl produce poison
-   - Inbounds flag on getelementptr produce poison
-   - fptosi/fptoui (out of bounds input) produce poison
-   - Scalable vector types for insertelement/extractelement
-   - Floating point binary ops w/fmf nnan/noinfs flags produce poison
- */

diff  --git a/llvm/test/Instrumentation/PoisonChecking/basic-flag-validation.ll b/llvm/test/Instrumentation/PoisonChecking/basic-flag-validation.ll
deleted file mode 100644
index d32af40f3b0ab1..00000000000000
--- a/llvm/test/Instrumentation/PoisonChecking/basic-flag-validation.ll
+++ /dev/null
@@ -1,322 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -passes=poison-checking -S -poison-checking-function-local < %s | FileCheck %s
-
-; This file contains tests to exercise the custom flag validation rules
-
-define i32 @add_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @add_noflags(
-; CHECK-NEXT:    [[RES:%.*]] = add i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = add i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @add_nsw(i32 %a, i32 %b) {
-; CHECK-LABEL: @add_nsw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[RES:%.*]] = add nsw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = add nsw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @add_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @add_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[RES:%.*]] = add nuw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = add nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @add_nsw_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @add_nsw_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[TMP3:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A]], i32 [[B]])
-; CHECK-NEXT:    [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP3]], 1
-; CHECK-NEXT:    [[TMP5:%.*]] = or i1 [[TMP2]], [[TMP4]]
-; CHECK-NEXT:    [[RES:%.*]] = add nuw nsw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP6:%.*]] = xor i1 [[TMP5]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP6]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = add nsw nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @sub_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @sub_noflags(
-; CHECK-NEXT:    [[RES:%.*]] = sub i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = sub i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @sub_nsw(i32 %a, i32 %b) {
-; CHECK-LABEL: @sub_nsw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[RES:%.*]] = sub nsw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = sub nsw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @sub_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @sub_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.usub.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[RES:%.*]] = sub nuw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = sub nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @sub_nsw_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @sub_nsw_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[TMP3:%.*]] = call { i32, i1 } @llvm.usub.with.overflow.i32(i32 [[A]], i32 [[B]])
-; CHECK-NEXT:    [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP3]], 1
-; CHECK-NEXT:    [[TMP5:%.*]] = or i1 [[TMP2]], [[TMP4]]
-; CHECK-NEXT:    [[RES:%.*]] = sub nuw nsw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP6:%.*]] = xor i1 [[TMP5]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP6]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = sub nsw nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @mul_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @mul_noflags(
-; CHECK-NEXT:    [[RES:%.*]] = mul i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = mul i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @mul_nsw(i32 %a, i32 %b) {
-; CHECK-LABEL: @mul_nsw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[RES:%.*]] = mul nsw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = mul nsw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @mul_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @mul_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[RES:%.*]] = mul nuw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = mul nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @mul_nsw_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @mul_nsw_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[A:%.*]], i32 [[B:%.*]])
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[TMP3:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[A]], i32 [[B]])
-; CHECK-NEXT:    [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP3]], 1
-; CHECK-NEXT:    [[TMP5:%.*]] = or i1 [[TMP2]], [[TMP4]]
-; CHECK-NEXT:    [[RES:%.*]] = mul nuw nsw i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP6:%.*]] = xor i1 [[TMP5]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP6]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = mul nsw nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @sdiv_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @sdiv_noflags(
-; CHECK-NEXT:    [[RES:%.*]] = sdiv i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = sdiv i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @sdiv_exact(i32 %a, i32 %b) {
-; CHECK-LABEL: @sdiv_exact(
-; CHECK-NEXT:    [[TMP1:%.*]] = srem i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
-; CHECK-NEXT:    [[RES:%.*]] = sdiv exact i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = sdiv exact i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @udiv_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @udiv_noflags(
-; CHECK-NEXT:    [[RES:%.*]] = udiv i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = udiv i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @udiv_exact(i32 %a, i32 %b) {
-; CHECK-LABEL: @udiv_exact(
-; CHECK-NEXT:    [[TMP1:%.*]] = urem i32 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0
-; CHECK-NEXT:    [[RES:%.*]] = udiv exact i32 [[A]], [[B]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = udiv exact i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @ashr_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @ashr_noflags(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = ashr i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = ashr i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @ashr_exact(i32 %a, i32 %b) {
-; CHECK-LABEL: @ashr_exact(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = ashr exact i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = ashr exact i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @lshr_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @lshr_noflags(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = lshr i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = lshr i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @lshr_exact(i32 %a, i32 %b) {
-; CHECK-LABEL: @lshr_exact(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = lshr exact i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = lshr exact i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @shl_noflags(i32 %a, i32 %b) {
-; CHECK-LABEL: @shl_noflags(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = shl i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = shl i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @shl_nsw(i32 %a, i32 %b) {
-; CHECK-LABEL: @shl_nsw(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = shl nsw i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = shl nsw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @shl_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @shl_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = shl nuw i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = shl nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @shl_nsw_nuw(i32 %a, i32 %b) {
-; CHECK-LABEL: @shl_nsw_nuw(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[B:%.*]], 32
-; CHECK-NEXT:    [[RES:%.*]] = shl nuw nsw i32 [[A:%.*]], [[B]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = shl nsw nuw i32 %a, %b
-  ret i32 %res
-}
-
-define i32 @extractelement(<4 x i32> %v, i32 %idx) {
-; CHECK-LABEL: @extractelement(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[IDX:%.*]], 4
-; CHECK-NEXT:    [[RES:%.*]] = extractelement <4 x i32> [[V:%.*]], i32 [[IDX]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %res = extractelement <4 x i32> %v, i32 %idx
-  ret i32 %res
-}
-
-define <4 x i32> @insertelement(<4 x i32> %v, i32 %idx, i32 %val) {
-; CHECK-LABEL: @insertelement(
-; CHECK-NEXT:    [[TMP1:%.*]] = icmp uge i32 [[IDX:%.*]], 4
-; CHECK-NEXT:    [[RES:%.*]] = insertelement <4 x i32> [[V:%.*]], i32 [[VAL:%.*]], i32 [[IDX]]
-; CHECK-NEXT:    [[TMP2:%.*]] = xor i1 [[TMP1]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP2]])
-; CHECK-NEXT:    ret <4 x i32> [[RES]]
-;
-  %res = insertelement <4 x i32> %v, i32 %val, i32 %idx
-  ret <4 x i32> %res
-}
-

diff  --git a/llvm/test/Instrumentation/PoisonChecking/ub-checks.ll b/llvm/test/Instrumentation/PoisonChecking/ub-checks.ll
deleted file mode 100644
index 9f9b16eaa88218..00000000000000
--- a/llvm/test/Instrumentation/PoisonChecking/ub-checks.ll
+++ /dev/null
@@ -1,192 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -passes=poison-checking -S < %s | FileCheck %s
-
-; This file contains tests to exercise the UB triggering instructions with
-; a potential source of UB.  The UB source is kept simple; we focus on the
-; UB triggering instructions here.
-
-define void @store(ptr %base, i32 %a) {
-; CHECK-LABEL: @store(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[A]], 1
-; CHECK-NEXT:    [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    store i8 0, ptr [[P]], align 1
-; CHECK-NEXT:    ret void
-;
-  %add = add nsw i32 %a, 1
-  %p = getelementptr i8, ptr %base, i32 %add
-  store i8 0, ptr %p
-  ret void
-}
-
-define void @load(ptr %base, i32 %a) {
-; CHECK-LABEL: @load(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[A]], 1
-; CHECK-NEXT:    [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    [[TMP4:%.*]] = load volatile i8, ptr [[P]], align 1
-; CHECK-NEXT:    ret void
-;
-  %add = add nsw i32 %a, 1
-  %p = getelementptr i8, ptr %base, i32 %add
-  load volatile i8, ptr %p
-  ret void
-}
-
-define void @atomicrmw(ptr %base, i32 %a) {
-; CHECK-LABEL: @atomicrmw(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[A]], 1
-; CHECK-NEXT:    [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    [[TMP4:%.*]] = atomicrmw add ptr [[P]], i8 1 seq_cst, align 1
-; CHECK-NEXT:    ret void
-;
-  %add = add nsw i32 %a, 1
-  %p = getelementptr i8, ptr %base, i32 %add
-  atomicrmw add ptr %p, i8 1 seq_cst
-  ret void
-}
-
-define void @cmpxchg(ptr %base, i32 %a) {
-; CHECK-LABEL: @cmpxchg(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[A]], 1
-; CHECK-NEXT:    [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    [[TMP4:%.*]] = cmpxchg ptr [[P]], i8 1, i8 0 seq_cst seq_cst, align 1
-; CHECK-NEXT:    ret void
-;
-  %add = add nsw i32 %a, 1
-  %p = getelementptr i8, ptr %base, i32 %add
-  cmpxchg ptr %p, i8 1, i8 0 seq_cst seq_cst
-  ret void
-}
-
-define i32 @udiv(ptr %base, i32 %a) {
-; CHECK-LABEL: @udiv(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    [[RES:%.*]] = udiv i32 2048, [[ADD]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %add = add nuw i32 %a, 1
-  %res = udiv i32 2048, %add
-  ret i32 %res
-}
-
-define i32 @sdiv(ptr %base, i32 %a) {
-; CHECK-LABEL: @sdiv(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    [[RES:%.*]] = sdiv i32 2048, [[ADD]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %add = add nuw i32 %a, 1
-  %res = sdiv i32 2048, %add
-  ret i32 %res
-}
-
-define i32 @urem(ptr %base, i32 %a) {
-; CHECK-LABEL: @urem(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    [[RES:%.*]] = urem i32 2048, [[ADD]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %add = add nuw i32 %a, 1
-  %res = urem i32 2048, %add
-  ret i32 %res
-}
-
-define i32 @srem(ptr %base, i32 %a) {
-; CHECK-LABEL: @srem(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    [[RES:%.*]] = srem i32 2048, [[ADD]]
-; CHECK-NEXT:    ret i32 [[RES]]
-;
-  %add = add nuw i32 %a, 1
-  %res = srem i32 2048, %add
-  ret i32 %res
-}
-
-define noundef i32 @select_cond_may_be_poison(i32 %a, i32 %b) {
-; CHECK-LABEL: @select_cond_may_be_poison(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[T:%.*]] = trunc i32 [[ADD]] to i1
-; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[T]], i32 [[ADD]], i32 [[B:%.*]]
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP2]], true
-; CHECK-NEXT:    call void @__poison_checker_assert(i1 [[TMP3]])
-; CHECK-NEXT:    ret i32 [[SEL]]
-;
-  %add = add nuw i32 %a, 1
-  %t = trunc i32 %add to i1
-  %sel = select i1 %t, i32 %add, i32 %b
-  ret i32 %sel
-}
-
-define noundef i32 @select_cond_true_third_op_may_be_poison(i32 %a, i32 %b) {
-; CHECK-LABEL: @select_cond_true_third_op_may_be_poison(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[SEL:%.*]] = select i1 true, i32 [[B:%.*]], i32 [[ADD]]
-; CHECK-NEXT:    ret i32 [[SEL]]
-;
-  %add = add nuw i32 %a, 1
-  %sel = select i1 true, i32 %b, i32 %add
-  ret i32 %sel
-}
-
-define noundef i32 @select_cond_false_second_op_may_be_poison(i1 %c, i32 %a, i32 %b) {
-; CHECK-LABEL: @select_cond_false_second_op_may_be_poison(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[SEL:%.*]] = select i1 false, i32 [[ADD]], i32 [[B:%.*]]
-; CHECK-NEXT:    ret i32 [[SEL]]
-;
-  %add = add nuw i32 %a, 1
-  %sel = select i1 false, i32 %add, i32 %b
-  ret i32 %sel
-}
-
-define noundef i32 @select_unknown_true_third_op_may_be_poison(i1 %c, i32 %a, i32 %b) {
-; CHECK-LABEL: @select_unknown_true_third_op_may_be_poison(
-; CHECK-NEXT:    [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1)
-; CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
-; CHECK-NEXT:    [[ADD:%.*]] = add nuw i32 [[A]], 1
-; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[C:%.*]], i32 [[B:%.*]], i32 [[ADD]]
-; CHECK-NEXT:    ret i32 [[SEL]]
-;
-  %add = add nuw i32 %a, 1
-  %sel = select i1 %c, i32 %b, i32 %add
-  ret i32 %sel
-}
-
-

diff  --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn
index 7bda1302c6f369..97996b3d402fba 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn
@@ -31,7 +31,6 @@ static_library("Instrumentation") {
     "PGOForceFunctionAttrs.cpp",
     "PGOInstrumentation.cpp",
     "PGOMemOPSizeOpt.cpp",
-    "PoisonChecking.cpp",
     "RealtimeSanitizer.cpp",
     "SanitizerBinaryMetadata.cpp",
     "SanitizerCoverage.cpp",


        


More information about the llvm-commits mailing list