[llvm] [LLVM] Fix typo "CxtI" (PR #226137)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 05:20:58 PDT 2026
https://github.com/jayfoad updated https://github.com/llvm/llvm-project/pull/226137
>From ab8e6c68a3eafef4b0d8f0694c8a73d6cc23756e Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 24 Sep 2026 12:40:13 +0100
Subject: [PATCH 1/2] [LLVM] Fix typo "CxtI"
LLVM had many instances of both "CxtI" and "CtxI". This patch
standardizes on the latter. I regard the former as a mistake that should
never have spread. In general usage, "ctx" is much more common as an
abbreviation for "context".
Same for "CxtF" and "CxtPhi" which occurred a few times each.
Also fix the few instances of "Cxt" to "Ctx", which was already
overwhelmingly more common.
---
llvm/include/llvm/Analysis/ConstantFolding.h | 6 +-
.../llvm/Analysis/InstructionSimplify.h | 2 +-
llvm/include/llvm/Analysis/LazyValueInfo.h | 14 +-
llvm/include/llvm/Analysis/Loads.h | 12 +-
llvm/include/llvm/Analysis/SimplifyQuery.h | 22 +-
llvm/include/llvm/Analysis/TargetFolder.h | 4 +-
.../llvm/Analysis/TargetTransformInfo.h | 6 +-
.../llvm/Analysis/TargetTransformInfoImpl.h | 4 +-
llvm/include/llvm/Analysis/ValueTracking.h | 24 +-
llvm/include/llvm/CodeGen/BasicTTIImpl.h | 8 +-
.../Transforms/InstCombine/InstCombiner.h | 50 ++---
.../llvm/Transforms/Scalar/JumpThreading.h | 8 +-
llvm/include/llvm/Transforms/Utils/Local.h | 6 +-
llvm/lib/Analysis/BasicAliasAnalysis.cpp | 18 +-
llvm/lib/Analysis/ConstantFolding.cpp | 26 +--
llvm/lib/Analysis/InstructionSimplify.cpp | 32 +--
llvm/lib/Analysis/LazyValueInfo.cpp | 106 ++++-----
llvm/lib/Analysis/Loads.cpp | 16 +-
llvm/lib/Analysis/ScalarEvolution.cpp | 2 +-
llvm/lib/Analysis/TargetTransformInfo.cpp | 8 +-
llvm/lib/Analysis/ValueTracking.cpp | 212 +++++++++---------
llvm/lib/MC/MCPseudoProbe.cpp | 4 +-
.../AArch64/AArch64TargetTransformInfo.cpp | 20 +-
.../AArch64/AArch64TargetTransformInfo.h | 4 +-
.../AMDGPU/AMDGPULateCodeGenPrepare.cpp | 4 +-
.../AMDGPU/AMDGPUTargetTransformInfo.cpp | 14 +-
.../Target/AMDGPU/AMDGPUTargetTransformInfo.h | 4 +-
.../lib/Target/ARM/ARMTargetTransformInfo.cpp | 12 +-
llvm/lib/Target/ARM/ARMTargetTransformInfo.h | 4 +-
llvm/lib/Target/BPF/BPFTargetTransformInfo.h | 2 +-
.../Hexagon/HexagonTargetTransformInfo.cpp | 8 +-
.../Hexagon/HexagonTargetTransformInfo.h | 4 +-
.../Target/Lanai/LanaiTargetTransformInfo.h | 2 +-
.../Target/NVPTX/NVPTXTargetTransformInfo.cpp | 2 +-
.../Target/NVPTX/NVPTXTargetTransformInfo.h | 2 +-
.../Target/PowerPC/PPCTargetTransformInfo.cpp | 6 +-
.../Target/PowerPC/PPCTargetTransformInfo.h | 4 +-
.../Target/RISCV/RISCVTargetTransformInfo.cpp | 18 +-
.../Target/RISCV/RISCVTargetTransformInfo.h | 6 +-
.../SystemZ/SystemZTargetTransformInfo.cpp | 10 +-
.../SystemZ/SystemZTargetTransformInfo.h | 4 +-
.../WebAssemblyTargetTransformInfo.cpp | 6 +-
.../WebAssemblyTargetTransformInfo.h | 4 +-
.../lib/Target/X86/X86TargetTransformInfo.cpp | 16 +-
llvm/lib/Target/X86/X86TargetTransformInfo.h | 4 +-
.../InstCombine/InstCombineAndOrXor.cpp | 10 +-
.../InstCombine/InstCombineCalls.cpp | 4 +-
.../InstCombine/InstCombineCasts.cpp | 110 ++++-----
.../InstCombine/InstCombineCompares.cpp | 50 ++---
.../InstCombine/InstCombineInternal.h | 58 ++---
.../InstCombine/InstCombineMulDivRem.cpp | 6 +-
.../InstCombine/InstCombineSelect.cpp | 2 +-
.../InstCombine/InstCombineShifts.cpp | 10 +-
.../InstCombineSimplifyDemanded.cpp | 14 +-
.../Scalar/CorrelatedValuePropagation.cpp | 10 +-
llvm/lib/Transforms/Scalar/JumpThreading.cpp | 38 ++--
llvm/lib/Transforms/Scalar/MergeICmps.cpp | 4 +-
llvm/lib/Transforms/Utils/Local.cpp | 4 +-
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 8 +-
.../SLPVectorizer/SLPCostAnalysis.cpp | 20 +-
.../Vectorize/SLPVectorizer/SLPCostAnalysis.h | 4 +-
.../Transforms/Vectorize/VectorCombine.cpp | 4 +-
llvm/unittests/Analysis/ValueTrackingTest.cpp | 64 +++---
llvm/unittests/FileCheck/FileCheckTest.cpp | 80 +++----
64 files changed, 625 insertions(+), 625 deletions(-)
diff --git a/llvm/include/llvm/Analysis/ConstantFolding.h b/llvm/include/llvm/Analysis/ConstantFolding.h
index 72a11e5c944697..57c18108cb22b8 100644
--- a/llvm/include/llvm/Analysis/ConstantFolding.h
+++ b/llvm/include/llvm/Analysis/ConstantFolding.h
@@ -87,7 +87,7 @@ LLVM_ABI Constant *ConstantFoldInstOperands(
/// Denormal inputs may be flushed based on the denormal handling mode.
LLVM_ABI Constant *ConstantFoldCompareInstOperands(
unsigned Predicate, Constant *LHS, Constant *RHS, const DataLayout &DL,
- const TargetLibraryInfo *TLI = nullptr, const Function *CxtF = nullptr);
+ const TargetLibraryInfo *TLI = nullptr, const Function *CtxF = nullptr);
/// Attempt to constant fold a unary operation with the specified operand.
/// Returns null on failure.
@@ -116,7 +116,7 @@ ConstantFoldFPInstOperands(unsigned Opcode, Constant *LHS, Constant *RHS,
///
/// If the calling function's denormal_fpenv input mode is dynamic for the
/// floating-point type, returns nullptr for denormal inputs.
-LLVM_ABI Constant *FlushFPConstant(Constant *Operand, const Function *CxtF,
+LLVM_ABI Constant *FlushFPConstant(Constant *Operand, const Function *CtxF,
bool IsOutput);
/// Attempt to constant fold a cast with the specified operand. If it
@@ -173,7 +173,7 @@ LLVM_ABI Constant *ConstantFoldCall(const CallBase *Call, Function *F,
LLVM_ABI Constant *ConstantFoldIntrinsic(Intrinsic::ID ID,
ArrayRef<Constant *> Ops, Type *Ty,
const DataLayout &DL,
- const Function *CxtF = nullptr);
+ const Function *CtxF = nullptr);
/// ConstantFoldLoadThroughBitcast - try to cast constant to destination type
/// returning null if unsuccessful. Can cast pointer to pointer or pointer to
diff --git a/llvm/include/llvm/Analysis/InstructionSimplify.h b/llvm/include/llvm/Analysis/InstructionSimplify.h
index db73c2d78eedaf..3568422c8348b3 100644
--- a/llvm/include/llvm/Analysis/InstructionSimplify.h
+++ b/llvm/include/llvm/Analysis/InstructionSimplify.h
@@ -199,7 +199,7 @@ LLVM_ABI Value *simplifyAddrSpaceCastInst(Value *Op, Type *Ty, bool IsNonNull,
const SimplifyQuery &Q);
/// Given operands for an intrinsic, fold the result or return null. Context
-/// Function is passed as \p CxtF. \p ExBehavior and \p Rounding only apply to
+/// Function is passed as \p CtxF. \p ExBehavior and \p Rounding only apply to
/// constrained FP intrinsics.
LLVM_ABI Value *
simplifyIntrinsic(Intrinsic::ID IID, Type *ReturnType, ArrayRef<Value *> Args,
diff --git a/llvm/include/llvm/Analysis/LazyValueInfo.h b/llvm/include/llvm/Analysis/LazyValueInfo.h
index 7b0e6c07c00f47..23f4d04018cf2d 100644
--- a/llvm/include/llvm/Analysis/LazyValueInfo.h
+++ b/llvm/include/llvm/Analysis/LazyValueInfo.h
@@ -65,14 +65,14 @@ namespace llvm {
LLVM_ABI Constant *getPredicateOnEdge(CmpInst::Predicate Pred, Value *V,
Constant *C, BasicBlock *FromBB,
BasicBlock *ToBB,
- Instruction *CxtI = nullptr);
+ Instruction *CtxI = nullptr);
/// Determine whether the specified value comparison with a constant is
/// known to be true or false at the specified instruction. \p Pred is a
/// CmpInst predicate. If \p UseBlockValue is true, the block value is also
/// taken into account.
LLVM_ABI Constant *getPredicateAt(CmpInst::Predicate Pred, Value *V,
- Constant *C, Instruction *CxtI,
+ Constant *C, Instruction *CtxI,
bool UseBlockValue);
/// Determine whether the specified value comparison is known to be true
@@ -81,17 +81,17 @@ namespace llvm {
/// \p Pred is a CmpInst predicate.
/// If \p UseBlockValue is true, the block value is also taken into account.
LLVM_ABI Constant *getPredicateAt(CmpInst::Predicate Pred, Value *LHS,
- Value *RHS, Instruction *CxtI,
+ Value *RHS, Instruction *CtxI,
bool UseBlockValue);
/// Determine whether the specified value is known to be a constant at the
/// specified instruction. Return null if not.
- LLVM_ABI Constant *getConstant(Value *V, Instruction *CxtI);
+ LLVM_ABI Constant *getConstant(Value *V, Instruction *CtxI);
/// Return the ConstantRange constraint that is known to hold for the
/// specified value at the specified instruction. This may only be called
/// on integer-typed Values.
- LLVM_ABI ConstantRange getConstantRange(Value *V, Instruction *CxtI,
+ LLVM_ABI ConstantRange getConstantRange(Value *V, Instruction *CtxI,
bool UndefAllowed);
/// Return the ConstantRange constraint that is known to hold for the value
@@ -103,14 +103,14 @@ namespace llvm {
/// constant on the specified edge. Return null if not.
LLVM_ABI Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB,
BasicBlock *ToBB,
- Instruction *CxtI = nullptr);
+ Instruction *CtxI = nullptr);
/// Return the ConstantRage constraint that is known to hold for the
/// specified value on the specified edge. This may be only be called
/// on integer-typed Values.
LLVM_ABI ConstantRange getConstantRangeOnEdge(Value *V, BasicBlock *FromBB,
BasicBlock *ToBB,
- Instruction *CxtI = nullptr);
+ Instruction *CtxI = nullptr);
/// Inform the analysis cache that we have threaded an edge from
/// PredBB to OldSucc to be from PredBB to NewSucc instead.
diff --git a/llvm/include/llvm/Analysis/Loads.h b/llvm/include/llvm/Analysis/Loads.h
index e822c7b4ebda6a..33bd82ece0af3c 100644
--- a/llvm/include/llvm/Analysis/Loads.h
+++ b/llvm/include/llvm/Analysis/Loads.h
@@ -71,11 +71,11 @@ LLVM_ABI bool isDereferenceablePointer(const Value *V, const APInt &Size,
/// Return true if we know that executing a load from this value cannot trap.
///
-/// If SQ.CxtI is specified this method performs context-sensitive analysis
-/// and returns true if it is safe to load immediately before SQ.CxtI.
+/// If SQ.CtxI is specified this method performs context-sensitive analysis
+/// and returns true if it is safe to load immediately before SQ.CtxI.
///
/// If it is not obviously safe to load from the specified pointer, we do a
-/// quick local scan of the basic block containing SQ.CxtI, to determine if
+/// quick local scan of the basic block containing SQ.CtxI, to determine if
/// the address is already accessed.
LLVM_ABI bool isSafeToLoadUnconditionally(Value *V, Align Alignment,
const APInt &Size,
@@ -110,11 +110,11 @@ isReadOnlyLoop(Loop *L, ScalarEvolution *SE, DominatorTree *DT,
/// Return true if we know that executing a load from this value cannot trap.
///
-/// If SQ.CxtI is specified this method performs context-sensitive analysis
-/// and returns true if it is safe to load immediately before SQ.CxtI.
+/// If SQ.CtxI is specified this method performs context-sensitive analysis
+/// and returns true if it is safe to load immediately before SQ.CtxI.
///
/// If it is not obviously safe to load from the specified pointer, we do a
-/// quick local scan of the basic block containing SQ.CxtI, to determine if
+/// quick local scan of the basic block containing SQ.CtxI, to determine if
/// the address is already accessed.
LLVM_ABI bool isSafeToLoadUnconditionally(Value *V, Type *Ty, Align Alignment,
const SimplifyQuery &SQ);
diff --git a/llvm/include/llvm/Analysis/SimplifyQuery.h b/llvm/include/llvm/Analysis/SimplifyQuery.h
index 8cb2788a40d66d..41bc13123343a1 100644
--- a/llvm/include/llvm/Analysis/SimplifyQuery.h
+++ b/llvm/include/llvm/Analysis/SimplifyQuery.h
@@ -70,14 +70,14 @@ struct CondContext {
struct SimplifyQuery {
private:
- const Function *CxtF = nullptr;
+ const Function *CtxF = nullptr;
public:
const DataLayout &DL;
const TargetLibraryInfo *TLI = nullptr;
const DominatorTree *DT = nullptr;
AssumptionCache *AC = nullptr;
- const Instruction *CxtI = nullptr;
+ const Instruction *CtxI = nullptr;
const DomConditionCache *DC = nullptr;
const CondContext *CC = nullptr;
@@ -93,38 +93,38 @@ struct SimplifyQuery {
bool AllowEphemerals = false;
SimplifyQuery(const DataLayout &DL, const Instruction *CXTI = nullptr)
- : DL(DL), CxtI(CXTI) {}
+ : DL(DL), CtxI(CXTI) {}
SimplifyQuery(const DataLayout &DL, const TargetLibraryInfo *TLI,
const DominatorTree *DT = nullptr,
AssumptionCache *AC = nullptr,
const Instruction *CXTI = nullptr, bool UseInstrInfo = true,
bool CanUseUndef = true, const DomConditionCache *DC = nullptr)
- : DL(DL), TLI(TLI), DT(DT), AC(AC), CxtI(CXTI), DC(DC), IIQ(UseInstrInfo),
+ : DL(DL), TLI(TLI), DT(DT), AC(AC), CtxI(CXTI), DC(DC), IIQ(UseInstrInfo),
CanUseUndef(CanUseUndef) {}
SimplifyQuery(const DataLayout &DL, const DominatorTree *DT,
AssumptionCache *AC = nullptr,
const Instruction *CXTI = nullptr, bool UseInstrInfo = true,
bool CanUseUndef = true)
- : DL(DL), DT(DT), AC(AC), CxtI(CXTI), IIQ(UseInstrInfo),
+ : DL(DL), DT(DT), AC(AC), CtxI(CXTI), IIQ(UseInstrInfo),
CanUseUndef(CanUseUndef) {}
SimplifyQuery getWithInstruction(const Instruction *I) const {
SimplifyQuery Copy(*this);
- Copy.CxtI = I;
+ Copy.CtxI = I;
return Copy;
}
SimplifyQuery getWithFunction(const Function *F) const {
SimplifyQuery Copy(*this);
- Copy.CxtF = F;
+ Copy.CtxF = F;
return Copy;
}
const Function *getFunction() const {
- if (CxtF)
- return CxtF;
- if (CxtI)
- return CxtI->getFunction();
+ if (CtxF)
+ return CtxF;
+ if (CtxI)
+ return CtxI->getFunction();
return nullptr;
}
SimplifyQuery getWithoutUndef() const {
diff --git a/llvm/include/llvm/Analysis/TargetFolder.h b/llvm/include/llvm/Analysis/TargetFolder.h
index aa09d90059dcf2..5db0863e82a838 100644
--- a/llvm/include/llvm/Analysis/TargetFolder.h
+++ b/llvm/include/llvm/Analysis/TargetFolder.h
@@ -197,11 +197,11 @@ class LLVM_ABI TargetFolder final : public IRBuilderFolder {
Value *FoldIntrinsic(Intrinsic::ID ID, ArrayRef<Value *> Ops, Type *Ty,
FastMathFlags FMF = {},
- Function *CxtF = nullptr) const override {
+ Function *CtxF = nullptr) const override {
if (all_of(Ops, IsaPred<Constant>))
return ConstantFoldIntrinsic(
ID, ArrayRef((Constant *const *)Ops.data(), Ops.size()), Ty, DL,
- CxtF);
+ CtxF);
return nullptr;
}
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index e30cbc61a5420b..6530d14e00315e 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -1562,7 +1562,7 @@ class TargetTransformInfo {
/// \p Args is an optional argument which holds the instruction operands
/// values so the TTI can analyze those values searching for special
/// cases or optimizations based on those values.
- /// \p CxtI is the optional original context instruction, if one exists, to
+ /// \p CtxI is the optional original context instruction, if one exists, to
/// provide even more information.
/// \p TLibInfo is used to search for platform specific vector library
/// functions for instructions that might be converted to calls (e.g. frem).
@@ -1570,7 +1570,7 @@ class TargetTransformInfo {
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Opd1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Opd2Info = {TTI::OK_AnyValue, TTI::OP_None},
- ArrayRef<const Value *> Args = {}, const Instruction *CxtI = nullptr,
+ ArrayRef<const Value *> Args = {}, const Instruction *CtxI = nullptr,
const TargetLibraryInfo *TLibInfo = nullptr) const;
/// Returns the cost estimation for alternating opcode pattern that can be
@@ -1596,7 +1596,7 @@ class TargetTransformInfo {
ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask = {}, int Index = 0,
VectorType *SubTp = nullptr, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC = TTI::VectorInstrContext::None) const;
/// Represents a hint about the context in which a cast is used.
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index 625433e2e0a0b9..3a37af79cf0e10 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -733,7 +733,7 @@ class LLVM_ABI TargetTransformInfoImplBase {
virtual InstructionCost getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Opd1Info, TTI::OperandValueInfo Opd2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI = nullptr) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI = nullptr) const {
// Widenable conditions will eventually lower into constants, so some
// operations with them will be trivially optimized away.
auto IsWidenableCondition = [](const Value *V) {
@@ -781,7 +781,7 @@ class LLVM_ABI TargetTransformInfoImplBase {
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC = TTI::VectorInstrContext::None) const {
return 1;
}
diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h
index 5fce5907b4f054..81ea0e990f5c2c 100644
--- a/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/llvm/include/llvm/Analysis/ValueTracking.h
@@ -62,14 +62,14 @@ constexpr unsigned MaxLookupSearchDepth = 10;
LLVM_ABI void computeKnownBits(const Value *V, KnownBits &Known,
const DataLayout &DL,
AssumptionCache *AC = nullptr,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
const DominatorTree *DT = nullptr,
bool UseInstrInfo = true, unsigned Depth = 0);
/// Returns the known bits rather than passing by reference.
LLVM_ABI KnownBits computeKnownBits(const Value *V, const DataLayout &DL,
AssumptionCache *AC = nullptr,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
const DominatorTree *DT = nullptr,
bool UseInstrInfo = true,
unsigned Depth = 0);
@@ -144,7 +144,7 @@ LLVM_ABI bool haveNoCommonBitsSet(const WithCache<const Value *> &LHSCache,
LLVM_ABI bool isKnownToBeAPowerOfTwo(const Value *V, const DataLayout &DL,
bool OrZero = false,
AssumptionCache *AC = nullptr,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
const DominatorTree *DT = nullptr,
bool UseInstrInfo = true,
unsigned Depth = 0);
@@ -153,9 +153,9 @@ LLVM_ABI bool isKnownToBeAPowerOfTwo(const Value *V, bool OrZero,
const SimplifyQuery &Q,
unsigned Depth = 0);
-LLVM_ABI bool isOnlyUsedInZeroComparison(const Instruction *CxtI);
+LLVM_ABI bool isOnlyUsedInZeroComparison(const Instruction *CtxI);
-LLVM_ABI bool isOnlyUsedInZeroEqualityComparison(const Instruction *CxtI);
+LLVM_ABI bool isOnlyUsedInZeroEqualityComparison(const Instruction *CtxI);
/// Return true if the given value is known to be non-zero when defined. For
/// vectors, return true if every element is known to be non-zero when
@@ -220,7 +220,7 @@ LLVM_ABI bool MaskedValueIsZero(const Value *V, const APInt &Mask,
/// bits.
LLVM_ABI unsigned ComputeNumSignBits(const Value *Op, const DataLayout &DL,
AssumptionCache *AC = nullptr,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
const DominatorTree *DT = nullptr,
bool UseInstrInfo = true,
unsigned Depth = 0);
@@ -231,7 +231,7 @@ LLVM_ABI unsigned ComputeNumSignBits(const Value *Op, const DataLayout &DL,
LLVM_ABI unsigned ComputeMaxSignificantBits(const Value *Op,
const DataLayout &DL,
AssumptionCache *AC = nullptr,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
const DominatorTree *DT = nullptr,
unsigned Depth = 0);
@@ -271,7 +271,7 @@ LLVM_ABI KnownFPClass computeKnownFPClass(
const Value *V, const DataLayout &DL,
FPClassTest InterestedClasses = fcAllFlags,
const TargetLibraryInfo *TLI = nullptr, AssumptionCache *AC = nullptr,
- const Instruction *CxtI = nullptr, const DominatorTree *DT = nullptr,
+ const Instruction *CtxI = nullptr, const DominatorTree *DT = nullptr,
bool UseInstrInfo = true, unsigned Depth = 0);
/// Wrapper to account for known fast math flags at the use instruction.
@@ -568,7 +568,7 @@ LLVM_ABI bool isNotCrossLaneOperation(const Instruction *I);
/// and returns true if it is safe to execute the instruction immediately
/// before the CtxI. If the instruction has (transitive) operands that don't
/// dominate CtxI, the analysis is performed under the assumption that these
-/// operands will also be speculated to a point before CxtI.
+/// operands will also be speculated to a point before CtxI.
///
/// If the CtxI is NOT specified this method only looks at the instruction
/// itself and its operands, so if this method returns true, it is safe to
@@ -649,19 +649,19 @@ LLVM_ABI bool isAssumeLikeIntrinsic(const Instruction *I);
/// Return true if it is valid to use the assumptions provided by an
/// assume intrinsic, I, at the point in the control-flow identified by the
-/// context instruction, CxtI. By default, ephemeral values of the assumption
+/// context instruction, CtxI. By default, ephemeral values of the assumption
/// are treated as an invalid context, to prevent the assumption from being used
/// to optimize away its argument. If the caller can ensure that this won't
/// happen, it can call with AllowEphemerals set to true to get more valid
/// assumptions.
LLVM_ABI bool isValidAssumeForContext(const Instruction *I,
- const Instruction *CxtI,
+ const Instruction *CtxI,
const DominatorTree *DT = nullptr,
bool AllowEphemerals = false);
inline bool isValidAssumeForContext(const Instruction *I,
const SimplifyQuery &Q) {
- return isValidAssumeForContext(I, Q.CxtI, Q.DT, Q.AllowEphemerals);
+ return isValidAssumeForContext(I, Q.CtxI, Q.DT, Q.AllowEphemerals);
}
/// Returns true, if no instruction between \p Assume and \p CtxI may free
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 39915d4d8eec3e..56e549091e9e1e 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1094,7 +1094,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
TTI::OperandValueInfo Opd1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Opd2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override {
+ const Instruction *CtxI = nullptr) const override {
// Check if any of the operands are vector operands.
const TargetLoweringBase *TLI = getTLI();
int ISD = TLI->InstructionOpcodeToISD(Opcode);
@@ -1104,7 +1104,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
if (CostKind != TTI::TCK_RecipThroughput)
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind,
Opd1Info, Opd2Info,
- Args, CxtI);
+ Args, CtxI);
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
@@ -1155,7 +1155,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
if (auto *VTy = dyn_cast<FixedVectorType>(Ty)) {
InstructionCost Cost = thisT()->getArithmeticInstrCost(
Opcode, VTy->getScalarType(), CostKind, Opd1Info, Opd2Info,
- Args, CxtI);
+ Args, CtxI);
// Return the cost of multiple scalar invocation plus the cost of
// inserting and extracting the values.
SmallVector<Type *> Tys(Args.size(), Ty);
@@ -1226,7 +1226,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override {
switch (improveShuffleKindFromMask(Kind, Mask, SrcTy, Index, SubTp)) {
diff --git a/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h b/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
index 8f9c5860662981..636b9a6278d87d 100644
--- a/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
+++ b/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
@@ -466,38 +466,38 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
virtual Instruction *eraseInstFromFunction(Instruction &I) = 0;
void computeKnownBits(const Value *V, KnownBits &Known,
- const Instruction *CxtI, unsigned Depth = 0) const {
- llvm::computeKnownBits(V, Known, SQ.getWithInstruction(CxtI), Depth);
+ const Instruction *CtxI, unsigned Depth = 0) const {
+ llvm::computeKnownBits(V, Known, SQ.getWithInstruction(CtxI), Depth);
}
- KnownBits computeKnownBits(const Value *V, const Instruction *CxtI,
+ KnownBits computeKnownBits(const Value *V, const Instruction *CtxI,
unsigned Depth = 0) const {
- return llvm::computeKnownBits(V, SQ.getWithInstruction(CxtI), Depth);
+ return llvm::computeKnownBits(V, SQ.getWithInstruction(CtxI), Depth);
}
bool isKnownToBeAPowerOfTwo(const Value *V, bool OrZero = false,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
unsigned Depth = 0) {
- return llvm::isKnownToBeAPowerOfTwo(V, OrZero, SQ.getWithInstruction(CxtI),
+ return llvm::isKnownToBeAPowerOfTwo(V, OrZero, SQ.getWithInstruction(CtxI),
Depth);
}
bool MaskedValueIsZero(const Value *V, const APInt &Mask,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
unsigned Depth = 0) const {
- return llvm::MaskedValueIsZero(V, Mask, SQ.getWithInstruction(CxtI), Depth);
+ return llvm::MaskedValueIsZero(V, Mask, SQ.getWithInstruction(CtxI), Depth);
}
unsigned ComputeNumSignBits(const Value *Op,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
unsigned Depth = 0) const {
- return llvm::ComputeNumSignBits(Op, DL, &AC, CxtI, &DT, Depth);
+ return llvm::ComputeNumSignBits(Op, DL, &AC, CtxI, &DT, Depth);
}
unsigned ComputeMaxSignificantBits(const Value *Op,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
unsigned Depth = 0) const {
- return llvm::ComputeMaxSignificantBits(Op, DL, &AC, CxtI, &DT, Depth);
+ return llvm::ComputeMaxSignificantBits(Op, DL, &AC, CtxI, &DT, Depth);
}
/// Return true if the cast from integer to FP can be proven to be exact
@@ -505,49 +505,49 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
LLVM_ABI bool isKnownExactCastIntToFP(CastInst &I) const;
LLVM_ABI bool
canBeCastedExactlyIntToFP(Value *V, Type *FPTy, bool IsSigned,
- const Instruction *CxtI = nullptr) const;
+ const Instruction *CtxI = nullptr) const;
OverflowResult computeOverflowForUnsignedMul(const Value *LHS,
const Value *RHS,
- const Instruction *CxtI,
+ const Instruction *CtxI,
bool IsNSW = false) const {
return llvm::computeOverflowForUnsignedMul(
- LHS, RHS, SQ.getWithInstruction(CxtI), IsNSW);
+ LHS, RHS, SQ.getWithInstruction(CtxI), IsNSW);
}
OverflowResult computeOverflowForSignedMul(const Value *LHS, const Value *RHS,
- const Instruction *CxtI) const {
+ const Instruction *CtxI) const {
return llvm::computeOverflowForSignedMul(LHS, RHS,
- SQ.getWithInstruction(CxtI));
+ SQ.getWithInstruction(CtxI));
}
OverflowResult
computeOverflowForUnsignedAdd(const WithCache<const Value *> &LHS,
const WithCache<const Value *> &RHS,
- const Instruction *CxtI) const {
+ const Instruction *CtxI) const {
return llvm::computeOverflowForUnsignedAdd(LHS, RHS,
- SQ.getWithInstruction(CxtI));
+ SQ.getWithInstruction(CtxI));
}
OverflowResult
computeOverflowForSignedAdd(const WithCache<const Value *> &LHS,
const WithCache<const Value *> &RHS,
- const Instruction *CxtI) const {
+ const Instruction *CtxI) const {
return llvm::computeOverflowForSignedAdd(LHS, RHS,
- SQ.getWithInstruction(CxtI));
+ SQ.getWithInstruction(CtxI));
}
OverflowResult computeOverflowForUnsignedSub(const Value *LHS,
const Value *RHS,
- const Instruction *CxtI) const {
+ const Instruction *CtxI) const {
return llvm::computeOverflowForUnsignedSub(LHS, RHS,
- SQ.getWithInstruction(CxtI));
+ SQ.getWithInstruction(CtxI));
}
OverflowResult computeOverflowForSignedSub(const Value *LHS, const Value *RHS,
- const Instruction *CxtI) const {
+ const Instruction *CtxI) const {
return llvm::computeOverflowForSignedSub(LHS, RHS,
- SQ.getWithInstruction(CxtI));
+ SQ.getWithInstruction(CtxI));
}
virtual bool SimplifyDemandedBits(Instruction *I, unsigned OpNo,
diff --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
index f660095bbd7eea..f1f0eec0867068 100644
--- a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
+++ b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
@@ -135,15 +135,15 @@ class JumpThreadingPass : public OptionalPassInfoMixin<JumpThreadingPass> {
LLVM_ABI bool computeValueKnownInPredecessorsImpl(
Value *V, BasicBlock *BB, jumpthreading::PredValueInfo &Result,
jumpthreading::ConstantPreference Preference,
- SmallPtrSet<Value *, 4> &RecursionSet, Instruction *CxtI = nullptr);
+ SmallPtrSet<Value *, 4> &RecursionSet, Instruction *CtxI = nullptr);
bool
computeValueKnownInPredecessors(Value *V, BasicBlock *BB,
jumpthreading::PredValueInfo &Result,
jumpthreading::ConstantPreference Preference,
- Instruction *CxtI = nullptr) {
+ Instruction *CtxI = nullptr) {
SmallPtrSet<Value *, 4> RecursionSet;
return computeValueKnownInPredecessorsImpl(V, BB, Result, Preference,
- RecursionSet, CxtI);
+ RecursionSet, CtxI);
}
LLVM_ABI Constant *evaluateOnPredecessorEdge(BasicBlock *BB,
@@ -157,7 +157,7 @@ class JumpThreadingPass : public OptionalPassInfoMixin<JumpThreadingPass> {
LLVM_ABI bool
processThreadableEdges(Value *Cond, BasicBlock *BB,
jumpthreading::ConstantPreference Preference,
- Instruction *CxtI = nullptr);
+ Instruction *CtxI = nullptr);
LLVM_ABI bool processBranchOnPHI(PHINode *PN);
LLVM_ABI bool processBranchOnXOR(BinaryOperator *BO);
diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h
index a7b687304d63ca..214baf905fb24d 100644
--- a/llvm/include/llvm/Transforms/Utils/Local.h
+++ b/llvm/include/llvm/Transforms/Utils/Local.h
@@ -232,16 +232,16 @@ LLVM_ABI Align tryEnforceAlignment(Value *V, Align PrefAlign,
/// alignment from the beginning.
LLVM_ABI Align getOrEnforceKnownAlignment(Value *V, MaybeAlign PrefAlign,
const DataLayout &DL,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
AssumptionCache *AC = nullptr,
const DominatorTree *DT = nullptr);
/// Try to infer an alignment for the specified pointer.
inline Align getKnownAlignment(Value *V, const DataLayout &DL,
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
AssumptionCache *AC = nullptr,
const DominatorTree *DT = nullptr) {
- return getOrEnforceKnownAlignment(V, MaybeAlign(), DL, CxtI, AC, DT);
+ return getOrEnforceKnownAlignment(V, MaybeAlign(), DL, CtxI, AC, DT);
}
/// Create a call that matches the invoke \p II in terms of arguments,
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 37fd0688755abd..fd9a7bb935170c 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -535,7 +535,7 @@ struct VariableGEPIndex {
APInt Scale;
// Context instruction to use when querying information about this index.
- const Instruction *CxtI;
+ const Instruction *CtxI;
/// True if all operations in this expression are NSW.
bool IsNSW;
@@ -617,7 +617,7 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, const DataLayout &DL,
// Limit recursion depth to limit compile time in crazy cases.
unsigned MaxLookup = MaxLookupSearchDepth;
SearchTimes++;
- const Instruction *CxtI = dyn_cast<Instruction>(V);
+ const Instruction *CtxI = dyn_cast<Instruction>(V);
unsigned IndexSize = DL.getIndexTypeSizeInBits(V->getType());
DecomposedGEP Decomposed;
@@ -764,7 +764,7 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, const DataLayout &DL,
}
if (!!Scale) {
- VariableGEPIndex Entry = {LE.Val, Scale, CxtI, LE.IsNSW,
+ VariableGEPIndex Entry = {LE.Val, Scale, CtxI, LE.IsNSW,
/* IsNegated */ false};
Decomposed.VarIndices.push_back(Entry);
}
@@ -1923,7 +1923,7 @@ void BasicAAResult::subtractDecomposedGEPs(DecomposedGEP &DestGEP,
// If we didn't consume this entry, add it to the end of the Dest list.
if (!Found) {
- VariableGEPIndex Entry = {Src.Val, Src.Scale, Src.CxtI, Src.IsNSW,
+ VariableGEPIndex Entry = {Src.Val, Src.Scale, Src.CtxI, Src.IsNSW,
/* IsNegated */ true};
DestGEP.VarIndices.push_back(Entry);
@@ -1945,7 +1945,7 @@ BasicAAResult::analyzeVariableOffsets(const DecomposedGEP &GEP,
const VariableGEPIndex &Index = GEP.VarIndices[I];
const APInt &Scale = Index.Scale;
- SimplifyQuery SQ(DL, DT, &AC, Index.CxtI, /*UseInstrInfo=*/true);
+ SimplifyQuery SQ(DL, DT, &AC, Index.CtxI, /*UseInstrInfo=*/true);
KnownBits Known = computeKnownBits(Index.Val.V, SQ);
VarIndexKnownBits.emplace_back(Known);
@@ -2018,7 +2018,7 @@ std::optional<APInt> BasicAAResult::computeMinAbsVarOffset(
// VarIndex = Scale*V.
const VariableGEPIndex &Var = VarIndices[0];
if (Var.Val.TruncBits == 0 &&
- isKnownNonZero(Var.Val.V, SimplifyQuery(DL, DT, &AC, Var.CxtI))) {
+ isKnownNonZero(Var.Val.V, SimplifyQuery(DL, DT, &AC, Var.CtxI))) {
// Refine MinAbsVarIndex, if abs(Scale*V) >= abs(Scale) holds in the
// presence of potentially wrapping math.
if (MultiplyByScaleNoWrap(Var)) {
@@ -2046,9 +2046,9 @@ std::optional<APInt> BasicAAResult::computeMinAbsVarOffset(
if (Var0.hasNegatedScaleOf(Var1)) {
if (isKnownNonEqual(Var0.Val.V, Var1.Val.V,
- SimplifyQuery(DL, DT, &AC, /*CxtI=*/Var0.CxtI
- ? Var0.CxtI
- : Var1.CxtI)))
+ SimplifyQuery(DL, DT, &AC, /*CtxI=*/Var0.CtxI
+ ? Var0.CtxI
+ : Var1.CtxI)))
return Var0.Scale.abs();
// Equal scales would imply the GCD equals the scale itself, leading
// the generalized path below not to do better than isKnownNonEqual.
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 18921240799bda..a55d8a069a17bd 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1331,7 +1331,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned IntPredicate,
Constant *Ops0, Constant *Ops1,
const DataLayout &DL,
const TargetLibraryInfo *TLI,
- const Function *CxtF) {
+ const Function *CtxF) {
CmpInst::Predicate Predicate = (CmpInst::Predicate)IntPredicate;
// fold: icmp (inttoptr x), null -> icmp x, 0
// fold: icmp null, (inttoptr x) -> icmp 0, x
@@ -1432,10 +1432,10 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned IntPredicate,
if (CmpInst::isFPPredicate(Predicate)) {
// Flush any denormal constant float input according to denormal handling
// mode.
- Ops0 = FlushFPConstant(Ops0, CxtF, /*IsOutput=*/false);
+ Ops0 = FlushFPConstant(Ops0, CtxF, /*IsOutput=*/false);
if (!Ops0)
return nullptr;
- Ops1 = FlushFPConstant(Ops1, CxtF, /*IsOutput=*/false);
+ Ops1 = FlushFPConstant(Ops1, CtxF, /*IsOutput=*/false);
if (!Ops1)
return nullptr;
}
@@ -1491,20 +1491,20 @@ static DenormalMode getInstrDenormalMode(const Function *CtxF, Type *Ty) {
}
static ConstantFP *
-flushDenormalConstantFP(ConstantFP *CFP, const Function *CxtF, bool IsOutput) {
+flushDenormalConstantFP(ConstantFP *CFP, const Function *CtxF, bool IsOutput) {
const APFloat &APF = CFP->getValueAPF();
if (!APF.isDenormal())
return CFP;
- DenormalMode Mode = getInstrDenormalMode(CxtF, CFP->getType());
+ DenormalMode Mode = getInstrDenormalMode(CtxF, CFP->getType());
return flushDenormalConstant(CFP->getType(), APF,
IsOutput ? Mode.Output : Mode.Input);
}
-Constant *llvm::FlushFPConstant(Constant *Operand, const Function *CxtF,
+Constant *llvm::FlushFPConstant(Constant *Operand, const Function *CtxF,
bool IsOutput) {
if (ConstantFP *CFP = dyn_cast<ConstantFP>(Operand))
- return flushDenormalConstantFP(CFP, CxtF, IsOutput);
+ return flushDenormalConstantFP(CFP, CtxF, IsOutput);
if (isa<ConstantAggregateZero, UndefValue>(Operand))
return Operand;
@@ -1513,7 +1513,7 @@ Constant *llvm::FlushFPConstant(Constant *Operand, const Function *CxtF,
VectorType *VecTy = dyn_cast<VectorType>(Ty);
if (VecTy) {
if (auto *Splat = dyn_cast_or_null<ConstantFP>(Operand->getSplatValue())) {
- ConstantFP *Folded = flushDenormalConstantFP(Splat, CxtF, IsOutput);
+ ConstantFP *Folded = flushDenormalConstantFP(Splat, CtxF, IsOutput);
if (!Folded)
return nullptr;
return ConstantVector::getSplat(VecTy->getElementCount(), Folded);
@@ -1538,7 +1538,7 @@ Constant *llvm::FlushFPConstant(Constant *Operand, const Function *CxtF,
if (!CFP)
return nullptr;
- ConstantFP *Folded = flushDenormalConstantFP(CFP, CxtF, IsOutput);
+ ConstantFP *Folded = flushDenormalConstantFP(CFP, CtxF, IsOutput);
if (!Folded)
return nullptr;
NewElts.push_back(Folded);
@@ -1554,7 +1554,7 @@ Constant *llvm::FlushFPConstant(Constant *Operand, const Function *CxtF,
if (!Elt.isDenormal()) {
NewElts.push_back(ConstantFP::get(Ty, Elt));
} else {
- DenormalMode Mode = getInstrDenormalMode(CxtF, Ty);
+ DenormalMode Mode = getInstrDenormalMode(CtxF, Ty);
ConstantFP *Folded =
flushDenormalConstant(Ty, Elt, IsOutput ? Mode.Output : Mode.Input);
if (!Folded)
@@ -4786,9 +4786,9 @@ ConstantFoldStructCall(StringRef Name, Intrinsic::ID IntrinsicID,
Constant *llvm::ConstantFoldIntrinsic(Intrinsic::ID ID,
ArrayRef<Constant *> Ops, Type *Ty,
const DataLayout &DL,
- const Function *CxtF) {
- // In the absence of CxtF, assume strictfp conservatively.
- if (!canConstantFoldIntrinsic(ID, CxtF ? CxtF->isStrictFP() : true) ||
+ const Function *CtxF) {
+ // In the absence of CtxF, assume strictfp conservatively.
+ if (!canConstantFoldIntrinsic(ID, CtxF ? CtxF->isStrictFP() : true) ||
(DisableFPCallFolding &&
anyTypeContainsFP(
Ty, ArrayRef<Value *>((Value *const *)Ops.data(), Ops.size()))))
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index d7c0e172707772..90048d4e3f921b 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -576,8 +576,8 @@ static Constant *foldOrCommuteConstant(Instruction::BinaryOps Opcode,
case Instruction::FMul:
case Instruction::FDiv:
case Instruction::FRem:
- if (Q.CxtI != nullptr)
- return ConstantFoldFPInstOperands(Opcode, CLHS, CRHS, Q.DL, Q.CxtI);
+ if (Q.CtxI != nullptr)
+ return ConstantFoldFPInstOperands(Opcode, CLHS, CRHS, Q.DL, Q.CtxI);
}
return ConstantFoldBinaryOpOperands(Opcode, CLHS, CRHS, Q.DL);
}
@@ -716,7 +716,7 @@ static Value *simplifyByDomEq(unsigned Opcode, Value *Op0, Value *Op1,
return nullptr;
std::optional<bool> Imp =
- isImpliedByDomCondition(CmpInst::ICMP_EQ, Op0, Op1, Q.CxtI, Q.DL);
+ isImpliedByDomCondition(CmpInst::ICMP_EQ, Op0, Op1, Q.CtxI, Q.DL);
if (Imp && *Imp) {
Type *Ty = Op0->getType();
switch (Opcode) {
@@ -1495,7 +1495,7 @@ static Value *simplifyAShrInst(Value *Op0, Value *Op1, bool IsExact,
return X;
// Arithmetic shifting an all-sign-bit value is a no-op.
- unsigned NumSignBits = ComputeNumSignBits(Op0, Q.DL, Q.AC, Q.CxtI, Q.DT);
+ unsigned NumSignBits = ComputeNumSignBits(Op0, Q.DL, Q.AC, Q.CtxI, Q.DT);
if (NumSignBits == Op0->getType()->getScalarSizeInBits())
return Op0;
@@ -2041,13 +2041,13 @@ static Value *simplifyAndCommutative(Value *Op0, Value *Op1,
// -A & A = A if A is a power of two or zero.
if (match(Op0, m_Neg(m_Specific(Op1))) &&
- isKnownToBeAPowerOfTwo(Op1, Q.DL, /*OrZero*/ true, Q.AC, Q.CxtI, Q.DT))
+ isKnownToBeAPowerOfTwo(Op1, Q.DL, /*OrZero*/ true, Q.AC, Q.CtxI, Q.DT))
return Op1;
// This is a similar pattern used for checking if a value is a power-of-2:
// (A - 1) & A --> 0 (if A is a power-of-2 or 0)
if (match(Op0, m_Add(m_Specific(Op1), m_AllOnes())) &&
- isKnownToBeAPowerOfTwo(Op1, Q.DL, /*OrZero*/ true, Q.AC, Q.CxtI, Q.DT))
+ isKnownToBeAPowerOfTwo(Op1, Q.DL, /*OrZero*/ true, Q.AC, Q.CtxI, Q.DT))
return Constant::getNullValue(Op1->getType());
// (x << N) & ((x << M) - 1) --> 0, where x is known to be a power of 2 and
@@ -2055,7 +2055,7 @@ static Value *simplifyAndCommutative(Value *Op0, Value *Op1,
const APInt *Shift1, *Shift2;
if (match(Op0, m_Shl(m_Value(X), m_APInt(Shift1))) &&
match(Op1, m_Add(m_Shl(m_Specific(X), m_APInt(Shift2)), m_AllOnes())) &&
- isKnownToBeAPowerOfTwo(X, Q.DL, /*OrZero*/ true, Q.AC, Q.CxtI) &&
+ isKnownToBeAPowerOfTwo(X, Q.DL, /*OrZero*/ true, Q.AC, Q.CtxI) &&
Shift1->uge(*Shift2))
return Constant::getNullValue(Op0->getType());
@@ -2124,7 +2124,7 @@ static Value *simplifyAndInst(Value *Op0, Value *Op1, const SimplifyQuery &Q,
Value *Shift;
if (match(Op1, m_Power2(PowerC)) &&
match(Op0, m_Add(m_Value(Shift), m_AllOnes())) &&
- isKnownToBeAPowerOfTwo(Shift, Q.DL, /*OrZero*/ false, Q.AC, Q.CxtI,
+ isKnownToBeAPowerOfTwo(Shift, Q.DL, /*OrZero*/ false, Q.AC, Q.CtxI,
Q.DT)) {
KnownBits Known = computeKnownBits(Shift, Q);
// Use getActiveBits() to make use of the additional power of two knowledge
@@ -3812,7 +3812,7 @@ static Value *simplifyICmpWithDominatingAssume(CmpPredicate Predicate,
Value *LHS, Value *RHS,
const SimplifyQuery &Q) {
// Gracefully handle instructions that have not been inserted yet.
- if (!Q.AC || !Q.CxtI)
+ if (!Q.AC || !Q.CtxI)
return nullptr;
for (Value *AssumeBaseOp : {LHS, RHS}) {
@@ -4164,7 +4164,7 @@ static Value *simplifyICmpInst(CmpPredicate Pred, Value *LHS, Value *RHS,
return V;
if (std::optional<bool> Res =
- isImpliedByDomCondition(Pred, LHS, RHS, Q.CxtI, Q.DL))
+ isImpliedByDomCondition(Pred, LHS, RHS, Q.CtxI, Q.DL))
return ConstantInt::getBool(ITy, *Res);
// Simplify comparisons of related pointers using a powerful, recursive
@@ -4258,7 +4258,7 @@ static Value *simplifyFCmpInst(CmpPredicate Pred, Value *LHS, Value *RHS,
}
if (std::optional<bool> Res =
- isImpliedByDomCondition(Pred, LHS, RHS, Q.CxtI, Q.DL))
+ isImpliedByDomCondition(Pred, LHS, RHS, Q.CtxI, Q.DL))
return ConstantInt::getBool(RetTy, *Res);
const APFloat *C = nullptr;
@@ -5278,7 +5278,7 @@ static Value *simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
simplifySelectWithFCmp(Cond, TrueVal, FalseVal, FMF, Q, MaxRecurse))
return V;
- std::optional<bool> Imp = isImpliedByDomCondition(Cond, Q.CxtI, Q.DL);
+ std::optional<bool> Imp = isImpliedByDomCondition(Cond, Q.CtxI, Q.DL);
if (Imp)
return *Imp ? TrueVal : FalseVal;
// Look for same PHIs in the true and false values.
@@ -5661,7 +5661,7 @@ static Value *simplifyPHINode(PHINode *PN, ArrayRef<Value *> IncomingValues,
// Make sure we do not replace an undef value with poison.
if (HasUndefInput &&
- !isGuaranteedNotToBePoison(CommonValue, Q.AC, Q.CxtI, Q.DT))
+ !isGuaranteedNotToBePoison(CommonValue, Q.AC, Q.CtxI, Q.DT))
return nullptr;
return CommonValue;
}
@@ -6664,7 +6664,7 @@ static Value *simplifyUnaryIntrinsic(Intrinsic::ID IID, Value *Op0,
break;
case Intrinsic::ctpop: {
// ctpop(X) -> 1 iff X is non-zero power of 2.
- if (isKnownToBeAPowerOfTwo(Op0, Q.DL, /*OrZero*/ false, Q.AC, Q.CxtI, Q.DT))
+ if (isKnownToBeAPowerOfTwo(Op0, Q.DL, /*OrZero*/ false, Q.AC, Q.CtxI, Q.DT))
return ConstantInt::get(Op0->getType(), 1);
// If everything but the lowest bit is zero, that bit is the pop-count. Ex:
// ctpop(and X, 1) --> and X, 1
@@ -7689,7 +7689,7 @@ Value *llvm::simplifyConstrainedFPCall(CallBase *Call, const SimplifyQuery &Q) {
/// Given operands for a Freeze, see if we can fold the result.
static Value *simplifyFreezeInst(Value *Op0, const SimplifyQuery &Q) {
// Use a utility function defined in ValueTracking.
- if (llvm::isGuaranteedNotToBeUndefOrPoison(Op0, Q.AC, Q.CxtI, Q.DT))
+ if (llvm::isGuaranteedNotToBeUndefOrPoison(Op0, Q.AC, Q.CtxI, Q.DT))
return Op0;
// We have room for improvement.
return nullptr;
@@ -7746,7 +7746,7 @@ static Value *simplifyInstructionWithOperands(Instruction *I,
assert((!SQ.getFunction() || SQ.getFunction() == I->getFunction()) &&
"context instruction should be in the same function");
- const SimplifyQuery Q = SQ.CxtI ? SQ : SQ.getWithInstruction(I);
+ const SimplifyQuery Q = SQ.CtxI ? SQ : SQ.getWithInstruction(I);
switch (I->getOpcode()) {
default:
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 833d337fac8752..b15cee2fd6e9fa 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -406,10 +406,10 @@ class LazyValueInfoImpl {
Function *GuardDecl;
std::optional<ValueLatticeElement> getBlockValue(Value *Val, BasicBlock *BB,
- Instruction *CxtI);
+ Instruction *CtxI);
std::optional<ValueLatticeElement> getEdgeValue(Value *V, BasicBlock *F,
BasicBlock *T,
- Instruction *CxtI = nullptr);
+ Instruction *CtxI = nullptr);
// These methods process one work item and may add more. A false value
// returned means that the work item was not completely processed and must
@@ -423,7 +423,7 @@ class LazyValueInfoImpl {
BasicBlock *BB);
std::optional<ValueLatticeElement> solveBlockValueSelect(SelectInst *S,
BasicBlock *BB);
- std::optional<ConstantRange> getRangeFor(Value *V, Instruction *CxtI,
+ std::optional<ConstantRange> getRangeFor(Value *V, Instruction *CtxI,
BasicBlock *BB);
std::optional<ValueLatticeElement> solveBlockValueBinaryOpImpl(
Instruction *I, BasicBlock *BB,
@@ -454,7 +454,7 @@ class LazyValueInfoImpl {
std::optional<ValueLatticeElement>
getValueFromSimpleICmpCondition(CmpInst::Predicate Pred, Value *RHS,
- const APInt &Offset, Instruction *CxtI,
+ const APInt &Offset, Instruction *CtxI,
bool UseBlockValue);
std::optional<ValueLatticeElement>
@@ -477,19 +477,19 @@ class LazyValueInfoImpl {
/// specified Value* at the context instruction (if specified) or at the
/// start of the block.
ValueLatticeElement getValueInBlock(Value *V, BasicBlock *BB,
- Instruction *CxtI = nullptr);
+ Instruction *CtxI = nullptr);
/// This is the query interface to determine the lattice value for the
/// specified Value* at the specified instruction using only information
/// from assumes/guards and range metadata. Unlike getValueInBlock(), no
/// recursive query is performed.
- ValueLatticeElement getValueAt(Value *V, Instruction *CxtI);
+ ValueLatticeElement getValueAt(Value *V, Instruction *CtxI);
/// This is the query interface to determine the lattice
/// value for the specified Value* that is true on the specified edge.
ValueLatticeElement getValueOnEdge(Value *V, BasicBlock *FromBB,
BasicBlock *ToBB,
- Instruction *CxtI = nullptr);
+ Instruction *CtxI = nullptr);
ValueLatticeElement getValueAtUse(const Use &U);
@@ -583,14 +583,14 @@ void LazyValueInfoImpl::solve() {
std::optional<ValueLatticeElement>
LazyValueInfoImpl::getBlockValue(Value *Val, BasicBlock *BB,
- Instruction *CxtI) {
+ Instruction *CtxI) {
// If already a constant, there is nothing to compute.
if (Constant *VC = dyn_cast<Constant>(Val))
return ValueLatticeElement::get(VC);
if (std::optional<ValueLatticeElement> OptLatticeVal =
TheCache.getCachedValueInfo(Val, BB)) {
- intersectAssumeOrGuardBlockValueConstantRange(Val, *OptLatticeVal, CxtI);
+ intersectAssumeOrGuardBlockValueConstantRange(Val, *OptLatticeVal, CtxI);
return OptLatticeVal;
}
@@ -977,8 +977,8 @@ LazyValueInfoImpl::solveBlockValueSelect(SelectInst *SI, BasicBlock *BB) {
}
std::optional<ConstantRange>
-LazyValueInfoImpl::getRangeFor(Value *V, Instruction *CxtI, BasicBlock *BB) {
- std::optional<ValueLatticeElement> OptVal = getBlockValue(V, BB, CxtI);
+LazyValueInfoImpl::getRangeFor(Value *V, Instruction *CtxI, BasicBlock *BB) {
+ std::optional<ValueLatticeElement> OptVal = getBlockValue(V, BB, CtxI);
if (!OptVal)
return std::nullopt;
return OptVal->asConstantRange(V->getType());
@@ -1287,7 +1287,7 @@ std::optional<ValueLatticeElement>
LazyValueInfoImpl::getValueFromSimpleICmpCondition(CmpInst::Predicate Pred,
Value *RHS,
const APInt &Offset,
- Instruction *CxtI,
+ Instruction *CtxI,
bool UseBlockValue) {
ConstantRange RHSRange(RHS->getType()->getScalarSizeInBits(),
/*isFullSet=*/true);
@@ -1295,7 +1295,7 @@ LazyValueInfoImpl::getValueFromSimpleICmpCondition(CmpInst::Predicate Pred,
RHSRange = C->toConstantRange();
} else if (UseBlockValue) {
std::optional<ValueLatticeElement> R =
- getBlockValue(RHS, CxtI->getParent(), CxtI);
+ getBlockValue(RHS, CtxI->getParent(), CtxI);
if (!R)
return std::nullopt;
RHSRange = R->asConstantRange(RHS->getType());
@@ -1777,7 +1777,7 @@ LazyValueInfoImpl::getEdgeValueLocal(Value *Val, BasicBlock *BBFrom,
/// the basic block if the edge does not constrain Val.
std::optional<ValueLatticeElement>
LazyValueInfoImpl::getEdgeValue(Value *Val, BasicBlock *BBFrom,
- BasicBlock *BBTo, Instruction *CxtI) {
+ BasicBlock *BBTo, Instruction *CtxI) {
// If already a constant, there is nothing to compute.
if (Constant *VC = dyn_cast<Constant>(Val))
return ValueLatticeElement::get(VC);
@@ -1805,21 +1805,21 @@ LazyValueInfoImpl::getEdgeValue(Value *Val, BasicBlock *BBFrom,
// functions, the context instruction is not provided. When called from
// LazyValueInfoImpl::getValueOnEdge, the context instruction is provided,
// but then the result is not cached.
- intersectAssumeOrGuardBlockValueConstantRange(Val, InBlock, CxtI);
+ intersectAssumeOrGuardBlockValueConstantRange(Val, InBlock, CtxI);
return LocalResult->intersect(InBlock);
}
ValueLatticeElement LazyValueInfoImpl::getValueInBlock(Value *V, BasicBlock *BB,
- Instruction *CxtI) {
+ Instruction *CtxI) {
LLVM_DEBUG(dbgs() << "LVI Getting block end value " << *V << " at '"
<< BB->getName() << "'\n");
assert(BlockValueStack.empty() && BlockValueSet.empty());
- std::optional<ValueLatticeElement> OptResult = getBlockValue(V, BB, CxtI);
+ std::optional<ValueLatticeElement> OptResult = getBlockValue(V, BB, CtxI);
if (!OptResult) {
solve();
- OptResult = getBlockValue(V, BB, CxtI);
+ OptResult = getBlockValue(V, BB, CtxI);
assert(OptResult && "Value not available after solving");
}
@@ -1827,8 +1827,8 @@ ValueLatticeElement LazyValueInfoImpl::getValueInBlock(Value *V, BasicBlock *BB,
return *OptResult;
}
-ValueLatticeElement LazyValueInfoImpl::getValueAt(Value *V, Instruction *CxtI) {
- LLVM_DEBUG(dbgs() << "LVI Getting value " << *V << " at '" << CxtI->getName()
+ValueLatticeElement LazyValueInfoImpl::getValueAt(Value *V, Instruction *CtxI) {
+ LLVM_DEBUG(dbgs() << "LVI Getting value " << *V << " at '" << CtxI->getName()
<< "'\n");
if (auto *C = dyn_cast<Constant>(V))
@@ -1837,7 +1837,7 @@ ValueLatticeElement LazyValueInfoImpl::getValueAt(Value *V, Instruction *CxtI) {
ValueLatticeElement Result = ValueLatticeElement::getOverdefined();
if (auto *I = dyn_cast<Instruction>(V))
Result = getFromRangeMetadata(I);
- intersectAssumeOrGuardBlockValueConstantRange(V, Result, CxtI);
+ intersectAssumeOrGuardBlockValueConstantRange(V, Result, CtxI);
LLVM_DEBUG(dbgs() << " Result = " << Result << "\n");
return Result;
@@ -1845,19 +1845,19 @@ ValueLatticeElement LazyValueInfoImpl::getValueAt(Value *V, Instruction *CxtI) {
ValueLatticeElement LazyValueInfoImpl::
getValueOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB,
- Instruction *CxtI) {
+ Instruction *CtxI) {
LLVM_DEBUG(dbgs() << "LVI Getting edge value " << *V << " from '"
<< FromBB->getName() << "' to '" << ToBB->getName()
<< "'\n");
std::optional<ValueLatticeElement> Result =
- getEdgeValue(V, FromBB, ToBB, CxtI);
+ getEdgeValue(V, FromBB, ToBB, CtxI);
while (!Result) {
// As the worklist only explicitly tracks block values (but not edge values)
// we may have to call solve() multiple times, as the edge value calculation
// may request additional block values.
solve();
- Result = getEdgeValue(V, FromBB, ToBB, CxtI);
+ Result = getEdgeValue(V, FromBB, ToBB, CtxI);
}
LLVM_DEBUG(dbgs() << " Result = " << *Result << "\n");
@@ -1866,9 +1866,9 @@ getValueOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB,
ValueLatticeElement LazyValueInfoImpl::getValueAtUse(const Use &U) {
Value *V = U.get();
- auto *CxtI = cast<Instruction>(U.getUser());
- ValueLatticeElement VL = getValueInBlock(V, CxtI->getParent(), CxtI);
- BasicBlock *LastQueriedBB = CxtI->getParent();
+ auto *CtxI = cast<Instruction>(U.getUser());
+ ValueLatticeElement VL = getValueInBlock(V, CtxI->getParent(), CtxI);
+ BasicBlock *LastQueriedBB = CtxI->getParent();
// Check whether the only (possibly transitive) use of the value is in a
// position where V can be constrained by a select or branch condition.
@@ -2018,13 +2018,13 @@ static bool isKnownNonConstant(Value *V) {
return false;
}
-Constant *LazyValueInfo::getConstant(Value *V, Instruction *CxtI) {
+Constant *LazyValueInfo::getConstant(Value *V, Instruction *CtxI) {
// Bail out early if V is known not to be a Constant.
if (isKnownNonConstant(V))
return nullptr;
- BasicBlock *BB = CxtI->getParent();
- ValueLatticeElement Result = getOrCreateImpl().getValueInBlock(V, BB, CxtI);
+ BasicBlock *BB = CtxI->getParent();
+ ValueLatticeElement Result = getOrCreateImpl().getValueInBlock(V, BB, CtxI);
if (Result.isConstant())
return Result.getConstant();
@@ -2036,10 +2036,10 @@ Constant *LazyValueInfo::getConstant(Value *V, Instruction *CxtI) {
return nullptr;
}
-ConstantRange LazyValueInfo::getConstantRange(Value *V, Instruction *CxtI,
+ConstantRange LazyValueInfo::getConstantRange(Value *V, Instruction *CtxI,
bool UndefAllowed) {
- BasicBlock *BB = CxtI->getParent();
- ValueLatticeElement Result = getOrCreateImpl().getValueInBlock(V, BB, CxtI);
+ BasicBlock *BB = CtxI->getParent();
+ ValueLatticeElement Result = getOrCreateImpl().getValueInBlock(V, BB, CtxI);
return Result.asConstantRange(V->getType(), UndefAllowed);
}
@@ -2053,9 +2053,9 @@ ConstantRange LazyValueInfo::getConstantRangeAtUse(const Use &U,
/// constant on the specified edge. Return null if not.
Constant *LazyValueInfo::getConstantOnEdge(Value *V, BasicBlock *FromBB,
BasicBlock *ToBB,
- Instruction *CxtI) {
+ Instruction *CtxI) {
ValueLatticeElement Result =
- getOrCreateImpl().getValueOnEdge(V, FromBB, ToBB, CxtI);
+ getOrCreateImpl().getValueOnEdge(V, FromBB, ToBB, CtxI);
if (Result.isConstant())
return Result.getConstant();
@@ -2070,9 +2070,9 @@ Constant *LazyValueInfo::getConstantOnEdge(Value *V, BasicBlock *FromBB,
ConstantRange LazyValueInfo::getConstantRangeOnEdge(Value *V,
BasicBlock *FromBB,
BasicBlock *ToBB,
- Instruction *CxtI) {
+ Instruction *CtxI) {
ValueLatticeElement Result =
- getOrCreateImpl().getValueOnEdge(V, FromBB, ToBB, CxtI);
+ getOrCreateImpl().getValueOnEdge(V, FromBB, ToBB, CtxI);
// TODO: Should undef be allowed here?
return Result.asConstantRange(V->getType(), /*UndefAllowed*/ true);
}
@@ -2122,21 +2122,21 @@ static Constant *getPredicateResult(CmpInst::Predicate Pred, Constant *C,
Constant *LazyValueInfo::getPredicateOnEdge(CmpInst::Predicate Pred, Value *V,
Constant *C, BasicBlock *FromBB,
BasicBlock *ToBB,
- Instruction *CxtI) {
+ Instruction *CtxI) {
ValueLatticeElement Result =
- getOrCreateImpl().getValueOnEdge(V, FromBB, ToBB, CxtI);
+ getOrCreateImpl().getValueOnEdge(V, FromBB, ToBB, CtxI);
return getPredicateResult(Pred, C, Result, FromBB->getDataLayout());
}
Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *V,
- Constant *C, Instruction *CxtI,
+ Constant *C, Instruction *CtxI,
bool UseBlockValue) {
// Is or is not NonNull are common predicates being queried. If
// isKnownNonZero can tell us the result of the predicate, we can
// return it quickly. But this is only a fastpath, and falling
// through would still be correct.
- const DataLayout &DL = CxtI->getDataLayout();
+ const DataLayout &DL = CtxI->getDataLayout();
// NOTE: This check is meant to determine whether a pointer is semantically a
// null pointer, not just whether its value equals ConstantPointerNull. If the
// semantics of ConstantPointerNull change in the future, this should be
@@ -2152,8 +2152,8 @@ Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *V,
auto &Impl = getOrCreateImpl();
ValueLatticeElement Result =
- UseBlockValue ? Impl.getValueInBlock(V, CxtI->getParent(), CxtI)
- : Impl.getValueAt(V, CxtI);
+ UseBlockValue ? Impl.getValueInBlock(V, CtxI->getParent(), CtxI)
+ : Impl.getValueAt(V, CtxI);
Constant *Ret = getPredicateResult(Pred, C, Result, DL);
if (Ret)
return Ret;
@@ -2180,7 +2180,7 @@ Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *V,
// We could consider extending this to search further backwards through the
// CFG and/or value graph, but there are non-obvious compile time vs quality
// tradeoffs.
- BasicBlock *BB = CxtI->getParent();
+ BasicBlock *BB = CtxI->getParent();
// Function entry or an unreachable block. Bail to avoid confusing
// analysis below.
@@ -2200,7 +2200,7 @@ Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *V,
BasicBlock *PredBB = PHI->getIncomingBlock(i);
// Note that PredBB may be BB itself.
Constant *Result =
- getPredicateOnEdge(Pred, Incoming, C, PredBB, BB, CxtI);
+ getPredicateOnEdge(Pred, Incoming, C, PredBB, BB, CtxI);
// Keep going as long as we've seen a consistent known result for
// all inputs.
@@ -2221,11 +2221,11 @@ Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *V,
// For predecessor edge, determine if the comparison is true or false
// on that edge. If they're all true or all false, we can conclude
// the value of the comparison in this block.
- Constant *Baseline = getPredicateOnEdge(Pred, V, C, *PI, BB, CxtI);
+ Constant *Baseline = getPredicateOnEdge(Pred, V, C, *PI, BB, CtxI);
if (Baseline) {
// Check that all remaining incoming values match the first one.
while (++PI != PE) {
- Constant *Ret = getPredicateOnEdge(Pred, V, C, *PI, BB, CxtI);
+ Constant *Ret = getPredicateOnEdge(Pred, V, C, *PI, BB, CtxI);
if (Ret != Baseline)
break;
}
@@ -2240,12 +2240,12 @@ Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *V,
}
Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *LHS,
- Value *RHS, Instruction *CxtI,
+ Value *RHS, Instruction *CtxI,
bool UseBlockValue) {
if (auto *C = dyn_cast<Constant>(RHS))
- return getPredicateAt(Pred, LHS, C, CxtI, UseBlockValue);
+ return getPredicateAt(Pred, LHS, C, CtxI, UseBlockValue);
if (auto *C = dyn_cast<Constant>(LHS))
- return getPredicateAt(CmpInst::getSwappedPredicate(Pred), RHS, C, CxtI,
+ return getPredicateAt(CmpInst::getSwappedPredicate(Pred), RHS, C, CtxI,
UseBlockValue);
// Got two non-Constant values. Try to determine the comparison results based
@@ -2253,14 +2253,14 @@ Constant *LazyValueInfo::getPredicateAt(CmpInst::Predicate Pred, Value *LHS,
// non-overlapping ranges.
if (UseBlockValue) {
ValueLatticeElement L =
- getOrCreateImpl().getValueInBlock(LHS, CxtI->getParent(), CxtI);
+ getOrCreateImpl().getValueInBlock(LHS, CtxI->getParent(), CtxI);
if (L.isOverdefined())
return nullptr;
ValueLatticeElement R =
- getOrCreateImpl().getValueInBlock(RHS, CxtI->getParent(), CxtI);
+ getOrCreateImpl().getValueInBlock(RHS, CtxI->getParent(), CtxI);
Type *Ty = CmpInst::makeCmpResultType(LHS->getType());
- return L.getCompare(Pred, Ty, R, CxtI->getDataLayout());
+ return L.getCompare(Pred, Ty, R, CtxI->getDataLayout());
}
return nullptr;
}
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 2e8c884e13729c..3760f46b12f822 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -35,7 +35,7 @@ static bool isAligned(const Value *Base, Align Alignment,
static bool isDereferenceableAndAlignedPointerViaAssumption(
const Value *Ptr, Align Alignment, const SimplifyQuery &SQ, bool IgnoreFree,
function_ref<bool(const RetainedKnowledge &RK)> CheckSize) {
- if (!SQ.CxtI)
+ if (!SQ.CtxI)
return false;
// Look through assumes to see if both dereferenceability and alignment can
// be proven by an assume if needed.
@@ -45,7 +45,7 @@ static bool isDereferenceableAndAlignedPointerViaAssumption(
return getKnowledgeForValue(
Ptr, {Attribute::Dereferenceable, Attribute::Alignment}, *SQ.AC,
[&](RetainedKnowledge RK, Instruction *Assume, auto) {
- if (!isValidAssumeForContext(Assume, SQ.CxtI, SQ.DT))
+ if (!isValidAssumeForContext(Assume, SQ.CtxI, SQ.DT))
return false;
if (RK.AttrKind == Attribute::Alignment) {
IsAligned |= RK.ArgValue >= Alignment.value();
@@ -54,7 +54,7 @@ static bool isDereferenceableAndAlignedPointerViaAssumption(
// Dereferenceable information from assumptions is only valid if the
// value cannot be freed between the assumption and use.
if (!IsDerefable &&
- (!PtrCanBeFreed || willNotFreeBetween(Assume, SQ.CxtI)) &&
+ (!PtrCanBeFreed || willNotFreeBetween(Assume, SQ.CtxI)) &&
CheckSize(RK))
IsDerefable = true;
}
@@ -149,7 +149,7 @@ static bool isDereferenceableAndAlignedPointer(
DefI = &cast<Argument>(V)->getParent()->getEntryBlock().front();
}
- if (!SQ.CxtI || !willNotFreeBetween(DefI, SQ.CxtI))
+ if (!SQ.CtxI || !willNotFreeBetween(DefI, SQ.CtxI))
return false;
}
@@ -162,7 +162,7 @@ static bool isDereferenceableAndAlignedPointer(
// We don't bother handling allocas here, as they aren't speculatable
// anyway.
if (I && !isa<AllocaInst>(I))
- return SQ.CxtI && isValidAssumeForContext(I, SQ.CxtI, SQ.DT);
+ return SQ.CtxI && isValidAssumeForContext(I, SQ.CtxI, SQ.DT);
return true;
};
if (IsKnownDeref()) {
@@ -459,11 +459,11 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment,
if (isDereferenceableAndAlignedPointer(V, Alignment, Size, SQ)) {
// With sanitizers `Dereferenceable` is not always enough for unconditional
// load.
- if (!SQ.CxtI || !suppressSpeculativeLoadForSanitizers(*SQ.CxtI))
+ if (!SQ.CtxI || !suppressSpeculativeLoadForSanitizers(*SQ.CtxI))
return true;
}
- if (!SQ.CxtI)
+ if (!SQ.CtxI)
return false;
if (Size.getBitWidth() > 64)
@@ -475,7 +475,7 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment,
// from/to. If so, the previous load or store would have already trapped,
// so there is no harm doing an extra load (also, CSE will later eliminate
// the load entirely).
- auto BBI = SQ.CxtI->getIterator(), E = SQ.CxtI->getParent()->begin();
+ auto BBI = SQ.CtxI->getIterator(), E = SQ.CtxI->getParent()->begin();
// We can at least always strip pointer casts even though we can't use the
// base here.
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index b822b7a5d39277..441461de918c26 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -5228,7 +5228,7 @@ struct BinaryOp {
static std::optional<BinaryOp> MatchBinaryOp(Value *V, const DataLayout &DL,
AssumptionCache &AC,
const DominatorTree &DT,
- const Instruction *CxtI) {
+ const Instruction *CtxI) {
auto *Op = dyn_cast<Operator>(V);
if (!Op)
return std::nullopt;
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 4c2cac9c440a08..1479246c1d0ef8 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -1025,7 +1025,7 @@ TargetTransformInfo::commonOperandInfo(const Value *X, const Value *Y) {
InstructionCost TargetTransformInfo::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
OperandValueInfo Op1Info, OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI,
+ ArrayRef<const Value *> Args, const Instruction *CtxI,
const TargetLibraryInfo *TLibInfo) const {
// Use call cost for frem intructions that have platform specific vector math
@@ -1041,7 +1041,7 @@ InstructionCost TargetTransformInfo::getArithmeticInstrCost(
}
InstructionCost Cost = TTIImpl->getArithmeticInstrCost(
- Opcode, Ty, CostKind, Op1Info, Op2Info, Args, CxtI);
+ Opcode, Ty, CostKind, Op1Info, Op2Info, Args, CtxI);
assert(Cost >= 0 && "TTI should not produce negative costs!");
return Cost;
}
@@ -1058,7 +1058,7 @@ InstructionCost TargetTransformInfo::getAltInstrCost(
InstructionCost TargetTransformInfo::getShuffleCost(
ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
@@ -1066,7 +1066,7 @@ InstructionCost TargetTransformInfo::getShuffleCost(
assert(SrcTy->getScalarType() == DstTy->getScalarType() &&
"Expected the same scalar types");
InstructionCost Cost = TTIImpl->getShuffleCost(
- Kind, DstTy, SrcTy, CostKind, Mask, Index, SubTp, Args, CxtI, VIC);
+ Kind, DstTy, SrcTy, CostKind, Mask, Index, SubTp, Args, CtxI, VIC);
assert(Cost >= 0 && "TTI should not produce negative costs!");
return Cost;
}
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index ed1e2f7467e197..80aef4d8aeca8f 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -110,16 +110,16 @@ static unsigned getBitWidth(Type *Ty, const DataLayout &DL) {
// Given the provided Value and, potentially, a context instruction, return
// the preferred context instruction (if any).
-static const Instruction *safeCxtI(const Value *V, const Instruction *CxtI) {
+static const Instruction *safeCtxI(const Value *V, const Instruction *CtxI) {
// If we've been provided with a context instruction, then use that (provided
// it has been inserted).
- if (CxtI && CxtI->getParent())
- return CxtI;
+ if (CtxI && CtxI->getParent())
+ return CtxI;
// If the value is really an already-inserted instruction, then use that.
- CxtI = dyn_cast<Instruction>(V);
- if (CxtI && CxtI->getParent())
- return CxtI;
+ CtxI = dyn_cast<Instruction>(V);
+ if (CtxI && CtxI->getParent())
+ return CtxI;
return nullptr;
}
@@ -156,19 +156,19 @@ void llvm::computeKnownBits(const Value *V, KnownBits &Known,
void llvm::computeKnownBits(const Value *V, KnownBits &Known,
const DataLayout &DL, AssumptionCache *AC,
- const Instruction *CxtI, const DominatorTree *DT,
+ const Instruction *CtxI, const DominatorTree *DT,
bool UseInstrInfo, unsigned Depth) {
computeKnownBits(V, Known,
- SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo),
+ SimplifyQuery(DL, DT, AC, safeCtxI(V, CtxI), UseInstrInfo),
Depth);
}
KnownBits llvm::computeKnownBits(const Value *V, const DataLayout &DL,
- AssumptionCache *AC, const Instruction *CxtI,
+ AssumptionCache *AC, const Instruction *CtxI,
const DominatorTree *DT, bool UseInstrInfo,
unsigned Depth) {
return computeKnownBits(
- V, SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo), Depth);
+ V, SimplifyQuery(DL, DT, AC, safeCtxI(V, CtxI), UseInstrInfo), Depth);
}
static NoCommonBitsSetResult
@@ -179,14 +179,14 @@ haveNoCommonBitsSetSpecialCases(const Value *LHS, const Value *RHS,
Value *M;
if (match(LHS, m_c_And(m_Not(m_Value(M)), m_Value())) &&
match(RHS, m_c_And(m_Specific(M), m_Value())))
- return isGuaranteedNotToBeUndef(M, SQ.AC, SQ.CxtI, SQ.DT)
+ return isGuaranteedNotToBeUndef(M, SQ.AC, SQ.CtxI, SQ.DT)
? NoCommonBitsSetResult::Known
: NoCommonBitsSetResult::OnlyIfUndefIgnored;
}
// X op (Y & ~X)
if (match(RHS, m_c_And(m_Not(m_Specific(LHS)), m_Value())))
- return isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CxtI, SQ.DT)
+ return isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CtxI, SQ.DT)
? NoCommonBitsSetResult::Known
: NoCommonBitsSetResult::OnlyIfUndefIgnored;
@@ -195,8 +195,8 @@ haveNoCommonBitsSetSpecialCases(const Value *LHS, const Value *RHS,
Value *Y;
if (match(RHS,
m_c_Xor(m_c_And(m_Specific(LHS), m_Value(Y)), m_Deferred(Y)))) {
- bool IsNoUndef = isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CxtI, SQ.DT) &&
- isGuaranteedNotToBeUndef(Y, SQ.AC, SQ.CxtI, SQ.DT);
+ bool IsNoUndef = isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CtxI, SQ.DT) &&
+ isGuaranteedNotToBeUndef(Y, SQ.AC, SQ.CtxI, SQ.DT);
return IsNoUndef ? NoCommonBitsSetResult::Known
: NoCommonBitsSetResult::OnlyIfUndefIgnored;
}
@@ -205,7 +205,7 @@ haveNoCommonBitsSetSpecialCases(const Value *LHS, const Value *RHS,
// (ext Y) op ext(~Y)
if (match(LHS, m_ZExtOrSExt(m_Value(Y))) &&
match(RHS, m_ZExtOrSExt(m_Not(m_Specific(Y)))))
- return isGuaranteedNotToBeUndef(Y, SQ.AC, SQ.CxtI, SQ.DT)
+ return isGuaranteedNotToBeUndef(Y, SQ.AC, SQ.CtxI, SQ.DT)
? NoCommonBitsSetResult::Known
: NoCommonBitsSetResult::OnlyIfUndefIgnored;
@@ -214,8 +214,8 @@ haveNoCommonBitsSetSpecialCases(const Value *LHS, const Value *RHS,
Value *A, *B;
if (match(LHS, m_And(m_Value(A), m_Value(B))) &&
match(RHS, m_Not(m_c_Or(m_Specific(A), m_Specific(B))))) {
- bool IsNoUndef = isGuaranteedNotToBeUndef(A, SQ.AC, SQ.CxtI, SQ.DT) &&
- isGuaranteedNotToBeUndef(B, SQ.AC, SQ.CxtI, SQ.DT);
+ bool IsNoUndef = isGuaranteedNotToBeUndef(A, SQ.AC, SQ.CtxI, SQ.DT) &&
+ isGuaranteedNotToBeUndef(B, SQ.AC, SQ.CtxI, SQ.DT);
return IsNoUndef ? NoCommonBitsSetResult::Known
: NoCommonBitsSetResult::OnlyIfUndefIgnored;
}
@@ -291,11 +291,11 @@ bool llvm::isOnlyUsedInZeroEqualityComparison(const Instruction *I) {
bool llvm::isKnownToBeAPowerOfTwo(const Value *V, const DataLayout &DL,
bool OrZero, AssumptionCache *AC,
- const Instruction *CxtI,
+ const Instruction *CtxI,
const DominatorTree *DT, bool UseInstrInfo,
unsigned Depth) {
return ::isKnownToBeAPowerOfTwo(
- V, OrZero, SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo),
+ V, OrZero, SimplifyQuery(DL, DT, AC, safeCtxI(V, CtxI), UseInstrInfo),
Depth);
}
@@ -361,19 +361,19 @@ static unsigned ComputeNumSignBits(const Value *V, const SimplifyQuery &Q,
}
unsigned llvm::ComputeNumSignBits(const Value *V, const DataLayout &DL,
- AssumptionCache *AC, const Instruction *CxtI,
+ AssumptionCache *AC, const Instruction *CtxI,
const DominatorTree *DT, bool UseInstrInfo,
unsigned Depth) {
return ::ComputeNumSignBits(
- V, SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo), Depth);
+ V, SimplifyQuery(DL, DT, AC, safeCtxI(V, CtxI), UseInstrInfo), Depth);
}
unsigned llvm::ComputeMaxSignificantBits(const Value *V, const DataLayout &DL,
AssumptionCache *AC,
- const Instruction *CxtI,
+ const Instruction *CtxI,
const DominatorTree *DT,
unsigned Depth) {
- unsigned SignBits = ComputeNumSignBits(V, DL, AC, CxtI, DT, Depth);
+ unsigned SignBits = ComputeNumSignBits(V, DL, AC, CtxI, DT, Depth);
return V->getType()->getScalarSizeInBits() - SignBits + 1;
}
@@ -526,7 +526,7 @@ static void computeKnownBitsAddSub(bool Add, const Value *Op0, const Value *Op1,
KnownOut = KnownBits::computeForAddSub(Add, NSW, NUW, Known2, KnownOut);
if (!Add && NSW && !KnownOut.isNonNegative() &&
- (isImpliedByDomCondition(ICmpInst::ICMP_SLE, Op1, Op0, Q.CxtI, Q.DL)
+ (isImpliedByDomCondition(ICmpInst::ICMP_SLE, Op1, Op0, Q.CtxI, Q.DL)
.value_or(false) ||
match(Op1, m_c_SMin(m_Specific(Op0), m_Value()))))
KnownOut.makeNonNegative();
@@ -578,7 +578,7 @@ static void computeKnownBitsMul(const Value *Op0, const Value *Op1, bool NSW,
bool SelfMultiply = Op0 == Op1;
if (SelfMultiply)
SelfMultiply &=
- isGuaranteedNotToBeUndef(Op0, Q.AC, Q.CxtI, Q.DT, Depth + 1);
+ isGuaranteedNotToBeUndef(Op0, Q.AC, Q.CtxI, Q.DT, Depth + 1);
Known = KnownBits::mul(Known, Known2, SelfMultiply);
if (SelfMultiply) {
@@ -678,7 +678,7 @@ bool llvm::isAssumeLikeIntrinsic(const Instruction *I) {
}
bool llvm::isValidAssumeForContext(const Instruction *Inv,
- const Instruction *CxtI,
+ const Instruction *CtxI,
const DominatorTree *DT,
bool AllowEphemerals) {
// There are two restrictions on the use of an assume:
@@ -689,36 +689,36 @@ bool llvm::isValidAssumeForContext(const Instruction *Inv,
// feeding the assume is trivially true, thus causing the removal of
// the assume).
- if (Inv->getParent() == CxtI->getParent()) {
+ if (Inv->getParent() == CtxI->getParent()) {
// If Inv and CtxI are in the same block, check if the assume (Inv) is first
// in the BB.
- if (Inv->comesBefore(CxtI))
+ if (Inv->comesBefore(CtxI))
return true;
// Don't let an assume affect itself - this would cause the problems
// `isEphemeralValueOf` is trying to prevent, and it would also make
// the loop below go out of bounds.
- if (!AllowEphemerals && Inv == CxtI)
+ if (!AllowEphemerals && Inv == CtxI)
return false;
// The context comes first, but they're both in the same block.
// Make sure there is nothing in between that might interrupt
- // the control flow, not even CxtI itself.
+ // the control flow, not even CtxI itself.
// We limit the scan distance between the assume and its context instruction
// to avoid a compile-time explosion. This limit is chosen arbitrarily, so
// it can be adjusted if needed (could be turned into a cl::opt).
- auto Range = make_range(CxtI->getIterator(), Inv->getIterator());
+ auto Range = make_range(CtxI->getIterator(), Inv->getIterator());
if (!isGuaranteedToTransferExecutionToSuccessor(Range, 15))
return false;
- return AllowEphemerals || !isEphemeralValueOf(Inv, CxtI);
+ return AllowEphemerals || !isEphemeralValueOf(Inv, CtxI);
}
- // Inv and CxtI are in different blocks.
+ // Inv and CtxI are in different blocks.
if (DT) {
- if (DT->dominates(Inv, CxtI))
+ if (DT->dominates(Inv, CtxI))
return true;
- } else if (Inv->getParent() == CxtI->getParent()->getSinglePredecessor() ||
+ } else if (Inv->getParent() == CtxI->getParent()->getSinglePredecessor() ||
Inv->getParent()->isEntryBlock()) {
// We don't have a DT, but this trivially dominates.
return true;
@@ -847,7 +847,7 @@ static void breakSelfRecursivePHI(const Use *U, const PHINode *PHI,
static bool isKnownNonZeroFromAssume(const Value *V, const SimplifyQuery &Q) {
// Use of assumptions is context-sensitive. If we don't have a context, we
// cannot use them!
- if (!Q.AC || !Q.CxtI)
+ if (!Q.AC || !Q.CtxI)
return false;
for (AssumptionCache::ResultElem &Elem : Q.AC->assumptionsFor(V)) {
@@ -855,11 +855,11 @@ static bool isKnownNonZeroFromAssume(const Value *V, const SimplifyQuery &Q) {
continue;
AssumeInst *I = cast<AssumeInst>(Elem.Assume);
- assert(I->getFunction() == Q.CxtI->getFunction() &&
+ assert(I->getFunction() == Q.CtxI->getFunction() &&
"Got assumption for the wrong function!");
if (Elem.Index != AssumptionCache::ExprResultIdx) {
- if (assumeBundleImpliesNonNull(V, Q.CxtI->getFunction(),
+ if (assumeBundleImpliesNonNull(V, Q.CtxI->getFunction(),
I->getOperandBundleAt(Elem.Index)) &&
isValidAssumeForContext(I, Q))
return true;
@@ -1060,19 +1060,19 @@ void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
if (Q.CC && Q.CC->AffectedValues.contains(V))
computeKnownBitsFromCond(V, Q.CC->Cond, Known, Q, Q.CC->Invert, Depth);
- if (!Q.CxtI)
+ if (!Q.CtxI)
return;
if (Q.DC && Q.DT) {
// Handle dominating conditions.
for (CondBrInst *BI : Q.DC->conditionsFor(V)) {
BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
- if (Q.DT->dominates(Edge0, Q.CxtI->getParent()))
+ if (Q.DT->dominates(Edge0, Q.CtxI->getParent()))
computeKnownBitsFromCond(V, BI->getCondition(), Known, Q,
/*Invert*/ false, Depth);
BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
- if (Q.DT->dominates(Edge1, Q.CxtI->getParent()))
+ if (Q.DT->dominates(Edge1, Q.CtxI->getParent()))
computeKnownBitsFromCond(V, BI->getCondition(), Known, Q,
/*Invert*/ true, Depth);
}
@@ -1094,7 +1094,7 @@ void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
continue;
AssumeInst *I = cast<AssumeInst>(Elem.Assume);
- assert(I->getParent()->getParent() == Q.CxtI->getParent()->getParent() &&
+ assert(I->getParent()->getParent() == Q.CtxI->getParent()->getParent() &&
"Got assumption for the wrong function!");
if (Elem.Index != AssumptionCache::ExprResultIdx) {
@@ -1375,7 +1375,7 @@ void llvm::adjustKnownBitsForSelectArm(KnownBits &Known, Value *Cond,
// Finally make sure the information we found is valid. This is relatively
// expensive so it's left for the very end.
- if (!isGuaranteedNotToBeUndef(Arm, Q.AC, Q.CxtI, Q.DT, Depth + 1))
+ if (!isGuaranteedNotToBeUndef(Arm, Q.AC, Q.CtxI, Q.DT, Depth + 1))
return;
// Finally, we know we get information from the condition and its valid,
@@ -1451,10 +1451,10 @@ static void computeKnownBitsForRecurrenceOperands(
SimplifyQuery RecQ = Q.getWithoutCondContext();
unsigned OpNum = P->getOperand(0) == Start ? 0 : 1;
- RecQ.CxtI = P->getIncomingBlock(OpNum)->getTerminator();
+ RecQ.CtxI = P->getIncomingBlock(OpNum)->getTerminator();
computeKnownBits(Start, DemandedElts, KnownStart, RecQ, Depth + 1);
- RecQ.CxtI = P->getIncomingBlock(1 - OpNum)->getTerminator();
+ RecQ.CtxI = P->getIncomingBlock(1 - OpNum)->getTerminator();
computeKnownBits(Step, DemandedElts, KnownStep, RecQ, Depth + 1);
}
@@ -1876,7 +1876,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
// correct to use the original context. IF warranted, explore and
// add sufficient tests to cover.
SimplifyQuery RecQ = Q.getWithoutCondContext();
- RecQ.CxtI = P;
+ RecQ.CtxI = P;
computeKnownBits(Start, DemandedElts, KnownStart, RecQ, Depth + 1);
switch (Opcode) {
case Instruction::Shl:
@@ -2007,9 +2007,9 @@ static void computeKnownBitsFromOperator(const Operator *I,
Known.setAllConflict();
for (const Use &U : P->operands()) {
Value *IncValue;
- const PHINode *CxtPhi;
- Instruction *CxtI;
- breakSelfRecursivePHI(&U, P, IncValue, CxtI, &CxtPhi);
+ const PHINode *CtxPhi;
+ Instruction *CtxI;
+ breakSelfRecursivePHI(&U, P, IncValue, CtxI, &CtxPhi);
// Skip direct self references.
if (IncValue == P)
continue;
@@ -2018,7 +2018,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
// phi. This is important because that is where the value is actually
// "evaluated" even though it is used later somewhere else. (see also
// D69571).
- SimplifyQuery RecQ = Q.getWithoutCondContext().getWithInstruction(CxtI);
+ SimplifyQuery RecQ = Q.getWithoutCondContext().getWithInstruction(CtxI);
Known2 = KnownBits(BitWidth);
@@ -2036,14 +2036,14 @@ static void computeKnownBitsFromOperator(const Operator *I,
const APInt *RHSC;
BasicBlock *TrueSucc, *FalseSucc;
// TODO: Use RHS Value and compute range from its known bits.
- if (match(RecQ.CxtI,
+ if (match(RecQ.CtxI,
m_Br(m_c_ICmp(Pred, m_Specific(IncValue), m_APInt(RHSC)),
m_BasicBlock(TrueSucc), m_BasicBlock(FalseSucc)))) {
// Check for cases of duplicate successors.
- if ((TrueSucc == CxtPhi->getParent()) !=
- (FalseSucc == CxtPhi->getParent())) {
+ if ((TrueSucc == CtxPhi->getParent()) !=
+ (FalseSucc == CtxPhi->getParent())) {
// If we're using the false successor, invert the predicate.
- if (FalseSucc == CxtPhi->getParent())
+ if (FalseSucc == CtxPhi->getParent())
Pred = CmpInst::getInversePredicate(Pred);
// Get the knownbits implied by the incoming phi condition.
auto CR = ConstantRange::makeExactICmpRegion(Pred, *RHSC);
@@ -2507,7 +2507,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
}
break;
case Instruction::Freeze:
- if (isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ if (isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CtxI, Q.DT,
Depth + 1))
computeKnownBits(I->getOperand(0), Known, Q, Depth + 1);
break;
@@ -2701,7 +2701,7 @@ static bool isPowerOfTwoRecurrence(const PHINode *PN, bool OrZero,
if (U.get() == Start) {
// Initial value comes from a different BB, need to adjust context
// instruction for analysis.
- Q.CxtI = PN->getIncomingBlock(U)->getTerminator();
+ Q.CtxI = PN->getIncomingBlock(U)->getTerminator();
if (!isKnownToBeAPowerOfTwo(Start, OrZero, Q, Depth))
return false;
}
@@ -2712,7 +2712,7 @@ static bool isPowerOfTwoRecurrence(const PHINode *PN, bool OrZero,
if (BO->getOpcode() != Instruction::Mul && BO->getOperand(1) != Step)
return false;
- Q.CxtI = BO->getParent()->getTerminator();
+ Q.CtxI = BO->getParent()->getTerminator();
switch (BO->getOpcode()) {
case Instruction::Mul:
// Power of two is closed under multiplication.
@@ -2778,7 +2778,7 @@ bool llvm::isKnownToBeAPowerOfTwo(const Value *V, bool OrZero,
return true;
// Try to infer from assumptions.
- if (Q.AC && Q.CxtI) {
+ if (Q.AC && Q.CtxI) {
for (auto &AssumeVH : Q.AC->assumptionsFor(V)) {
if (!AssumeVH)
continue;
@@ -2791,20 +2791,20 @@ bool llvm::isKnownToBeAPowerOfTwo(const Value *V, bool OrZero,
}
// Handle dominating conditions.
- if (Q.DC && Q.CxtI && Q.DT) {
+ if (Q.DC && Q.CtxI && Q.DT) {
for (CondBrInst *BI : Q.DC->conditionsFor(V)) {
Value *Cond = BI->getCondition();
BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
if (isImpliedToBeAPowerOfTwoFromCond(V, OrZero, Cond,
/*CondIsTrue=*/true) &&
- Q.DT->dominates(Edge0, Q.CxtI->getParent()))
+ Q.DT->dominates(Edge0, Q.CtxI->getParent()))
return true;
BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
if (isImpliedToBeAPowerOfTwoFromCond(V, OrZero, Cond,
/*CondIsTrue=*/false) &&
- Q.DT->dominates(Edge1, Q.CxtI->getParent()))
+ Q.DT->dominates(Edge1, Q.CtxI->getParent()))
return true;
}
}
@@ -2813,8 +2813,8 @@ bool llvm::isKnownToBeAPowerOfTwo(const Value *V, bool OrZero,
if (!I)
return false;
- if (Q.CxtI && match(V, m_VScale())) {
- const Function *F = Q.CxtI->getFunction();
+ if (Q.CtxI && match(V, m_VScale())) {
+ const Function *F = Q.CtxI->getFunction();
// The vscale_range indicates vscale is a power-of-two.
return F->hasFnAttribute(Attribute::VScaleRange);
}
@@ -2926,7 +2926,7 @@ bool llvm::isKnownToBeAPowerOfTwo(const Value *V, bool OrZero,
// Change the context instruction to the incoming block where it is
// evaluated.
- RecQ.CxtI = PN->getIncomingBlock(U)->getTerminator();
+ RecQ.CtxI = PN->getIncomingBlock(U)->getTerminator();
return isKnownToBeAPowerOfTwo(U.get(), OrZero, RecQ, NewDepth);
});
}
@@ -3561,12 +3561,12 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
return llvm::all_of(PN->operands(), [&](const Use &U) {
if (U.get() == PN)
return true;
- RecQ.CxtI = PN->getIncomingBlock(U)->getTerminator();
+ RecQ.CtxI = PN->getIncomingBlock(U)->getTerminator();
// Check if the branch on the phi excludes zero.
CmpPredicate Pred;
Value *X;
BasicBlock *TrueSucc, *FalseSucc;
- if (match(RecQ.CxtI,
+ if (match(RecQ.CtxI,
m_Br(m_c_ICmp(Pred, m_Specific(U.get()), m_Value(X)),
m_BasicBlock(TrueSucc), m_BasicBlock(FalseSucc)))) {
// Check for cases of duplicate successors.
@@ -3636,7 +3636,7 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
}
case Instruction::Freeze:
return isKnownNonZero(I->getOperand(0), Q, Depth) &&
- isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CtxI, Q.DT,
Depth);
case Instruction::Load: {
auto *LI = cast<LoadInst>(I);
@@ -3913,7 +3913,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts,
return true;
if (!isa<Constant>(V) &&
- isKnownNonNullFromDominatingCondition(V, Q.CxtI, Q.DT))
+ isKnownNonNullFromDominatingCondition(V, Q.CtxI, Q.DT))
return true;
if (const Value *Stripped = stripNullTest(V))
@@ -4132,7 +4132,7 @@ static bool isNonEqualPHIs(const PHINode *PN1, const PHINode *PN2,
return false;
SimplifyQuery RecQ = Q.getWithoutCondContext();
- RecQ.CxtI = IncomBB->getTerminator();
+ RecQ.CtxI = IncomBB->getTerminator();
if (!isKnownNonEqual(IV1, IV2, DemandedElts, RecQ, Depth + 1))
return false;
UsedFullRecursion = true;
@@ -4214,7 +4214,7 @@ static bool isNonEqualPointersWithRecursiveGEP(const Value *A, const Value *B,
static bool isKnownNonEqualFromContext(const Value *V1, const Value *V2,
const SimplifyQuery &Q, unsigned Depth) {
- if (!Q.CxtI)
+ if (!Q.CtxI)
return false;
// Try to infer NonEqual based on information from dominating conditions.
@@ -4223,14 +4223,14 @@ static bool isKnownNonEqualFromContext(const Value *V1, const Value *V2,
for (CondBrInst *BI : Q.DC->conditionsFor(V)) {
Value *Cond = BI->getCondition();
BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
- if (Q.DT->dominates(Edge0, Q.CxtI->getParent()) &&
+ if (Q.DT->dominates(Edge0, Q.CtxI->getParent()) &&
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
/*LHSIsTrue=*/true, Depth)
.value_or(false))
return true;
BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
- if (Q.DT->dominates(Edge1, Q.CxtI->getParent()) &&
+ if (Q.DT->dominates(Edge1, Q.CtxI->getParent()) &&
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
/*LHSIsTrue=*/false, Depth)
.value_or(false))
@@ -4254,7 +4254,7 @@ static bool isKnownNonEqualFromContext(const Value *V1, const Value *V2,
continue;
CallInst *I = cast<CallInst>(AssumeVH);
- assert(I->getFunction() == Q.CxtI->getFunction() &&
+ assert(I->getFunction() == Q.CtxI->getFunction() &&
"Got assumption for the wrong function!");
assert(I->getIntrinsicID() == Intrinsic::assume &&
"must be an assume intrinsic");
@@ -4281,7 +4281,7 @@ static bool isNonEqualURem(const Value *X, const Value *Rem,
return true;
std::optional<bool> Implied =
- isImpliedByDomCondition(ICmpInst::ICMP_UGE, X, Y, Q.CxtI, Q.DL);
+ isImpliedByDomCondition(ICmpInst::ICMP_UGE, X, Y, Q.CtxI, Q.DL);
return Implied && *Implied;
}
@@ -4682,7 +4682,7 @@ static unsigned ComputeNumSignBitsImpl(const Value *V,
Tmp = TyBits;
for (unsigned i = 0, e = NumIncomingValues; i != e; ++i) {
if (Tmp == 1) return Tmp;
- RecQ.CxtI = PN->getIncomingBlock(i)->getTerminator();
+ RecQ.CtxI = PN->getIncomingBlock(i)->getTerminator();
Tmp = std::min(Tmp, ComputeNumSignBits(PN->getIncomingValue(i),
DemandedElts, RecQ, Depth + 1));
}
@@ -4968,21 +4968,21 @@ bool llvm::isSignBitCheck(ICmpInst::Predicate Pred, const APInt &RHS,
static void computeKnownFPClassFromCond(const Value *V, Value *Cond,
bool CondIsTrue,
- const Instruction *CxtI,
+ const Instruction *CtxI,
KnownFPClass &KnownFromContext,
unsigned Depth = 0) {
Value *A, *B;
if (Depth < MaxAnalysisRecursionDepth &&
(CondIsTrue ? match(Cond, m_LogicalAnd(m_Value(A), m_Value(B)))
: match(Cond, m_LogicalOr(m_Value(A), m_Value(B))))) {
- computeKnownFPClassFromCond(V, A, CondIsTrue, CxtI, KnownFromContext,
+ computeKnownFPClassFromCond(V, A, CondIsTrue, CtxI, KnownFromContext,
Depth + 1);
- computeKnownFPClassFromCond(V, B, CondIsTrue, CxtI, KnownFromContext,
+ computeKnownFPClassFromCond(V, B, CondIsTrue, CtxI, KnownFromContext,
Depth + 1);
return;
}
if (Depth < MaxAnalysisRecursionDepth && match(Cond, m_Not(m_Value(A)))) {
- computeKnownFPClassFromCond(V, A, !CondIsTrue, CxtI, KnownFromContext,
+ computeKnownFPClassFromCond(V, A, !CondIsTrue, CtxI, KnownFromContext,
Depth + 1);
return;
}
@@ -5020,7 +5020,7 @@ static void computeKnownFPClassFromCond(const Value *V, Value *Cond,
/// exponent range is [-149, -2], but the 0 edge case is above this range).
static std::tuple<int, int, int>
computeKnownExponentRangeFromContext(const Value *V, const SimplifyQuery &Q) {
- if (!Q.CxtI || !Q.DC || !Q.DT)
+ if (!Q.CtxI || !Q.DC || !Q.DT)
return {APFloat::IEK_NaN, APFloat::IEK_Inf, APFloat::IEK_Inf};
// Intersect the bounds implied by every dominating condition, keeping the
@@ -5053,7 +5053,7 @@ computeKnownExponentRangeFromContext(const Value *V, const SimplifyQuery &Q) {
BasicBlockEdge Edge1(BI->getParent(),
BI->getSuccessor(IsLessEqual ? 0 : 1));
- if (Q.DT->dominates(Edge1, Q.CxtI->getParent())) {
+ if (Q.DT->dominates(Edge1, Q.CtxI->getParent())) {
// frexp returns an exponent one greater than ilogb.
int Exp = ilogb(*LimitC) + 1;
@@ -5079,10 +5079,10 @@ static KnownFPClass computeKnownFPClassFromContext(const Value *V,
KnownFPClass KnownFromContext;
if (Q.CC && Q.CC->AffectedValues.contains(V))
- computeKnownFPClassFromCond(V, Q.CC->Cond, !Q.CC->Invert, Q.CxtI,
+ computeKnownFPClassFromCond(V, Q.CC->Cond, !Q.CC->Invert, Q.CtxI,
KnownFromContext);
- if (!Q.CxtI)
+ if (!Q.CtxI)
return KnownFromContext;
if (Q.DC && Q.DT) {
@@ -5091,13 +5091,13 @@ static KnownFPClass computeKnownFPClassFromContext(const Value *V,
Value *Cond = BI->getCondition();
BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
- if (Q.DT->dominates(Edge0, Q.CxtI->getParent()))
- computeKnownFPClassFromCond(V, Cond, /*CondIsTrue=*/true, Q.CxtI,
+ if (Q.DT->dominates(Edge0, Q.CtxI->getParent()))
+ computeKnownFPClassFromCond(V, Cond, /*CondIsTrue=*/true, Q.CtxI,
KnownFromContext);
BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
- if (Q.DT->dominates(Edge1, Q.CxtI->getParent()))
- computeKnownFPClassFromCond(V, Cond, /*CondIsTrue=*/false, Q.CxtI,
+ if (Q.DT->dominates(Edge1, Q.CtxI->getParent()))
+ computeKnownFPClassFromCond(V, Cond, /*CondIsTrue=*/false, Q.CtxI,
KnownFromContext);
}
}
@@ -5112,7 +5112,7 @@ static KnownFPClass computeKnownFPClassFromContext(const Value *V,
continue;
CallInst *I = cast<CallInst>(AssumeVH);
- assert(I->getFunction() == Q.CxtI->getParent()->getParent() &&
+ assert(I->getFunction() == Q.CtxI->getParent()->getParent() &&
"Got assumption for the wrong function!");
assert(I->getIntrinsicID() == Intrinsic::assume &&
"must be an assume intrinsic");
@@ -5121,7 +5121,7 @@ static KnownFPClass computeKnownFPClassFromContext(const Value *V,
continue;
computeKnownFPClassFromCond(V, I->getArgOperand(0),
- /*CondIsTrue=*/true, Q.CxtI, KnownFromContext);
+ /*CondIsTrue=*/true, Q.CtxI, KnownFromContext);
}
return KnownFromContext;
@@ -5134,13 +5134,13 @@ void llvm::adjustKnownFPClassForSelectArm(KnownFPClass &Known, Value *Cond,
KnownFPClass KnownSrc;
computeKnownFPClassFromCond(Arm, Cond,
- /*CondIsTrue=*/!Invert, SQ.CxtI, KnownSrc,
+ /*CondIsTrue=*/!Invert, SQ.CtxI, KnownSrc,
Depth + 1);
KnownSrc = KnownSrc.unionWith(Known);
if (KnownSrc.isUnknown())
return;
- if (isGuaranteedNotToBeUndef(Arm, SQ.AC, SQ.CxtI, SQ.DT, Depth + 1))
+ if (isGuaranteedNotToBeUndef(Arm, SQ.AC, SQ.CtxI, SQ.DT, Depth + 1))
Known = KnownSrc;
}
@@ -5979,7 +5979,7 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
// Special case fadd x, x, which is the canonical form of fmul x, 2.
bool Self = Op->getOperand(0) == Op->getOperand(1) &&
- isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CtxI, Q.DT,
Depth + 1);
if (Self)
KnownLHS = KnownRHS;
@@ -6071,7 +6071,7 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
F ? F->getDenormalMode(FltSem) : DenormalMode::getDynamic();
if (Op->getOperand(0) == Op->getOperand(1) &&
- isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT)) {
+ isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CtxI, Q.DT)) {
// X / X is always exactly 1.0 or a NaN.
Known.setKnownFPClasses(fcNan | fcPosNormal);
@@ -6120,7 +6120,7 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
: DenormalMode::getDynamic();
if (Op->getOperand(0) == Op->getOperand(1) &&
- isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT)) {
+ isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CtxI, Q.DT)) {
// X % X is always exactly [+-]0.0 or a NaN.
Known.setKnownFPClasses(fcNan | fcZero);
@@ -6377,8 +6377,8 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
for (const Use &U : P->operands()) {
Value *IncValue;
- Instruction *CxtI;
- breakSelfRecursivePHI(&U, P, IncValue, CxtI);
+ Instruction *CtxI;
+ breakSelfRecursivePHI(&U, P, IncValue, CtxI);
// Skip direct self references.
if (IncValue == P)
continue;
@@ -6388,7 +6388,7 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
// to waste time spinning around in loops. We need at least depth 2 to
// detect known sign bits.
computeKnownFPClass(IncValue, DemandedElts, InterestedClasses, KnownSrc,
- Q.getWithoutCondContext().getWithInstruction(CxtI),
+ Q.getWithoutCondContext().getWithInstruction(CtxI),
PhiRecursionLimit);
if (First) {
@@ -6424,7 +6424,7 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
computeKnownFPClass(Init, DemandedElts, InterestedClasses, KnownStart,
Q, Depth + 1);
if (KnownStart.cannotBeOrderedLessThanZero() && L == R &&
- isGuaranteedNotToBeUndef(L, Q.AC, Q.CxtI, Q.DT, Depth + 1))
+ isGuaranteedNotToBeUndef(L, Q.AC, Q.CtxI, Q.DT, Depth + 1))
Known.knownNot(KnownFPClass::OrderedLessThanZeroMask);
break;
}
@@ -6493,10 +6493,10 @@ KnownFPClass llvm::computeKnownFPClass(const Value *V,
KnownFPClass llvm::computeKnownFPClass(
const Value *V, const DataLayout &DL, FPClassTest InterestedClasses,
- const TargetLibraryInfo *TLI, AssumptionCache *AC, const Instruction *CxtI,
+ const TargetLibraryInfo *TLI, AssumptionCache *AC, const Instruction *CtxI,
const DominatorTree *DT, bool UseInstrInfo, unsigned Depth) {
return computeKnownFPClass(V, InterestedClasses,
- SimplifyQuery(DL, TLI, DT, AC, CxtI, UseInstrInfo),
+ SimplifyQuery(DL, TLI, DT, AC, CtxI, UseInstrInfo),
Depth);
}
@@ -7862,10 +7862,10 @@ OverflowResult llvm::computeOverflowForUnsignedSub(const Value *LHS,
// See simplifyICmpWithBinOpOnLHS() for candidates.
if (match(RHS, m_URem(m_Specific(LHS), m_Value())) ||
match(RHS, m_NUWSub(m_Specific(LHS), m_Value())))
- if (isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CxtI, SQ.DT))
+ if (isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CtxI, SQ.DT))
return OverflowResult::NeverOverflows;
- if (auto C = isImpliedByDomCondition(CmpInst::ICMP_UGE, LHS, RHS, SQ.CxtI,
+ if (auto C = isImpliedByDomCondition(CmpInst::ICMP_UGE, LHS, RHS, SQ.CtxI,
SQ.DL)) {
if (*C)
return OverflowResult::NeverOverflows;
@@ -7892,7 +7892,7 @@ OverflowResult llvm::computeOverflowForSignedSub(const Value *LHS,
// then determining no-overflow may allow other transforms.
if (match(RHS, m_SRem(m_Specific(LHS), m_Value())) ||
match(RHS, m_NSWSub(m_Specific(LHS), m_Value())))
- if (isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CxtI, SQ.DT))
+ if (isGuaranteedNotToBeUndef(LHS, SQ.AC, SQ.CtxI, SQ.DT))
return OverflowResult::NeverOverflows;
// If LHS and RHS each have at least two sign bits, the subtraction
@@ -8238,7 +8238,7 @@ static bool isGuaranteedNotToBeUndefOrPoison(
if (programUndefinedIfUndefOrPoison(V, !includesUndef(Kind)))
return true;
- // CxtI may be null or a cloned instruction.
+ // CtxI may be null or a cloned instruction.
if (!CtxI || !CtxI->getParent() || !DT)
return false;
@@ -10840,13 +10840,13 @@ ConstantRange llvm::computeConstantRange(const Value *V, bool ForSigned,
}
}
- if (SQ.CxtI && SQ.AC) {
+ if (SQ.CtxI && SQ.AC) {
// Try to restrict the range based on information from assumptions.
for (auto &AssumeVH : SQ.AC->assumptionsFor(V)) {
if (!AssumeVH)
continue;
CallInst *I = cast<CallInst>(AssumeVH);
- assert(I->getParent()->getParent() == SQ.CxtI->getParent()->getParent() &&
+ assert(I->getParent()->getParent() == SQ.CtxI->getParent()->getParent() &&
"Got assumption for the wrong function!");
assert(I->getIntrinsicID() == Intrinsic::assume &&
"must be an assume intrinsic");
diff --git a/llvm/lib/MC/MCPseudoProbe.cpp b/llvm/lib/MC/MCPseudoProbe.cpp
index 6151abed56db88..85bfde80722eb7 100644
--- a/llvm/lib/MC/MCPseudoProbe.cpp
+++ b/llvm/lib/MC/MCPseudoProbe.cpp
@@ -305,10 +305,10 @@ std::string MCDecodedPseudoProbe::getInlineContextStr(
std::ostringstream OContextStr;
SmallVector<MCPseudoProbeFrameLocation, 16> ContextStack;
getInlineContext(ContextStack, GUID2FuncMAP);
- for (auto &Cxt : ContextStack) {
+ for (auto &Ctx : ContextStack) {
if (OContextStr.str().size())
OContextStr << " @ ";
- OContextStr << Cxt.first.str() << ":" << Cxt.second;
+ OContextStr << Ctx.first.str() << ":" << Ctx.second;
}
return OContextStr.str();
}
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 581f37d4c17bce..5b690e5e8043ca 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -4926,7 +4926,7 @@ std::optional<InstructionCost> AArch64TTIImpl::getFP16BF16PromoteCost(
InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// The code-generator is currently not able to handle scalable vectors
// of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
@@ -4945,7 +4945,7 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
ISD == ISD::FDIV || ISD == ISD::FREM || ISD == ISD::FNEG)
if (CostKind != TTI::TCK_RecipThroughput)
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
- Op2Info, Args, CxtI);
+ Op2Info, Args, CtxI);
if (ISD == ISD::FADD || ISD == ISD::FSUB || ISD == ISD::FMUL ||
ISD == ISD::FDIV || ISD == ISD::FREM) {
@@ -5284,10 +5284,10 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
// Scalar fmul(fneg) or fneg(fmul) can be converted to fnmul
if ((Ty->isFloatTy() || Ty->isDoubleTy() ||
(Ty->isHalfTy() && ST->hasFullFP16())) &&
- CxtI &&
- ((CxtI->hasOneUse() &&
- match(*CxtI->user_begin(), m_FMul(m_Value(), m_Value()))) ||
- match(CxtI->getOperand(0), m_FMul(m_Value(), m_Value()))))
+ CtxI &&
+ ((CtxI->hasOneUse() &&
+ match(*CtxI->user_begin(), m_FMul(m_Value(), m_Value()))) ||
+ match(CtxI->getOperand(0), m_FMul(m_Value(), m_Value()))))
return 0;
[[fallthrough]];
case ISD::FADD:
@@ -6978,7 +6978,7 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
InstructionCost AArch64TTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
@@ -7006,7 +7006,7 @@ InstructionCost AArch64TTIImpl::getShuffleCost(
// store(interleaving-shuffle). The shuffle cost could potentially be free,
// but we model it with a cost of LT.first so that ST3/ST4 have a higher
// cost than just the store.
- if (CxtI && CxtI->hasOneUse() && isa<StoreInst>(*CxtI->user_begin()) &&
+ if (CtxI && CtxI->hasOneUse() && isa<StoreInst>(*CtxI->user_begin()) &&
(ShuffleVectorInst::isInterleaveMask(
Mask, 4, SrcTy->getElementCount().getKnownMinValue() * 2) ||
ShuffleVectorInst::isInterleaveMask(
@@ -7074,7 +7074,7 @@ InstructionCost AArch64TTIImpl::getShuffleCost(
? getShuffleCost(NumSources <= 1 ? TTI::SK_PermuteSingleSrc
: TTI::SK_PermuteTwoSrc,
NTp, NTp, CostKind, NMask, 0, nullptr, Args,
- CxtI)
+ CtxI)
: LTNumElts;
Result.first->second = NCost;
Cost += NCost;
@@ -7337,7 +7337,7 @@ InstructionCost AArch64TTIImpl::getShuffleCost(
if (IsExtractSubvector)
Kind = TTI::SK_ExtractSubvector;
return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index, SubTp,
- Args, CxtI);
+ Args, CtxI);
}
static bool containsDecreasingPointers(Loop *TheLoop,
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
index c1d8fc787ef623..f086ba1844965c 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
@@ -251,7 +251,7 @@ class AArch64TTIImpl final : public BasicTTIImplBase<AArch64TTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost
getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE, const SCEV *Ptr,
@@ -506,7 +506,7 @@ class AArch64TTIImpl final : public BasicTTIImplBase<AArch64TTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
index 0f9fdfb46ce237..2534ec57f84092 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
@@ -65,11 +65,11 @@ class AMDGPULateCodeGenPrepare
// whole AccessSize-byte range at Base to be dereferenceable, not just Base
// itself aligned.
bool isSafeToWidenLoad(const Value *Base, uint64_t AccessSize,
- const Instruction *CxtI) const {
+ const Instruction *CtxI) const {
return isDereferenceableAndAlignedPointer(
Base, Align(4),
APInt(DL.getIndexTypeSizeInBits(Base->getType()), AccessSize),
- SimplifyQuery(DL, /*TLI=*/nullptr, /*DT=*/nullptr, AC, CxtI));
+ SimplifyQuery(DL, /*TLI=*/nullptr, /*DT=*/nullptr, AC, CtxI));
}
bool canWidenScalarExtLoad(LoadInst &LI) const;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
index ccb0c7314dcef4..7fb54dac74174d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
@@ -549,7 +549,7 @@ static bool canFuseFMulWithFAddSub(const SITargetLowering &TLI, Type *Ty,
InstructionCost GCNTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// Legalize the type.
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
@@ -608,12 +608,12 @@ InstructionCost GCNTTIImpl::getArithmeticInstrCost(
// Check possible fuse {fadd|fsub}(a,fmul(b,c)) and return zero cost for
// fmul(b,c) supposing the fadd|fsub will get estimated cost for the whole
// fused operation.
- if (CxtI && CxtI->hasOneUse()) {
- const auto *FAddSub = dyn_cast<BinaryOperator>(*CxtI->user_begin());
+ if (CtxI && CtxI->hasOneUse()) {
+ const auto *FAddSub = dyn_cast<BinaryOperator>(*CtxI->user_begin());
if (FAddSub &&
(FAddSub->getOpcode() == Instruction::FAdd ||
FAddSub->getOpcode() == Instruction::FSub) &&
- canFuseFMulWithFAddSub(*TLI, Ty, CxtI, FAddSub))
+ canFuseFMulWithFAddSub(*TLI, Ty, CtxI, FAddSub))
return TargetTransformInfo::TCC_Free;
}
[[fallthrough]];
@@ -668,7 +668,7 @@ InstructionCost GCNTTIImpl::getArithmeticInstrCost(
return LT.first * Cost * NElts;
}
- if (SLT == MVT::f32 && (CxtI && CxtI->hasApproxFunc())) {
+ if (SLT == MVT::f32 && (CtxI && CtxI->hasApproxFunc())) {
// Fast unsafe fdiv lowering:
// f32 rcp
// f32 fmul
@@ -698,7 +698,7 @@ InstructionCost GCNTTIImpl::getArithmeticInstrCost(
}
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
}
// Return true if there's a potential benefit from using v2f16/v2i16
@@ -1384,7 +1384,7 @@ Value *GCNTTIImpl::rewriteIntrinsicWithAddressSpace(IntrinsicInst *II,
InstructionCost GCNTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
if (!isa<FixedVectorType>(SrcTy))
return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index,
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
index 4d9ff8d2d767f7..ed53519ee5ae8c 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
@@ -170,7 +170,7 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind,
const Instruction *I = nullptr) const override;
@@ -249,7 +249,7 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index d9b83ea76a20ef..3ea4ddd10a00a8 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -1227,7 +1227,7 @@ InstructionCost ARMTTIImpl::getMemcpyCost(const Instruction *I) const {
InstructionCost ARMTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
@@ -1356,7 +1356,7 @@ InstructionCost ARMTTIImpl::getShuffleCost(
// store(interleaving-shuffle). The shuffle cost could potentially be
// free, but we model it with a cost of LT.first so that ST2/ST4 have a
// higher cost than just the store.
- if (CxtI && CxtI->hasOneUse() && isa<StoreInst>(*CxtI->user_begin()) &&
+ if (CtxI && CtxI->hasOneUse() && isa<StoreInst>(*CtxI->user_begin()) &&
(LT.second.getScalarSizeInBits() == 8 ||
LT.second.getScalarSizeInBits() == 16 ||
LT.second.getScalarSizeInBits() == 32) &&
@@ -1390,7 +1390,7 @@ InstructionCost ARMTTIImpl::getShuffleCost(
InstructionCost ARMTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
int ISDOpcode = TLI->InstructionOpcodeToISD(Opcode);
if (ST->isThumb() && CostKind == TTI::TCK_CodeSize && Ty->isIntegerTy(1)) {
// Make operations on i1 relatively expensive as this often involves
@@ -1478,13 +1478,13 @@ InstructionCost ARMTTIImpl::getArithmeticInstrCost(
if (ST->isThumb1Only() || Ty->isVectorTy())
return false;
- if (!CxtI || !CxtI->hasOneUse() || !CxtI->isShift())
+ if (!CtxI || !CtxI->hasOneUse() || !CtxI->isShift())
return false;
if (!Op2Info.isUniform() || !Op2Info.isConstant())
return false;
// Folded into a ADC/ADD/AND/BIC/CMP/EOR/MVN/ORR/ORN/RSB/SBC/SUB
- switch (cast<Instruction>(CxtI->user_back())->getOpcode()) {
+ switch (cast<Instruction>(CtxI->user_back())->getOpcode()) {
case Instruction::Add:
case Instruction::Sub:
case Instruction::And:
@@ -1553,7 +1553,7 @@ InstructionCost ARMTTIImpl::getArithmeticInstrCost(
return false;
};
- if (MulInDSPMLALPattern(CxtI, Opcode, Ty))
+ if (MulInDSPMLALPattern(CtxI, Opcode, Ty))
return 0;
// Default to cheap (throughput/size of 1 instruction) but adjust throughput
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
index 0ad782320ecc00..7dacff87fae36d 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
@@ -195,7 +195,7 @@ class ARMTTIImpl final : public BasicTTIImplBase<ARMTTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
@@ -238,7 +238,7 @@ class ARMTTIImpl final : public BasicTTIImplBase<ARMTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost getMemoryOpCost(
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
diff --git a/llvm/lib/Target/BPF/BPFTargetTransformInfo.h b/llvm/lib/Target/BPF/BPFTargetTransformInfo.h
index 95defdc7b83796..0d5ff2d36aca94 100644
--- a/llvm/lib/Target/BPF/BPFTargetTransformInfo.h
+++ b/llvm/lib/Target/BPF/BPFTargetTransformInfo.h
@@ -63,7 +63,7 @@ class BPFTTIImpl final : public BasicTTIImplBase<BPFTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override {
+ const Instruction *CtxI = nullptr) const override {
int ISD = TLI->InstructionOpcodeToISD(Opcode);
if (ISD == ISD::ADD && CostKind == TTI::TCK_RecipThroughput)
return SCEVCheapExpansionBudget.getValue() + 1;
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp b/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
index fad70ff87cc752..3d24eb4a23b552 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
@@ -234,7 +234,7 @@ InstructionCost HexagonTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
InstructionCost HexagonTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
return 1;
}
@@ -269,11 +269,11 @@ InstructionCost HexagonTTIImpl::getCmpSelInstrCost(
InstructionCost HexagonTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// TODO: Handle more cost kinds.
if (CostKind != TTI::TCK_RecipThroughput)
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
- Op2Info, Args, CxtI);
+ Op2Info, Args, CtxI);
if (Ty->isVectorTy()) {
if (!isHVXVectorType(Ty) && Ty->isFPOrFPVectorTy())
@@ -283,7 +283,7 @@ InstructionCost HexagonTTIImpl::getArithmeticInstrCost(
return LT.first + FloatFactor * getTypeNumElements(Ty);
}
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
}
InstructionCost HexagonTTIImpl::getCastInstrCost(unsigned Opcode, Type *DstTy,
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h b/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
index 59642d6cf2d974..dbc88e40e9d5ae 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
+++ b/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
@@ -128,7 +128,7 @@ class HexagonTTIImpl final : public BasicTTIImplBase<HexagonTTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
InstructionCost getInterleavedMemoryOpCost(
@@ -146,7 +146,7 @@ class HexagonTTIImpl final : public BasicTTIImplBase<HexagonTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost
getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
TTI::CastContextHint CCH, TTI::TargetCostKind CostKind,
diff --git a/llvm/lib/Target/Lanai/LanaiTargetTransformInfo.h b/llvm/lib/Target/Lanai/LanaiTargetTransformInfo.h
index 0342af65c1ef73..78f8eb62cb7893 100644
--- a/llvm/lib/Target/Lanai/LanaiTargetTransformInfo.h
+++ b/llvm/lib/Target/Lanai/LanaiTargetTransformInfo.h
@@ -96,7 +96,7 @@ class LanaiTTIImpl final : public BasicTTIImplBase<LanaiTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override {
+ const Instruction *CtxI = nullptr) const override {
int ISD = TLI->InstructionOpcodeToISD(Opcode);
switch (ISD) {
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
index 47ca32336c8c72..3bbbaef3686eea 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
@@ -501,7 +501,7 @@ NVPTXTTIImpl::getInstructionCost(const User *U,
InstructionCost NVPTXTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// Legalize the type.
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h
index c6313a5a0fb518..6dd9dbd23869c2 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h
@@ -127,7 +127,7 @@ class NVPTXTTIImpl final : public BasicTTIImplBase<NVPTXTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost
getScalarizationOverhead(VectorType *InTy, const APInt &DemandedElts,
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
index 9d46853e5d5831..0383f9ed68d2fe 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
@@ -599,7 +599,7 @@ InstructionCost PPCTTIImpl::vectorCostAdjustmentFactor(unsigned Opcode,
InstructionCost PPCTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
assert(TLI->InstructionOpcodeToISD(Opcode) && "Invalid opcode");
InstructionCost CostFactor = vectorCostAdjustmentFactor(Opcode, Ty, nullptr);
@@ -609,7 +609,7 @@ InstructionCost PPCTTIImpl::getArithmeticInstrCost(
// TODO: Handle more cost kinds.
if (CostKind != TTI::TCK_RecipThroughput)
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
- Op2Info, Args, CxtI);
+ Op2Info, Args, CtxI);
// Fallback to the default implementation.
InstructionCost Cost = BaseT::getArithmeticInstrCost(
@@ -620,7 +620,7 @@ InstructionCost PPCTTIImpl::getArithmeticInstrCost(
InstructionCost PPCTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
InstructionCost CostFactor =
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
index a16463275cb1e8..3702283c543408 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
@@ -110,12 +110,12 @@ class PPCTTIImpl final : public BasicTTIImplBase<PPCTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
InstructionCost
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 7f65e3dd4456a2..80a3cff6fd376b 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -736,7 +736,7 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
InstructionCost RISCVTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
@@ -2837,7 +2837,7 @@ std::optional<InstructionCost>
RISCVTTIImpl::getCombinedArithmeticInstructionCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Opd1Info, TTI::OperandValueInfo Opd2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// Vector unsigned division/remainder will be simplified to shifts/masks.
if ((Opcode == Instruction::UDiv || Opcode == Instruction::URem) &&
Opd2Info.isConstant() && Opd2Info.isPowerOf2()) {
@@ -2854,25 +2854,25 @@ RISCVTTIImpl::getCombinedArithmeticInstructionCost(
InstructionCost RISCVTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// TODO: Handle more cost kinds.
if (CostKind != TTI::TCK_RecipThroughput)
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
if (isa<FixedVectorType>(Ty) && !ST->useRVVForFixedLengthVectors())
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
// Skip if scalar size of Ty is bigger than ELEN.
if (isa<VectorType>(Ty) && Ty->getScalarSizeInBits() > ST->getELen())
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
if (std::optional<InstructionCost> CombinedCost =
getCombinedArithmeticInstructionCost(Opcode, Ty, CostKind, Op1Info,
- Op2Info, Args, CxtI))
+ Op2Info, Args, CtxI))
return *CombinedCost;
// Legalize the type.
@@ -2895,7 +2895,7 @@ InstructionCost RISCVTTIImpl::getArithmeticInstrCost(
return Entry->Cost * LT.first;
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
}
// f16 with zvfhmin and bf16 will be promoted to f32.
@@ -2987,7 +2987,7 @@ InstructionCost RISCVTTIImpl::getArithmeticInstrCost(
// differentiate them.
return CastCost + ConstantMatCost +
BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
}
InstructionCost InstrCost = getRISCVInstructionCost(Op, LT.second, CostKind);
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index d6e904c53dc70d..0b4b36109dec9e 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -178,7 +178,7 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
@@ -228,7 +228,7 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
std::optional<InstructionCost> getCombinedArithmeticInstructionCost(
unsigned ISDOpcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Opd1Info, TTI::OperandValueInfo Opd2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const;
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const;
InstructionCost
getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
@@ -273,7 +273,7 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
bool isElementTypeLegalForScalableVector(Type *Ty) const override {
return TLI->isLegalElementTypeForRVV(TLI->getValueType(DL, Ty));
diff --git a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
index e3c0aa2755175b..06f84c78a504d0 100644
--- a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
@@ -611,13 +611,13 @@ static bool isFoldableRMW(const Instruction *I, Type *Ty) {
InstructionCost SystemZTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// TODO: Handle more cost kinds.
if (CostKind != TTI::TCK_RecipThroughput)
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
- Op2Info, Args, CxtI);
- if (CxtI && Ty && !Ty->isVectorTy() && isFoldableRMW(CxtI, Ty))
+ Op2Info, Args, CtxI);
+ if (CtxI && Ty && !Ty->isVectorTy() && isFoldableRMW(CtxI, Ty))
return TTI::TCC_Free;
// TODO: return a good value for BB-VECTORIZER that includes the
// immediate loads, which we do not want to count for the loop
@@ -791,13 +791,13 @@ InstructionCost SystemZTTIImpl::getArithmeticInstrCost(
// Fallback to the default implementation.
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
}
InstructionCost SystemZTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
Kind = improveShuffleKindFromMask(Kind, Mask, SrcTy, Index, SubTp);
if (ST->hasVector()) {
diff --git a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
index 36a2bc90bdcbbc..8236790a6e2717 100644
--- a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
+++ b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
@@ -103,7 +103,7 @@ class SystemZTTIImpl final : public BasicTTIImplBase<SystemZTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
@@ -118,7 +118,7 @@ class SystemZTTIImpl final : public BasicTTIImplBase<SystemZTTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy) const;
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
index 4b392a7c802dc7..208f126ab26067 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
@@ -56,7 +56,7 @@ TypeSize WebAssemblyTTIImpl::getRegisterBitWidth(
InstructionCost WebAssemblyTTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
if (ST->hasSIMD128()) {
static const CostTblEntry ArithCostTbl[]{
@@ -302,7 +302,7 @@ InstructionCost WebAssemblyTTIImpl::getMemoryOpCost(
InstructionCost WebAssemblyTTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
// Canonicalize the ShuffleKind in case optimizations didn't.
// Otherwise, we might end up with the wrong ShuffleKind to match against.
@@ -315,7 +315,7 @@ InstructionCost WebAssemblyTTIImpl::getShuffleCost(
return 1;
return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index, SubTp,
- Args, CxtI);
+ Args, CtxI);
}
InstructionCost WebAssemblyTTIImpl::getInterleavedMemoryOpCost(
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
index 83c1736fcee4d6..bfa83a0312a0f3 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
@@ -67,7 +67,7 @@ class WebAssemblyTTIImpl final : public BasicTTIImplBase<WebAssemblyTTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost
getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
@@ -90,7 +90,7 @@ class WebAssemblyTTIImpl final : public BasicTTIImplBase<WebAssemblyTTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 846e8c8968ccc7..e42916fe8b5d5e 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -255,7 +255,7 @@ unsigned X86TTIImpl::getMaxInterleaveFactor(ElementCount VF,
InstructionCost X86TTIImpl::getArithmeticInstrCost(
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ArrayRef<const Value *> Args, const Instruction *CtxI) const {
// vXi8 multiplications are always promoted to vXi16.
// Sub-128-bit types can be extended/packed more efficiently.
@@ -782,7 +782,7 @@ InstructionCost X86TTIImpl::getArithmeticInstrCost(
// Variable divisors lower through a float divide. strictfp needs SAE
// rounding which is 512-bit only.
bool IsStrictFP =
- CxtI && CxtI->getFunction()->hasFnAttribute(Attribute::StrictFP);
+ CtxI && CtxI->getFunction()->hasFnAttribute(Attribute::StrictFP);
bool IsDivRem = ISD == ISD::UDIV || ISD == ISD::SDIV || ISD == ISD::UREM ||
ISD == ISD::SREM;
bool VarDivToFP = IsDivRem && !Op2Info.isConstant() &&
@@ -824,15 +824,15 @@ InstructionCost X86TTIImpl::getArithmeticInstrCost(
// queries, so the cost cannot disagree with what codegen emits.
bool IsSignedDiv = ISD == ISD::SDIV || ISD == ISD::SREM;
auto OperandsFit = [&](unsigned Mantissa) {
- if (Args.size() != 2 || !CxtI)
+ if (Args.size() != 2 || !CtxI)
return false;
unsigned EltBits = LT.second.getScalarSizeInBits();
- const DataLayout &DL = CxtI->getDataLayout();
+ const DataLayout &DL = CtxI->getDataLayout();
auto Fits = [&](const Value *V) {
if (IsSignedDiv)
- return ComputeNumSignBits(V, DL, /*AC=*/nullptr, CxtI) + Mantissa >
+ return ComputeNumSignBits(V, DL, /*AC=*/nullptr, CtxI) + Mantissa >
EltBits;
- return computeKnownBits(V, DL, /*AC=*/nullptr, CxtI)
+ return computeKnownBits(V, DL, /*AC=*/nullptr, CtxI)
.countMaxActiveBits() <= Mantissa;
};
return Fits(Args[0]) && Fits(Args[1]);
@@ -1933,7 +1933,7 @@ InstructionCost X86TTIImpl::getArithmeticInstrCost(
// Fallback to the default implementation.
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
- Args, CxtI);
+ Args, CtxI);
}
InstructionCost
@@ -1948,7 +1948,7 @@ X86TTIImpl::getAltInstrCost(VectorType *VecTy, unsigned Opcode0,
InstructionCost X86TTIImpl::getShuffleCost(
TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
TTI::VectorInstrContext VIC) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.h b/llvm/lib/Target/X86/X86TargetTransformInfo.h
index f4197c260ba81a..41fbcc77304fb2 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.h
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.h
@@ -71,7 +71,7 @@ class X86TTIImpl final : public BasicTTIImplBase<X86TTIImpl> {
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr) const override;
+ const Instruction *CtxI = nullptr) const override;
InstructionCost getAltInstrCost(VectorType *VecTy, unsigned Opcode0,
unsigned Opcode1,
const SmallBitVector &OpcodeMask,
@@ -81,7 +81,7 @@ class X86TTIImpl final : public BasicTTIImplBase<X86TTIImpl> {
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
- const Instruction *CxtI = nullptr,
+ const Instruction *CtxI = nullptr,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
InstructionCost
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 588129f5acf18d..ce585c69e9cf3c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -726,7 +726,7 @@ static Value *foldLogOpOfMaskedICmps(Value *LHS, Value *RHS, bool IsAnd,
Value *InstCombinerImpl::simplifyRangeCheck(CmpPredicate PredL, Value *LHS0,
Value *LHS1, CmpPredicate PredR,
Value *RHS0, Value *RHS1,
- Instruction *CxtI, bool Inverted) {
+ Instruction *CtxI, bool Inverted) {
// Check the lower range comparison, e.g. x >= 0
// InstCombine already ensured that if there is a constant it's on the RHS.
ConstantInt *RangeStart = dyn_cast<ConstantInt>(LHS1);
@@ -772,7 +772,7 @@ Value *InstCombinerImpl::simplifyRangeCheck(CmpPredicate PredL, Value *LHS0,
}
// This simplification is only valid if the upper range is not negative.
- KnownBits Known = computeKnownBits(RangeEnd, CxtI);
+ KnownBits Known = computeKnownBits(RangeEnd, CtxI);
if (!Known.isNonNegative())
return nullptr;
@@ -856,9 +856,9 @@ static Value *foldAndOrOfICmpsWithPow2AndWithZero(
static Value *foldSignedTruncationCheck(CmpPredicate PredL, Value *LHS0,
Value *LHS1, CmpPredicate PredR,
Value *RHS0, Value *RHS1,
- Instruction &CxtI,
+ Instruction &CtxI,
InstCombiner::BuilderTy &Builder) {
- assert(CxtI.getOpcode() == Instruction::And);
+ assert(CtxI.getOpcode() == Instruction::And);
// Match icmp ult (add %arg, C01), C1 (C1 == C01 << 1; powers of two)
auto tryToMatchSignedTruncationCheck = [](CmpPredicate Pred, Value *LHS,
@@ -943,7 +943,7 @@ static Value *foldSignedTruncationCheck(CmpPredicate PredL, Value *LHS0,
// %r = icmp ult %X, SignBit
return Builder.CreateICmpULT(X, ConstantInt::get(X->getType(), HighestBit),
- CxtI.getName() + ".simplified");
+ CtxI.getName() + ".simplified");
}
/// Fold (icmp eq ctpop(X) 1) | (icmp eq X 0) into (icmp ult ctpop(X) 2) and
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index c00f4a7a1b820e..7fae7b8cea7101 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1207,7 +1207,7 @@ static std::optional<bool> getKnownSign(Value *Op, const SimplifyQuery &SQ) {
Value *X, *Y;
if (match(Op, m_NSWSub(m_Value(X), m_Value(Y))))
- return isImpliedByDomCondition(ICmpInst::ICMP_SLT, X, Y, SQ.CxtI, SQ.DL);
+ return isImpliedByDomCondition(ICmpInst::ICMP_SLT, X, Y, SQ.CtxI, SQ.DL);
return std::nullopt;
}
@@ -1219,7 +1219,7 @@ static std::optional<bool> getKnownSignOrZero(Value *Op,
Value *X, *Y;
if (match(Op, m_NSWSub(m_Value(X), m_Value(Y))))
- return isImpliedByDomCondition(ICmpInst::ICMP_SLE, X, Y, SQ.CxtI, SQ.DL);
+ return isImpliedByDomCondition(ICmpInst::ICMP_SLE, X, Y, SQ.CtxI, SQ.DL);
return std::nullopt;
}
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 97defc5e3ddd35..9269e681944e86 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -307,14 +307,14 @@ class TypeEvaluationHelper {
/// This is used by code that tries to eliminate truncates.
[[nodiscard]] static bool canEvaluateTruncated(Value *V, Type *Ty,
InstCombinerImpl &IC,
- Instruction *CxtI);
+ Instruction *CtxI);
/// Determine if the specified value can be computed in the specified wider
/// type and produce the same low bits. If not, return false.
[[nodiscard]] static bool canEvaluateZExtd(Value *V, Type *Ty,
unsigned &BitsToClear,
InstCombinerImpl &IC,
- Instruction *CxtI);
+ Instruction *CtxI);
/// Return true if we can take the specified value and return it as type Ty
/// without inserting any new casts and without changing the value of the
@@ -450,14 +450,14 @@ class TypeEvaluationHelper {
[[nodiscard]] bool canEvaluateTruncatedImpl(Value *V, Type *Ty,
InstCombinerImpl &IC,
- Instruction *CxtI);
+ Instruction *CtxI);
[[nodiscard]] bool canEvaluateTruncatedPred(Value *V, Type *Ty,
InstCombinerImpl &IC,
- Instruction *CxtI);
+ Instruction *CtxI);
[[nodiscard]] bool canEvaluateZExtdImpl(Value *V, Type *Ty,
unsigned &BitsToClear,
InstCombinerImpl &IC,
- Instruction *CxtI);
+ Instruction *CtxI);
[[nodiscard]] bool canEvaluateSExtdImpl(Value *V, Type *Ty);
[[nodiscard]] bool canEvaluateSExtdPred(Value *V, Type *Ty);
@@ -511,9 +511,9 @@ bool TypeEvaluationHelper::canNotEvaluateInType(Value *V, Type *Ty) {
///
bool TypeEvaluationHelper::canEvaluateTruncated(Value *V, Type *Ty,
InstCombinerImpl &IC,
- Instruction *CxtI) {
+ Instruction *CtxI) {
TypeEvaluationHelper TYH;
- return TYH.canEvaluateTruncatedImpl(V, Ty, IC, CxtI) &&
+ return TYH.canEvaluateTruncatedImpl(V, Ty, IC, CtxI) &&
// We need to check whether we visited all users of multi-user values,
// and we have to do it at the very end, outside of the recursion.
TYH.allPendingVisited();
@@ -521,15 +521,15 @@ bool TypeEvaluationHelper::canEvaluateTruncated(Value *V, Type *Ty,
bool TypeEvaluationHelper::canEvaluateTruncatedImpl(Value *V, Type *Ty,
InstCombinerImpl &IC,
- Instruction *CxtI) {
- return canEvaluate(V, Ty, [this, &IC, CxtI](Value *V, Type *Ty) {
- return canEvaluateTruncatedPred(V, Ty, IC, CxtI);
+ Instruction *CtxI) {
+ return canEvaluate(V, Ty, [this, &IC, CtxI](Value *V, Type *Ty) {
+ return canEvaluateTruncatedPred(V, Ty, IC, CtxI);
});
}
bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
InstCombinerImpl &IC,
- Instruction *CxtI) {
+ Instruction *CtxI) {
auto *I = cast<Instruction>(V);
Type *OrigTy = V->getType();
switch (I->getOpcode()) {
@@ -540,8 +540,8 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
case Instruction::Or:
case Instruction::Xor:
// These operators can all arbitrarily be extended or truncated.
- return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CtxI);
case Instruction::UDiv:
case Instruction::URem: {
@@ -554,8 +554,8 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
// based on later context may introduce a trap.
if (IC.MaskedValueIsZero(I->getOperand(0), Mask, I) &&
IC.MaskedValueIsZero(I->getOperand(1), Mask, I)) {
- return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CtxI);
}
break;
}
@@ -566,8 +566,8 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
KnownBits AmtKnownBits =
llvm::computeKnownBits(I->getOperand(1), IC.getDataLayout());
if (AmtKnownBits.getMaxValue().ult(BitWidth))
- return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CtxI);
break;
}
case Instruction::LShr: {
@@ -578,7 +578,7 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
// zero - use AmtKnownBits.getMaxValue().
uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();
uint32_t BitWidth = Ty->getScalarSizeInBits();
- KnownBits AmtKnownBits = IC.computeKnownBits(I->getOperand(1), CxtI);
+ KnownBits AmtKnownBits = IC.computeKnownBits(I->getOperand(1), CtxI);
APInt MaxShiftAmt = AmtKnownBits.getMaxValue();
APInt ShiftedBits = APInt::getBitsSetFrom(OrigBitWidth, BitWidth);
if (MaxShiftAmt.ult(BitWidth)) {
@@ -587,12 +587,12 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
if (auto *Trunc = dyn_cast<TruncInst>(V->user_back())) {
auto DemandedBits = Trunc->getType()->getScalarSizeInBits();
if ((MaxShiftAmt + DemandedBits).ule(BitWidth))
- return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CtxI);
}
- if (IC.MaskedValueIsZero(I->getOperand(0), ShiftedBits, CxtI))
- return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CxtI);
+ if (IC.MaskedValueIsZero(I->getOperand(0), ShiftedBits, CtxI))
+ return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CtxI);
}
break;
}
@@ -608,9 +608,9 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
llvm::computeKnownBits(I->getOperand(1), IC.getDataLayout());
unsigned ShiftedBits = OrigBitWidth - BitWidth;
if (AmtKnownBits.getMaxValue().ult(BitWidth) &&
- ShiftedBits < IC.ComputeNumSignBits(I->getOperand(0), CxtI))
- return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CxtI);
+ ShiftedBits < IC.ComputeNumSignBits(I->getOperand(0), CtxI))
+ return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CtxI);
break;
}
case Instruction::Trunc:
@@ -623,8 +623,8 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
return true;
case Instruction::Select: {
SelectInst *SI = cast<SelectInst>(I);
- return canEvaluateTruncatedImpl(SI->getTrueValue(), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(SI->getFalseValue(), Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(SI->getTrueValue(), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(SI->getFalseValue(), Ty, IC, CtxI);
}
case Instruction::PHI: {
// We can change a phi if we can change all operands. Note that we never
@@ -632,8 +632,8 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
// chain loops.
PHINode *PN = cast<PHINode>(I);
return llvm::all_of(
- PN->incoming_values(), [this, Ty, &IC, CxtI](Value *IncValue) {
- return canEvaluateTruncatedImpl(IncValue, Ty, IC, CxtI);
+ PN->incoming_values(), [this, Ty, &IC, CtxI](Value *IncValue) {
+ return canEvaluateTruncatedImpl(IncValue, Ty, IC, CtxI);
});
}
case Instruction::FPToUI:
@@ -648,15 +648,15 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
return Ty->getScalarSizeInBits() >= MinBitWidth;
}
case Instruction::ShuffleVector:
- return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(I->getOperand(0), Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(I->getOperand(1), Ty, IC, CtxI);
case Instruction::Call: {
Value *AbsOp;
if (match(I, m_Intrinsic<Intrinsic::abs>(m_Value(AbsOp), m_Value()))) {
- if (IC.ComputeMaxSignificantBits(AbsOp, CxtI) > Ty->getScalarSizeInBits())
+ if (IC.ComputeMaxSignificantBits(AbsOp, CtxI) > Ty->getScalarSizeInBits())
return false;
- return canEvaluateTruncatedImpl(AbsOp, Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(AbsOp, Ty, IC, CtxI);
}
auto *MM = dyn_cast<MinMaxIntrinsic>(I);
if (!MM)
@@ -667,18 +667,18 @@ bool TypeEvaluationHelper::canEvaluateTruncatedPred(Value *V, Type *Ty,
Value *Op1 = MM->getRHS();
uint32_t BitWidth = Ty->getScalarSizeInBits();
if (MM->isSigned()) {
- if (IC.ComputeMaxSignificantBits(Op0, CxtI) > BitWidth ||
- IC.ComputeMaxSignificantBits(Op1, CxtI) > BitWidth)
+ if (IC.ComputeMaxSignificantBits(Op0, CtxI) > BitWidth ||
+ IC.ComputeMaxSignificantBits(Op1, CtxI) > BitWidth)
break;
} else {
APInt Mask =
APInt::getBitsSetFrom(OrigTy->getScalarSizeInBits(), BitWidth);
- if (!IC.MaskedValueIsZero(Op0, Mask, CxtI) ||
- !IC.MaskedValueIsZero(Op1, Mask, CxtI))
+ if (!IC.MaskedValueIsZero(Op0, Mask, CtxI) ||
+ !IC.MaskedValueIsZero(Op1, Mask, CtxI))
break;
}
- return canEvaluateTruncatedImpl(Op0, Ty, IC, CxtI) &&
- canEvaluateTruncatedImpl(Op1, Ty, IC, CxtI);
+ return canEvaluateTruncatedImpl(Op0, Ty, IC, CtxI) &&
+ canEvaluateTruncatedImpl(Op1, Ty, IC, CtxI);
}
default:
// TODO: Can handle more cases here.
@@ -1469,14 +1469,14 @@ Instruction *InstCombinerImpl::transformZExtICmp(ICmpInst *Cmp,
bool TypeEvaluationHelper::canEvaluateZExtd(Value *V, Type *Ty,
unsigned &BitsToClear,
InstCombinerImpl &IC,
- Instruction *CxtI) {
+ Instruction *CtxI) {
TypeEvaluationHelper TYH;
- return TYH.canEvaluateZExtdImpl(V, Ty, BitsToClear, IC, CxtI);
+ return TYH.canEvaluateZExtdImpl(V, Ty, BitsToClear, IC, CtxI);
}
bool TypeEvaluationHelper::canEvaluateZExtdImpl(Value *V, Type *Ty,
unsigned &BitsToClear,
InstCombinerImpl &IC,
- Instruction *CxtI) {
+ Instruction *CtxI) {
BitsToClear = 0;
if (canAlwaysEvaluateInType(V, Ty))
return true;
@@ -1498,8 +1498,8 @@ bool TypeEvaluationHelper::canEvaluateZExtdImpl(Value *V, Type *Ty,
case Instruction::Add:
case Instruction::Sub:
case Instruction::Mul:
- if (!canEvaluateZExtdImpl(I->getOperand(0), Ty, BitsToClear, IC, CxtI) ||
- !canEvaluateZExtdImpl(I->getOperand(1), Ty, Tmp, IC, CxtI))
+ if (!canEvaluateZExtdImpl(I->getOperand(0), Ty, BitsToClear, IC, CtxI) ||
+ !canEvaluateZExtdImpl(I->getOperand(1), Ty, Tmp, IC, CtxI))
return false;
// These can all be promoted if neither operand has 'bits to clear'.
if (BitsToClear == 0 && Tmp == 0)
@@ -1513,7 +1513,7 @@ bool TypeEvaluationHelper::canEvaluateZExtdImpl(Value *V, Type *Ty,
unsigned VSize = V->getType()->getScalarSizeInBits();
if (IC.MaskedValueIsZero(I->getOperand(1),
APInt::getHighBitsSet(VSize, BitsToClear),
- CxtI)) {
+ CtxI)) {
// If this is an And instruction and all of the BitsToClear are
// known to be zero we can reset BitsToClear.
if (I->getOpcode() == Instruction::And)
@@ -1530,7 +1530,7 @@ bool TypeEvaluationHelper::canEvaluateZExtdImpl(Value *V, Type *Ty,
// upper bits we can reduce BitsToClear by the shift amount.
uint64_t ShiftAmt;
if (match(I->getOperand(1), m_ConstantInt(ShiftAmt))) {
- if (!canEvaluateZExtdImpl(I->getOperand(0), Ty, BitsToClear, IC, CxtI))
+ if (!canEvaluateZExtdImpl(I->getOperand(0), Ty, BitsToClear, IC, CtxI))
return false;
BitsToClear = ShiftAmt < BitsToClear ? BitsToClear - ShiftAmt : 0;
return true;
@@ -1542,7 +1542,7 @@ bool TypeEvaluationHelper::canEvaluateZExtdImpl(Value *V, Type *Ty,
// ultimate 'and' to clear out the high zero bits we're clearing out though.
uint64_t ShiftAmt;
if (match(I->getOperand(1), m_ConstantInt(ShiftAmt))) {
- if (!canEvaluateZExtdImpl(I->getOperand(0), Ty, BitsToClear, IC, CxtI))
+ if (!canEvaluateZExtdImpl(I->getOperand(0), Ty, BitsToClear, IC, CtxI))
return false;
BitsToClear += ShiftAmt;
if (BitsToClear > V->getType()->getScalarSizeInBits())
@@ -1553,8 +1553,8 @@ bool TypeEvaluationHelper::canEvaluateZExtdImpl(Value *V, Type *Ty,
return false;
}
case Instruction::Select:
- if (!canEvaluateZExtdImpl(I->getOperand(1), Ty, Tmp, IC, CxtI) ||
- !canEvaluateZExtdImpl(I->getOperand(2), Ty, BitsToClear, IC, CxtI) ||
+ if (!canEvaluateZExtdImpl(I->getOperand(1), Ty, Tmp, IC, CtxI) ||
+ !canEvaluateZExtdImpl(I->getOperand(2), Ty, BitsToClear, IC, CtxI) ||
// TODO: If important, we could handle the case when the BitsToClear are
// known zero in the disagreeing side.
Tmp != BitsToClear)
@@ -1567,10 +1567,10 @@ bool TypeEvaluationHelper::canEvaluateZExtdImpl(Value *V, Type *Ty,
// instructions with a single use.
PHINode *PN = cast<PHINode>(I);
if (!canEvaluateZExtdImpl(PN->getIncomingValue(0), Ty, BitsToClear, IC,
- CxtI))
+ CtxI))
return false;
for (unsigned i = 1, e = PN->getNumIncomingValues(); i != e; ++i)
- if (!canEvaluateZExtdImpl(PN->getIncomingValue(i), Ty, Tmp, IC, CxtI) ||
+ if (!canEvaluateZExtdImpl(PN->getIncomingValue(i), Ty, Tmp, IC, CtxI) ||
// TODO: If important, we could handle the case when the BitsToClear
// are known zero in the disagreeing input.
Tmp != BitsToClear)
@@ -2195,7 +2195,7 @@ static Type *getMinimumFPType(Value *V, Type *PreferredTy, InstCombiner &IC) {
bool InstCombiner::canBeCastedExactlyIntToFP(Value *V, Type *FPTy,
bool IsSigned,
- const Instruction *CxtI) const {
+ const Instruction *CtxI) const {
Type *SrcTy = V->getType();
assert(SrcTy->isIntOrIntVectorTy() && "Expected an integer type");
int SrcSize = (int)SrcTy->getScalarSizeInBits() - IsSigned;
@@ -2226,7 +2226,7 @@ bool InstCombiner::canBeCastedExactlyIntToFP(Value *V, Type *FPTy,
// Try harder to find if the source integer type has less significant bits.
// Compute number of sign bits or determine trailing zeros.
- KnownBits SrcKnown = computeKnownBits(V, CxtI);
+ KnownBits SrcKnown = computeKnownBits(V, CtxI);
int SigBits = (int)SrcTy->getScalarSizeInBits() -
SrcKnown.countMinLeadingZeros() -
SrcKnown.countMinTrailingZeros();
@@ -2236,7 +2236,7 @@ bool InstCombiner::canBeCastedExactlyIntToFP(Value *V, Type *FPTy,
// For sitofp, the sign maps to the FP sign bit, so only magnitude bits
// (BitWidth - NumSignBits) consume mantissa.
if (IsSigned) {
- SigBits = (int)SrcTy->getScalarSizeInBits() - ComputeNumSignBits(V, CxtI);
+ SigBits = (int)SrcTy->getScalarSizeInBits() - ComputeNumSignBits(V, CtxI);
if (SigBits <= DestNumSigBits)
return true;
}
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index e15708ce31b176..717cb652391890 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -3909,7 +3909,7 @@ static Instruction *foldCtpopPow2Test(ICmpInst &I, IntrinsicInst *CtpopLhs,
if (((I.isEquality() || Pred == ICmpInst::ICMP_UGT) && CRhs == 1) ||
(Pred == ICmpInst::ICMP_ULT && CRhs == 2)) {
Value *Op = CtpopLhs->getArgOperand(0);
- KnownBits OpKnown = computeKnownBits(Op, Q.DL, Q.AC, Q.CxtI, Q.DT);
+ KnownBits OpKnown = computeKnownBits(Op, Q.DL, Q.AC, Q.CtxI, Q.DT);
// No need to check for count > 1, that should be already constant folded.
if (OpKnown.countMinPopulation() == 1) {
Value *And = Builder.CreateAnd(
@@ -4613,13 +4613,13 @@ static bool isMaskOrZero(const Value *V, bool Not, const SimplifyQuery &Q,
// Pow2 - 1 is a Mask.
if (!Not && match(I->getOperand(1), m_AllOnes()))
return isKnownToBeAPowerOfTwo(I->getOperand(0), Q.DL, /*OrZero*/ true,
- Q.AC, Q.CxtI, Q.DT, Depth);
+ Q.AC, Q.CtxI, Q.DT, Depth);
break;
case Instruction::Sub:
// -Pow2 is a ~Mask.
if (Not && match(I->getOperand(0), m_Zero()))
return isKnownToBeAPowerOfTwo(I->getOperand(1), Q.DL, /*OrZero*/ true,
- Q.AC, Q.CxtI, Q.DT, Depth);
+ Q.AC, Q.CtxI, Q.DT, Depth);
break;
case Instruction::Call: {
if (auto *II = dyn_cast<IntrinsicInst>(I)) {
@@ -6718,25 +6718,25 @@ static bool isNeutralValue(Instruction::BinaryOps BinaryOp, Value *RHS,
OverflowResult
InstCombinerImpl::computeOverflow(Instruction::BinaryOps BinaryOp,
bool IsSigned, Value *LHS, Value *RHS,
- Instruction *CxtI) const {
+ Instruction *CtxI) const {
switch (BinaryOp) {
default:
llvm_unreachable("Unsupported binary op");
case Instruction::Add:
if (IsSigned)
- return computeOverflowForSignedAdd(LHS, RHS, CxtI);
+ return computeOverflowForSignedAdd(LHS, RHS, CtxI);
else
- return computeOverflowForUnsignedAdd(LHS, RHS, CxtI);
+ return computeOverflowForUnsignedAdd(LHS, RHS, CtxI);
case Instruction::Sub:
if (IsSigned)
- return computeOverflowForSignedSub(LHS, RHS, CxtI);
+ return computeOverflowForSignedSub(LHS, RHS, CtxI);
else
- return computeOverflowForUnsignedSub(LHS, RHS, CxtI);
+ return computeOverflowForUnsignedSub(LHS, RHS, CtxI);
case Instruction::Mul:
if (IsSigned)
- return computeOverflowForSignedMul(LHS, RHS, CxtI);
+ return computeOverflowForSignedMul(LHS, RHS, CtxI);
else
- return computeOverflowForUnsignedMul(LHS, RHS, CxtI);
+ return computeOverflowForUnsignedMul(LHS, RHS, CtxI);
}
}
@@ -7796,21 +7796,21 @@ static Instruction *foldReductionIdiom(ICmpInst &I,
// This helper will be called with icmp operands in both orders.
Instruction *InstCombinerImpl::foldICmpCommutative(CmpPredicate Pred,
Value *Op0, Value *Op1,
- ICmpInst &CxtI) {
+ ICmpInst &CtxI) {
// Try to optimize 'icmp GEP, P' or 'icmp P, GEP'.
if (auto *GEP = dyn_cast<GEPOperator>(Op0))
- if (Instruction *NI = foldGEPICmp(GEP, Op1, Pred, CxtI))
+ if (Instruction *NI = foldGEPICmp(GEP, Op1, Pred, CtxI))
return NI;
if (auto *SI = dyn_cast<SelectInst>(Op0))
- if (Instruction *NI = foldSelectICmp(Pred, SI, Op1, CxtI))
+ if (Instruction *NI = foldSelectICmp(Pred, SI, Op1, CtxI))
return NI;
if (auto *MinMax = dyn_cast<MinMaxIntrinsic>(Op0)) {
- if (Instruction *Res = foldICmpWithMinMax(CxtI, MinMax, Op1, Pred))
+ if (Instruction *Res = foldICmpWithMinMax(CtxI, MinMax, Op1, Pred))
return Res;
- if (Instruction *Res = foldICmpWithClamp(CxtI, Op1, MinMax))
+ if (Instruction *Res = foldICmpWithClamp(CtxI, Op1, MinMax))
return Res;
}
@@ -7845,15 +7845,15 @@ Instruction *InstCombinerImpl::foldICmpCommutative(CmpPredicate Pred,
switch (Pred) {
case CmpInst::ICMP_ULE:
case CmpInst::ICMP_SGE:
- return replaceInstUsesWith(CxtI, ConstantInt::getTrue(CxtI.getType()));
+ return replaceInstUsesWith(CtxI, ConstantInt::getTrue(CtxI.getType()));
case CmpInst::ICMP_UGT:
case CmpInst::ICMP_SLT:
- return replaceInstUsesWith(CxtI, ConstantInt::getFalse(CxtI.getType()));
+ return replaceInstUsesWith(CtxI, ConstantInt::getFalse(CtxI.getType()));
case CmpInst::ICMP_UGE:
case CmpInst::ICMP_SLE:
case CmpInst::ICMP_EQ: {
return replaceInstUsesWith(
- CxtI, IsIntMinPosion
+ CtxI, IsIntMinPosion
? Builder.CreateICmpSGT(X, AllOnesValue)
: Builder.CreateICmpULT(
X, ConstantInt::get(X->getType(), SMin + 1)));
@@ -7862,7 +7862,7 @@ Instruction *InstCombinerImpl::foldICmpCommutative(CmpPredicate Pred,
case CmpInst::ICMP_SGT:
case CmpInst::ICMP_NE: {
return replaceInstUsesWith(
- CxtI, IsIntMinPosion
+ CtxI, IsIntMinPosion
? Builder.CreateICmpSLT(X, NullValue)
: Builder.CreateICmpUGT(
X, ConstantInt::get(X->getType(), SMin)));
@@ -7873,9 +7873,9 @@ Instruction *InstCombinerImpl::foldICmpCommutative(CmpPredicate Pred,
}
}
- const SimplifyQuery Q = SQ.getWithInstruction(&CxtI);
+ const SimplifyQuery Q = SQ.getWithInstruction(&CtxI);
if (Value *V = foldICmpWithLowBitMaskedVal(Pred, Op0, Op1, Q, *this))
- return replaceInstUsesWith(CxtI, V);
+ return replaceInstUsesWith(CtxI, V);
// Folding (X / Y) pred X => X swap(pred) 0 for constant Y other than 0 or 1
auto CheckUGT1 = [](const APInt &Divisor) { return Divisor.ugt(1); };
@@ -7913,11 +7913,11 @@ Instruction *InstCombinerImpl::foldICmpCommutative(CmpPredicate Pred,
Value *X;
uint64_t ShAmt;
if (match(Op0, m_NUWShl(m_Value(X), m_ConstantInt(ShAmt))) &&
- !CxtI.isSigned()) {
+ !CtxI.isSigned()) {
if (ShAmt >= X->getType()->getScalarSizeInBits())
return nullptr;
if (canEvaluateShifted(Op1, ShAmt, /*IsLeftShift=*/false,
- ShiftSemantics::Unsigned, &CxtI)) {
+ ShiftSemantics::Unsigned, &CtxI)) {
Value *NewOp1 = getShiftedValue(Op1, ShAmt, /*IsLeftShift=*/false,
ShiftSemantics::Unsigned);
return new ICmpInst(Pred, X, NewOp1);
@@ -7925,11 +7925,11 @@ Instruction *InstCombinerImpl::foldICmpCommutative(CmpPredicate Pred,
}
if (match(Op0, m_NSWShl(m_Value(X), m_ConstantInt(ShAmt))) &&
- !CxtI.isUnsigned()) {
+ !CtxI.isUnsigned()) {
if (ShAmt >= X->getType()->getScalarSizeInBits())
return nullptr;
if (canEvaluateShifted(Op1, ShAmt, /*IsLeftShift=*/false,
- ShiftSemantics::Signed, &CxtI)) {
+ ShiftSemantics::Signed, &CtxI)) {
Value *NewOp1 = getShiftedValue(Op1, ShAmt, /*IsLeftShift=*/false,
ShiftSemantics::Signed);
return new ICmpInst(Pred, X, NewOp1);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index f2549bad3a8523..6e6c8c83e1eed6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -121,7 +121,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
Instruction *visitFDiv(BinaryOperator &I);
Value *simplifyRangeCheck(CmpPredicate PredL, Value *LHS0, Value *LHS1,
CmpPredicate PredR, Value *RHS0, Value *RHS1,
- Instruction *CxtI, bool Inverted);
+ Instruction *CtxI, bool Inverted);
Instruction *FoldOrOfLogicalAnds(Value *Op0, Value *Op1);
Instruction *visitAnd(BinaryOperator &I);
Instruction *visitOr(BinaryOperator &I);
@@ -305,68 +305,68 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
bool willNotOverflowSignedAdd(const WithCache<const Value *> &LHS,
const WithCache<const Value *> &RHS,
- const Instruction &CxtI) const {
- return computeOverflowForSignedAdd(LHS, RHS, &CxtI) ==
+ const Instruction &CtxI) const {
+ return computeOverflowForSignedAdd(LHS, RHS, &CtxI) ==
OverflowResult::NeverOverflows;
}
bool willNotOverflowUnsignedAdd(const WithCache<const Value *> &LHS,
const WithCache<const Value *> &RHS,
- const Instruction &CxtI) const {
- return computeOverflowForUnsignedAdd(LHS, RHS, &CxtI) ==
+ const Instruction &CtxI) const {
+ return computeOverflowForUnsignedAdd(LHS, RHS, &CtxI) ==
OverflowResult::NeverOverflows;
}
bool willNotOverflowAdd(const Value *LHS, const Value *RHS,
- const Instruction &CxtI, bool IsSigned) const {
- return IsSigned ? willNotOverflowSignedAdd(LHS, RHS, CxtI)
- : willNotOverflowUnsignedAdd(LHS, RHS, CxtI);
+ const Instruction &CtxI, bool IsSigned) const {
+ return IsSigned ? willNotOverflowSignedAdd(LHS, RHS, CtxI)
+ : willNotOverflowUnsignedAdd(LHS, RHS, CtxI);
}
bool willNotOverflowSignedSub(const Value *LHS, const Value *RHS,
- const Instruction &CxtI) const {
- return computeOverflowForSignedSub(LHS, RHS, &CxtI) ==
+ const Instruction &CtxI) const {
+ return computeOverflowForSignedSub(LHS, RHS, &CtxI) ==
OverflowResult::NeverOverflows;
}
bool willNotOverflowUnsignedSub(const Value *LHS, const Value *RHS,
- const Instruction &CxtI) const {
- return computeOverflowForUnsignedSub(LHS, RHS, &CxtI) ==
+ const Instruction &CtxI) const {
+ return computeOverflowForUnsignedSub(LHS, RHS, &CtxI) ==
OverflowResult::NeverOverflows;
}
bool willNotOverflowSub(const Value *LHS, const Value *RHS,
- const Instruction &CxtI, bool IsSigned) const {
- return IsSigned ? willNotOverflowSignedSub(LHS, RHS, CxtI)
- : willNotOverflowUnsignedSub(LHS, RHS, CxtI);
+ const Instruction &CtxI, bool IsSigned) const {
+ return IsSigned ? willNotOverflowSignedSub(LHS, RHS, CtxI)
+ : willNotOverflowUnsignedSub(LHS, RHS, CtxI);
}
bool willNotOverflowSignedMul(const Value *LHS, const Value *RHS,
- const Instruction &CxtI) const {
- return computeOverflowForSignedMul(LHS, RHS, &CxtI) ==
+ const Instruction &CtxI) const {
+ return computeOverflowForSignedMul(LHS, RHS, &CtxI) ==
OverflowResult::NeverOverflows;
}
bool willNotOverflowUnsignedMul(const Value *LHS, const Value *RHS,
- const Instruction &CxtI,
+ const Instruction &CtxI,
bool IsNSW = false) const {
- return computeOverflowForUnsignedMul(LHS, RHS, &CxtI, IsNSW) ==
+ return computeOverflowForUnsignedMul(LHS, RHS, &CtxI, IsNSW) ==
OverflowResult::NeverOverflows;
}
bool willNotOverflowMul(const Value *LHS, const Value *RHS,
- const Instruction &CxtI, bool IsSigned) const {
- return IsSigned ? willNotOverflowSignedMul(LHS, RHS, CxtI)
- : willNotOverflowUnsignedMul(LHS, RHS, CxtI);
+ const Instruction &CtxI, bool IsSigned) const {
+ return IsSigned ? willNotOverflowSignedMul(LHS, RHS, CtxI)
+ : willNotOverflowUnsignedMul(LHS, RHS, CtxI);
}
bool willNotOverflow(BinaryOperator::BinaryOps Opcode, const Value *LHS,
- const Value *RHS, const Instruction &CxtI,
+ const Value *RHS, const Instruction &CtxI,
bool IsSigned) const {
switch (Opcode) {
- case Instruction::Add: return willNotOverflowAdd(LHS, RHS, CxtI, IsSigned);
- case Instruction::Sub: return willNotOverflowSub(LHS, RHS, CxtI, IsSigned);
- case Instruction::Mul: return willNotOverflowMul(LHS, RHS, CxtI, IsSigned);
+ case Instruction::Add: return willNotOverflowAdd(LHS, RHS, CtxI, IsSigned);
+ case Instruction::Sub: return willNotOverflowSub(LHS, RHS, CtxI, IsSigned);
+ case Instruction::Mul: return willNotOverflowMul(LHS, RHS, CtxI, IsSigned);
default: llvm_unreachable("Unexpected opcode for overflow query");
}
}
@@ -446,7 +446,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
Value *getSelectCondition(Value *A, Value *B, bool ABIsTheSame);
bool canEvaluateShifted(Value *V, unsigned NumBits, bool IsLeftShift,
- ShiftSemantics Semantics, Instruction *CxtI);
+ ShiftSemantics Semantics, Instruction *CtxI);
Value *getShiftedValue(Value *V, unsigned NumBits, bool IsLeftShift,
ShiftSemantics Semantics);
@@ -520,7 +520,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
OverflowResult computeOverflow(
Instruction::BinaryOps BinaryOp, bool IsSigned,
- Value *LHS, Value *RHS, Instruction *CxtI) const;
+ Value *LHS, Value *RHS, Instruction *CtxI) const;
/// Performs a few simplifications for operators which are associative
/// or commutative.
@@ -809,7 +809,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
Instruction *foldICmpBitCast(ICmpInst &Cmp);
Instruction *foldICmpWithTrunc(ICmpInst &Cmp);
Instruction *foldICmpCommutative(CmpPredicate Pred, Value *Op0, Value *Op1,
- ICmpInst &CxtI);
+ ICmpInst &CtxI);
// Helpers of visitSelectInst().
Instruction *foldSelectOfBools(SelectInst &SI);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index da0254cbb196e1..16a7b98666d743 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -45,7 +45,7 @@ using namespace PatternMatch;
/// non-zero. If this allows us to simplify the computation, do so and return
/// the new operand, otherwise return null.
static Value *simplifyValueKnownNonZero(Value *V, InstCombinerImpl &IC,
- Instruction &CxtI) {
+ Instruction &CtxI) {
// If V has multiple uses, then we would have to do more analysis to determine
// if this is safe. For example, the use could be in dynamically unreached
// code.
@@ -66,13 +66,13 @@ static Value *simplifyValueKnownNonZero(Value *V, InstCombinerImpl &IC,
// inexact. Similarly for <<.
BinaryOperator *I = dyn_cast<BinaryOperator>(V);
if (I && I->isLogicalShift() &&
- IC.isKnownToBeAPowerOfTwo(I->getOperand(0), false, &CxtI)) {
+ IC.isKnownToBeAPowerOfTwo(I->getOperand(0), false, &CtxI)) {
// We know that this is an exact/nuw shift and that the input is a
// non-zero context as well.
{
IRBuilderBase::InsertPointGuard Guard(IC.Builder);
IC.Builder.SetInsertPoint(I);
- if (Value *V2 = simplifyValueKnownNonZero(I->getOperand(0), IC, CxtI)) {
+ if (Value *V2 = simplifyValueKnownNonZero(I->getOperand(0), IC, CtxI)) {
IC.replaceOperand(*I, 0, V2);
MadeChange = true;
}
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index a4061bbd607707..e4d95eb2beb19b 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -673,7 +673,7 @@ static Value *canoncalizeSelectICmpMinMax(const ICmpInst *Cmp, Value *TVal,
// (X >= Y) ? (X - Y) : 0
if ((Pred == CmpInst::ICMP_SLT || Pred == CmpInst::ICMP_SLE) &&
match(FVal, m_NSWSub(m_Specific(CmpLHS), m_Specific(CmpRHS))) &&
- isGuaranteedNotToBeUndef(CmpLHS, SQ.AC, SQ.CxtI, SQ.DT)) {
+ isGuaranteedNotToBeUndef(CmpLHS, SQ.AC, SQ.CtxI, SQ.DT)) {
Value *SMin =
Builder.CreateBinaryIntrinsic(Intrinsic::smin, CmpRHS, CmpLHS);
return Builder.CreateNSWSub(CmpLHS, SMin);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 7e32abcd6e9ba5..97964cebb50b8a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -575,7 +575,7 @@ Instruction *InstCombinerImpl::commonShiftTransforms(BinaryOperator &I) {
static bool canEvaluateShiftedShift(unsigned OuterShAmt, bool IsOuterShl,
ShiftSemantics Semantics,
Instruction *InnerShift,
- InstCombinerImpl &IC, Instruction *CxtI) {
+ InstCombinerImpl &IC, Instruction *CtxI) {
assert(InnerShift->isLogicalShift() && "Unexpected instruction type");
// We need constant scalar or constant splat shifts.
@@ -612,7 +612,7 @@ static bool canEvaluateShiftedShift(unsigned OuterShAmt, bool IsOuterShl,
unsigned MaskShift =
IsInnerShl ? TypeWidth - InnerShAmt : InnerShAmt - OuterShAmt;
APInt Mask = APInt::getLowBitsSet(TypeWidth, OuterShAmt) << MaskShift;
- if (IC.MaskedValueIsZero(InnerShift->getOperand(0), Mask, CxtI))
+ if (IC.MaskedValueIsZero(InnerShift->getOperand(0), Mask, CtxI))
return true;
}
@@ -633,7 +633,7 @@ static bool canEvaluateShiftedShift(unsigned OuterShAmt, bool IsOuterShl,
bool InstCombinerImpl::canEvaluateShifted(Value *V, unsigned NumBits,
bool IsLeftShift,
ShiftSemantics Semantics,
- Instruction *CxtI) {
+ Instruction *CtxI) {
// We can always evaluate immediate constants shifted left. For right shifts,
// the constant must be a multiple of 2^NumBits to avoid losing information.
if (match(V, m_ImmConstant())) {
@@ -666,7 +666,7 @@ bool InstCombinerImpl::canEvaluateShifted(Value *V, unsigned NumBits,
case Instruction::Shl:
case Instruction::LShr:
return canEvaluateShiftedShift(NumBits, IsLeftShift, Semantics, I, *this,
- CxtI);
+ CtxI);
case Instruction::Select: {
SelectInst *SI = cast<SelectInst>(I);
@@ -1132,7 +1132,7 @@ static bool setShiftFlags(BinaryOperator &I, const SimplifyQuery &Q) {
if (!I.hasNoSignedWrap()) {
if (MaxCnt < KnownAmt.countMinSignBits() ||
MaxCnt <
- ComputeNumSignBits(I.getOperand(0), Q.DL, Q.AC, Q.CxtI, Q.DT)) {
+ ComputeNumSignBits(I.getOperand(0), Q.DL, Q.AC, Q.CtxI, Q.DT)) {
I.setHasNoSignedWrap();
Changed = true;
}
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 7d35907e96bea6..bcd30323ce9a3c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -751,7 +751,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Instruction *I,
if (I->hasNoSignedWrap()) {
unsigned NumHiDemandedBits = BitWidth - DemandedMask.countr_zero();
unsigned SignBits =
- ComputeNumSignBits(I->getOperand(0), Q.CxtI, Depth + 1);
+ ComputeNumSignBits(I->getOperand(0), Q.CtxI, Depth + 1);
if (SignBits > ShiftAmt && SignBits - ShiftAmt >= NumHiDemandedBits)
return I->getOperand(0);
}
@@ -833,7 +833,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Instruction *I,
// need to shift.
unsigned NumHiDemandedBits = BitWidth - DemandedMask.countr_zero();
unsigned SignBits =
- ComputeNumSignBits(I->getOperand(0), Q.CxtI, Depth + 1);
+ ComputeNumSignBits(I->getOperand(0), Q.CtxI, Depth + 1);
if (SignBits >= NumHiDemandedBits)
return I->getOperand(0);
@@ -884,7 +884,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Instruction *I,
break;
}
case Instruction::AShr: {
- unsigned SignBits = ComputeNumSignBits(I->getOperand(0), Q.CxtI, Depth + 1);
+ unsigned SignBits = ComputeNumSignBits(I->getOperand(0), Q.CtxI, Depth + 1);
// If we only want bits that already match the signbit then we don't need
// to shift.
@@ -2462,7 +2462,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
// fadd x, x can be handled more aggressively.
if (I->getOperand(0) == I->getOperand(1) &&
I->getOpcode() == Instruction::FAdd &&
- isGuaranteedNotToBeUndef(I->getOperand(0), SQ.AC, SQ.CxtI, SQ.DT,
+ isGuaranteedNotToBeUndef(I->getOperand(0), SQ.AC, SQ.CtxI, SQ.DT,
Depth + 1)) {
Type *EltTy = VTy->getScalarType();
DenormalMode Mode = F.getDenormalMode(EltTy->getFltSemantics());
@@ -2588,7 +2588,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
SrcDemandedMask |= fcNormal | fcSubnormal;
if (X == Y &&
- isGuaranteedNotToBeUndef(X, SQ.AC, SQ.CxtI, SQ.DT, Depth + 1)) {
+ isGuaranteedNotToBeUndef(X, SQ.AC, SQ.CtxI, SQ.DT, Depth + 1)) {
if (SimplifyDemandedFPClass(I, 0, SrcDemandedMask, KnownLHS, SQ,
Depth + 1))
return I;
@@ -2733,7 +2733,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
Value *X = I->getOperand(0);
Value *Y = I->getOperand(1);
if (X == Y &&
- isGuaranteedNotToBeUndef(X, SQ.AC, SQ.CxtI, SQ.DT, Depth + 1)) {
+ isGuaranteedNotToBeUndef(X, SQ.AC, SQ.CtxI, SQ.DT, Depth + 1)) {
// If the source is 0, inf or nan, the result is a nan
IRBuilderBase::InsertPointGuard Guard(Builder);
Builder.SetInsertPoint(I);
@@ -2982,7 +2982,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
Type *EltTy = VTy->getScalarType();
if (CI->getArgOperand(0) == CI->getArgOperand(1) &&
- isGuaranteedNotToBeUndef(CI->getArgOperand(0), SQ.AC, SQ.CxtI, SQ.DT,
+ isGuaranteedNotToBeUndef(CI->getArgOperand(0), SQ.AC, SQ.CtxI, SQ.DT,
Depth + 1)) {
if (SimplifyDemandedFPClass(CI, 0, SrcDemandedMask, KnownSrc[0], SQ,
Depth + 1) ||
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index fdb955cde29693..2c983b1dcb7f61 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -206,8 +206,8 @@ static bool simplifyCommonValuePhi(PHINode *P, LazyValueInfo *LVI,
static Value *getValueOnEdge(LazyValueInfo *LVI, Value *Incoming,
BasicBlock *From, BasicBlock *To,
- Instruction *CxtI) {
- if (Constant *C = LVI->getConstantOnEdge(Incoming, From, To, CxtI))
+ Instruction *CtxI) {
+ if (Constant *C = LVI->getConstantOnEdge(Incoming, From, To, CtxI))
return C;
// Look if the incoming value is a select with a scalar condition for which
@@ -222,7 +222,7 @@ static Value *getValueOnEdge(LazyValueInfo *LVI, Value *Incoming,
// for vector type constants that are not all zeroes or all ones.
Value *Condition = SI->getCondition();
if (!Condition->getType()->isVectorTy()) {
- if (Constant *C = LVI->getConstantOnEdge(Condition, From, To, CxtI)) {
+ if (Constant *C = LVI->getConstantOnEdge(Condition, From, To, CtxI)) {
if (C->isOneValue())
return SI->getTrueValue();
if (C->isNullValue())
@@ -238,7 +238,7 @@ static Value *getValueOnEdge(LazyValueInfo *LVI, Value *Incoming,
// The "false" case
if (auto *C = dyn_cast<Constant>(SI->getFalseValue()))
if (auto *Res = dyn_cast_or_null<ConstantInt>(
- LVI->getPredicateOnEdge(ICmpInst::ICMP_EQ, SI, C, From, To, CxtI));
+ LVI->getPredicateOnEdge(ICmpInst::ICMP_EQ, SI, C, From, To, CtxI));
Res && Res->isZero())
return SI->getTrueValue();
@@ -246,7 +246,7 @@ static Value *getValueOnEdge(LazyValueInfo *LVI, Value *Incoming,
// similar to the select "false" case, but try the select "true" value
if (auto *C = dyn_cast<Constant>(SI->getTrueValue()))
if (auto *Res = dyn_cast_or_null<ConstantInt>(
- LVI->getPredicateOnEdge(ICmpInst::ICMP_EQ, SI, C, From, To, CxtI));
+ LVI->getPredicateOnEdge(ICmpInst::ICMP_EQ, SI, C, From, To, CtxI));
Res && Res->isZero())
return SI->getFalseValue();
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 37315fbd49d3a9..573e1e028bd925 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -558,7 +558,7 @@ static Constant *getKnownConstant(Value *Val, ConstantPreference Preference) {
bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
Value *V, BasicBlock *BB, PredValueInfo &Result,
ConstantPreference Preference, SmallPtrSet<Value *, 4> &RecursionSet,
- Instruction *CxtI) {
+ Instruction *CtxI) {
const DataLayout &DL = BB->getDataLayout();
// This method walks up use-def chains recursively. Because of this, we could
@@ -587,7 +587,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
using namespace PatternMatch;
// If the value is known by LazyValueInfo to be a constant in a
// predecessor, use that information to try to thread this block.
- Constant *PredCst = LVI->getConstantOnEdge(V, P, BB, CxtI);
+ Constant *PredCst = LVI->getConstantOnEdge(V, P, BB, CtxI);
// If I is a non-local compare-with-constant instruction, use more-rich
// 'getPredicateOnEdge' method. This would be able to handle value
// inequalities better, for example if the compare is "X < 4" and "X < 3"
@@ -596,7 +596,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
Value *Val;
Constant *Cst;
if (!PredCst && match(V, m_Cmp(Pred, m_Value(Val), m_Constant(Cst))))
- PredCst = LVI->getPredicateOnEdge(Pred, Val, Cst, P, BB, CxtI);
+ PredCst = LVI->getPredicateOnEdge(Pred, Val, Cst, P, BB, CtxI);
if (Constant *KC = getKnownConstant(PredCst, Preference))
Result.emplace_back(KC, P);
}
@@ -613,7 +613,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
} else {
Constant *CI = LVI->getConstantOnEdge(InVal,
PN->getIncomingBlock(i),
- BB, CxtI);
+ BB, CtxI);
if (Constant *KC = getKnownConstant(CI, Preference))
Result.emplace_back(KC, PN->getIncomingBlock(i));
}
@@ -627,7 +627,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
Value *Source = CI->getOperand(0);
PredValueInfoTy Vals;
computeValueKnownInPredecessorsImpl(Source, BB, Vals, Preference,
- RecursionSet, CxtI);
+ RecursionSet, CtxI);
if (Vals.empty())
return false;
@@ -643,7 +643,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
if (FreezeInst *FI = dyn_cast<FreezeInst>(I)) {
Value *Source = FI->getOperand(0);
computeValueKnownInPredecessorsImpl(Source, BB, Result, Preference,
- RecursionSet, CxtI);
+ RecursionSet, CtxI);
erase_if(Result, [](auto &Pair) {
return !isGuaranteedNotToBeUndefOrPoison(Pair.first);
@@ -665,9 +665,9 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
PredValueInfoTy LHSVals, RHSVals;
computeValueKnownInPredecessorsImpl(Op0, BB, LHSVals, WantInteger,
- RecursionSet, CxtI);
+ RecursionSet, CtxI);
computeValueKnownInPredecessorsImpl(Op1, BB, RHSVals, WantInteger,
- RecursionSet, CxtI);
+ RecursionSet, CtxI);
if (LHSVals.empty() && RHSVals.empty())
return false;
@@ -703,7 +703,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
isa<ConstantInt>(I->getOperand(1)) &&
cast<ConstantInt>(I->getOperand(1))->isOne()) {
computeValueKnownInPredecessorsImpl(I->getOperand(0), BB, Result,
- WantInteger, RecursionSet, CxtI);
+ WantInteger, RecursionSet, CtxI);
if (Result.empty())
return false;
@@ -721,7 +721,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
if (ConstantInt *CI = dyn_cast<ConstantInt>(BO->getOperand(1))) {
PredValueInfoTy LHSVals;
computeValueKnownInPredecessorsImpl(BO->getOperand(0), BB, LHSVals,
- WantInteger, RecursionSet, CxtI);
+ WantInteger, RecursionSet, CtxI);
// Try to use constant folding to simplify the binary operator.
for (const auto &LHSVal : LHSVals) {
@@ -777,7 +777,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
continue;
Res = LVI->getPredicateOnEdge(Pred, LHS, cast<Constant>(RHS), PredBB,
- BB, CxtI ? CxtI : Cmp);
+ BB, CtxI ? CtxI : Cmp);
}
if (Constant *KC = getKnownConstant(Res, WantInteger))
@@ -798,7 +798,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
// If the value is known by LazyValueInfo to be a constant in a
// predecessor, use that information to try to thread this block.
Constant *Res = LVI->getPredicateOnEdge(Pred, CmpLHS, CmpConst, P, BB,
- CxtI ? CxtI : Cmp);
+ CtxI ? CtxI : Cmp);
if (Constant *KC = getKnownConstant(Res, WantInteger))
Result.emplace_back(KC, P);
}
@@ -823,7 +823,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
// a predecessor, use that information to try to thread this
// block.
ConstantRange CR = LVI->getConstantRangeOnEdge(
- AddLHS, P, BB, CxtI ? CxtI : cast<Instruction>(CmpLHS));
+ AddLHS, P, BB, CtxI ? CtxI : cast<Instruction>(CmpLHS));
// Propagate the range through the addition.
CR = CR.add(AddConst->getValue());
@@ -851,7 +851,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
// and evaluate it statically if we can.
PredValueInfoTy LHSVals;
computeValueKnownInPredecessorsImpl(I->getOperand(0), BB, LHSVals,
- WantInteger, RecursionSet, CxtI);
+ WantInteger, RecursionSet, CtxI);
for (const auto &LHSVal : LHSVals) {
Constant *V = LHSVal.first;
@@ -873,7 +873,7 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
PredValueInfoTy Conds;
if ((TrueVal || FalseVal) &&
computeValueKnownInPredecessorsImpl(SI->getCondition(), BB, Conds,
- WantInteger, RecursionSet, CxtI)) {
+ WantInteger, RecursionSet, CtxI)) {
for (auto &C : Conds) {
Constant *Cond = C.first;
@@ -900,8 +900,8 @@ bool JumpThreadingPass::computeValueKnownInPredecessorsImpl(
}
// If all else fails, see if LVI can figure out a constant value for us.
- assert(CxtI->getParent() == BB && "CxtI should be in BB");
- Constant *CI = LVI->getConstant(V, CxtI);
+ assert(CtxI->getParent() == BB && "CtxI should be in BB");
+ Constant *CI = LVI->getConstant(V, CtxI);
if (Constant *KC = getKnownConstant(CI, Preference)) {
for (BasicBlock *Pred : predecessors(BB))
Result.emplace_back(KC, Pred);
@@ -1571,7 +1571,7 @@ Constant *JumpThreadingPass::evaluateOnPredecessorEdge(
bool JumpThreadingPass::processThreadableEdges(Value *Cond, BasicBlock *BB,
ConstantPreference Preference,
- Instruction *CxtI) {
+ Instruction *CtxI) {
// If threading this would thread across a loop header, don't even try to
// thread the edge.
if (LoopHeaders.count(BB))
@@ -1579,7 +1579,7 @@ bool JumpThreadingPass::processThreadableEdges(Value *Cond, BasicBlock *BB,
PredValueInfoTy PredValues;
if (!computeValueKnownInPredecessors(Cond, BB, PredValues, Preference,
- CxtI)) {
+ CtxI)) {
// We don't have known values in predecessors. See if we can thread through
// BB and its sole predecessor.
return maybethreadThroughTwoBasicBlocks(BB, Cond);
diff --git a/llvm/lib/Transforms/Scalar/MergeICmps.cpp b/llvm/lib/Transforms/Scalar/MergeICmps.cpp
index 6ac3045c6e12f1..2cdfcc1ce69dbd 100644
--- a/llvm/lib/Transforms/Scalar/MergeICmps.cpp
+++ b/llvm/lib/Transforms/Scalar/MergeICmps.cpp
@@ -762,7 +762,7 @@ bool BCECmpChain::isDereferenceable() {
// exception to this is if the entry block performs "other work" and will
// get split. In that case, we need to consider frees prior to the splitting
// point.
- Instruction *CxtI = SplitAt ? SplitAt : &EntryBlock_->front();
+ Instruction *CtxI = SplitAt ? SplitAt : &EntryBlock_->front();
for (const auto &Blocks : MergedBlocks_) {
const BCECmpBlock &LowestBlock = Blocks.front();
@@ -775,7 +775,7 @@ bool BCECmpChain::isDereferenceable() {
SizeInBits += Block.SizeBits();
APInt Size(64, SizeInBits / 8);
- SimplifyQuery SQ(DL, CxtI);
+ SimplifyQuery SQ(DL, CtxI);
if (!isDereferenceablePointer(Lhs, Size, SQ) ||
!isDereferenceablePointer(Rhs, Size, SQ))
return false;
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 8c17e8923187a9..78c632069af742 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1557,13 +1557,13 @@ Align llvm::tryEnforceAlignment(Value *V, Align PrefAlign,
Align llvm::getOrEnforceKnownAlignment(Value *V, MaybeAlign PrefAlign,
const DataLayout &DL,
- const Instruction *CxtI,
+ const Instruction *CtxI,
AssumptionCache *AC,
const DominatorTree *DT) {
assert(V->getType()->isPointerTy() &&
"getOrEnforceKnownAlignment expects a pointer!");
- KnownBits Known = computeKnownBits(V, DL, AC, CxtI, DT);
+ KnownBits Known = computeKnownBits(V, DL, AC, CtxI, DT);
unsigned TrailZ = Known.countMinTrailingZeros();
// Avoid trouble with ridiculously large TrailZ values, such as
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 907aea5a085bce..248963f74adafe 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4301,7 +4301,7 @@ bool llvm::foldBranchToCommonDest(CondBrInst *BI, DomTreeUpdater *DTU,
const unsigned PredCount = Preds.size();
// Speculated instructions will be inserted before the terminator of the
// predecessor. Only handle the simple case of one predecessor.
- const Instruction *CxtI =
+ const Instruction *CtxI =
PredCount == 1 ? Preds[0]->getTerminator() : nullptr;
for (Instruction &I : *BB) {
// Don't check the branch condition comparison itself.
@@ -4314,7 +4314,7 @@ bool llvm::foldBranchToCommonDest(CondBrInst *BI, DomTreeUpdater *DTU,
if (isa<PseudoProbeInst>(I))
continue;
// I must be safe to execute unconditionally.
- if (!isSafeToSpeculativelyExecute(&I, CxtI, AC))
+ if (!isSafeToSpeculativelyExecute(&I, CtxI, AC))
return false;
SawVectorOp |= isVectorOp(I);
@@ -8085,10 +8085,10 @@ static bool simplifySwitchDefaultBranch(SwitchInst *SI, DomTreeUpdater *DTU,
// in the default block, we can make some nice simplifications to the
// switch.
BasicBlock *Default = SI->getDefaultDest();
- const Instruction *CxtI = &*Default->getFirstNonPHIIt();
+ const Instruction *CtxI = &*Default->getFirstNonPHIIt();
const KnownBits Known = computeKnownBits(
SI->getCondition(),
- SimplifyQuery(DL, /*DT=*/nullptr, AC, CxtI).allowEphemerals(true));
+ SimplifyQuery(DL, /*DT=*/nullptr, AC, CtxI).allowEphemerals(true));
if (!Known.isConstant())
return false;
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp
index f1113ac08f49f9..a28198c7044adb 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp
@@ -47,7 +47,7 @@ InstructionCost getShuffleCost(const TargetTransformInfo &TTI,
if (Kind != TTI::SK_PermuteTwoSrc)
return TTI.getShuffleCost(Kind, DstTy, Tp, CostKind, Mask, Index, SubTp,
- Args, /*CxtI=*/nullptr, VIC);
+ Args, /*CtxI=*/nullptr, VIC);
int NumSrcElts = Tp->getElementCount().getKnownMinValue();
int NumSubElts;
if (Mask.size() > 2 && ShuffleVectorInst::isInsertSubvectorMask(
@@ -58,7 +58,7 @@ InstructionCost getShuffleCost(const TargetTransformInfo &TTI,
Mask, Index, Tp);
}
return TTI.getShuffleCost(Kind, DstTy, Tp, CostKind, Mask, Index, SubTp, Args,
- /*CxtI=*/nullptr, VIC);
+ /*CtxI=*/nullptr, VIC);
}
std::pair<InstructionCost, InstructionCost>
@@ -376,7 +376,7 @@ InstructionCost getBitPackCost(const TargetTransformInfo &TTI,
TTI::CastContextHint CCH,
TTI::TargetCostKind CostKind,
const TargetLibraryInfo *TLI,
- const Instruction *CxtI, unsigned &ShiftWidth) {
+ const Instruction *CtxI, unsigned &ShiftWidth) {
unsigned BitWidth = SrcTy->getScalarSizeInBits();
unsigned NumElts = SrcTy->getNumElements();
uint64_t MaxAmt = *max_element(Info.LShrAmts);
@@ -421,7 +421,7 @@ InstructionCost getBitPackCost(const TargetTransformInfo &TTI,
? TargetTransformInfo::SK_PermuteTwoSrc
: TargetTransformInfo::SK_PermuteSingleSrc,
PackTy, FixedVectorType::get(Int8Ty, InBytes), CostKind, Mask,
- /*Index=*/0, /*SubTp=*/nullptr, /*Args=*/{}, CxtI);
+ /*Index=*/0, /*SubTp=*/nullptr, /*Args=*/{}, CtxI);
}
if (W2 != BitWidth && W2 != ZExtSrcWidth)
C += TTI.getCastInstrCost(Instruction::Trunc, ShiftTy, SrcTy, CCH,
@@ -429,7 +429,7 @@ InstructionCost getBitPackCost(const TargetTransformInfo &TTI,
if (Info.needsShift())
C += TTI.getArithmeticInstrCost(Instruction::LShr, ShiftTy, CostKind,
/*Opd1Info=*/{}, ShiftAmtInfo,
- /*Args=*/{}, CxtI, TLI);
+ /*Args=*/{}, CtxI, TLI);
if (C.isValid() && (!NewCost.isValid() || C < NewCost)) {
NewCost = C;
ShiftWidth = W2;
@@ -448,13 +448,13 @@ InstructionCost getBoolBitmaskCost(const TargetTransformInfo &TTI,
auto *MaskTy = IntegerType::get(WideTy->getContext(), VF);
// The result cast inherits the uses of the reduction root.
TTI::CastContextHint CCH = getBoolReduxResultCCH(Root);
- const auto *CxtI = cast<Instruction>(Root);
+ const auto *CtxI = cast<Instruction>(Root);
InstructionCost Cost = 0;
if (NeedMask)
Cost += TTI.getArithmeticInstrCost(
Instruction::And, NarrowVecTy, CostKind,
{TTI::OK_AnyValue, TTI::OP_None},
- {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CxtI);
+ {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CtxI);
if (!ShuffleVectorInst::isIdentityMask(PermMask, VF))
Cost += getShuffleCost(TTI, TTI::SK_PermuteSingleSrc, NarrowVecTy, CostKind,
PermMask);
@@ -476,20 +476,20 @@ InstructionCost getBoolBitmaskCost(const TargetTransformInfo &TTI,
InstructionCost getNarrowedLeafOpsCost(
const TargetTransformInfo &TTI,
const SmallDenseMap<Value *, NarrowedLeafInfo> &NarrowedLeafShifts,
- VectorType *NarrowVecTy, VectorType *WideVecTy, const Instruction *CxtI,
+ VectorType *NarrowVecTy, VectorType *WideVecTy, const Instruction *CtxI,
const TTI::TargetCostKind CostKind) {
InstructionCost Cost = 0;
if (any_of(NarrowedLeafShifts,
[](const auto &P) { return P.second.Shift != 0; }))
Cost += TTI.getArithmeticInstrCost(
Instruction::Shl, WideVecTy, CostKind, {TTI::OK_AnyValue, TTI::OP_None},
- {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CxtI);
+ {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CtxI);
if (any_of(NarrowedLeafShifts,
[](const auto &P) { return !P.second.Mask.isAllOnes(); }))
Cost += TTI.getArithmeticInstrCost(
Instruction::And, NarrowVecTy, CostKind,
{TTI::OK_AnyValue, TTI::OP_None},
- {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CxtI);
+ {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CtxI);
return Cost;
}
} // namespace llvm::slpvectorizer
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.h b/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.h
index 5cb0f169d7b561..6b3877a42159d4 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.h
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.h
@@ -112,7 +112,7 @@ getBoolBitmaskCost(const TargetTransformInfo &TTI, bool NeedMask,
InstructionCost getNarrowedLeafOpsCost(
const TargetTransformInfo &TTI,
const SmallDenseMap<Value *, NarrowedLeafInfo> &NarrowedLeafShifts,
- VectorType *NarrowVecTy, VectorType *WideVecTy, const Instruction *CxtI,
+ VectorType *NarrowVecTy, VectorType *WideVecTy, const Instruction *CtxI,
TargetTransformInfo::TargetCostKind CostKind);
/// This is similar to TargetTransformInfo::getScalarizationOverhead, but if
@@ -156,7 +156,7 @@ InstructionCost getBitPackCost(const TargetTransformInfo &TTI,
TargetTransformInfo::CastContextHint CCH,
TargetTransformInfo::TargetCostKind CostKind,
const TargetLibraryInfo *TLI,
- const Instruction *CxtI, unsigned &ShiftWidth);
+ const Instruction *CtxI, unsigned &ShiftWidth);
/// i1 reductions can be emitted as the plain target reduction or in the
/// bitcast-based form (bitcast to a scalar integer type plus a compare for
diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index ddb06610d6572f..d16a3a1535cb75 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -1812,7 +1812,7 @@ static ScalarizationResult canScalarizeAccess(VectorType *VecTy, Value *Idx,
ConstantRange ValidIndices(Zero, MaxElts);
ConstantRange IdxRange(IntWidth, true);
- if (isGuaranteedNotToBePoison(Idx, SQ.AC, SQ.CxtI, SQ.DT)) {
+ if (isGuaranteedNotToBePoison(Idx, SQ.AC, SQ.CtxI, SQ.DT)) {
if (ValidIndices.contains(
computeConstantRange(Idx, /*ForSigned=*/false, SQ)))
return ScalarizationResult::safe();
@@ -5302,7 +5302,7 @@ static bool isKnownNonPositive(const Value *V, const SimplifyQuery &SQ,
return false;
auto NumSignBits = [&](const Value *X) {
- return ComputeNumSignBits(X, SQ.DL, SQ.AC, SQ.CxtI, SQ.DT);
+ return ComputeNumSignBits(X, SQ.DL, SQ.AC, SQ.CtxI, SQ.DT);
};
if (NumSignBits(V) == V->getType()->getScalarSizeInBits())
return true;
diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp
index d11f2123ffa282..6458f71453abe9 100644
--- a/llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -79,9 +79,9 @@ class ValueTrackingTest : public testing::Test {
A6 = findInstructionByNameOrNull(F, "A6");
A7 = findInstructionByNameOrNull(F, "A7");
- CxtI = findInstructionByNameOrNull(F, "CxtI");
- CxtI2 = findInstructionByNameOrNull(F, "CxtI2");
- CxtI3 = findInstructionByNameOrNull(F, "CxtI3");
+ CtxI = findInstructionByNameOrNull(F, "CtxI");
+ CtxI2 = findInstructionByNameOrNull(F, "CtxI2");
+ CtxI3 = findInstructionByNameOrNull(F, "CtxI3");
}
LLVMContext Context;
@@ -93,7 +93,7 @@ class ValueTrackingTest : public testing::Test {
*A6 = nullptr, *A7 = nullptr;
// Context instructions (optional)
- Instruction *CxtI = nullptr, *CxtI2 = nullptr, *CxtI3 = nullptr;
+ Instruction *CtxI = nullptr, *CtxI2 = nullptr, *CtxI3 = nullptr;
};
class MatchSelectPatternTest : public ValueTrackingTest {
@@ -1253,24 +1253,24 @@ TEST_F(ValueTrackingTest, isGuaranteedNotToBeUndefOrPoison_assume) {
"define void @test() {\n"
" %A = call i32 @f_i32()\n"
" %cond = call i1 @f_i1()\n"
- " %CxtI = add i32 0, 0\n"
+ " %CtxI = add i32 0, 0\n"
" br i1 %cond, label %BB1, label %EXIT\n"
"BB1:\n"
- " %CxtI2 = add i32 0, 0\n"
+ " %CtxI2 = add i32 0, 0\n"
" %cond2 = call i1 @f_i1()\n"
" call void @llvm.assume(i1 true) [ \"noundef\"(i32 %A) ]\n"
" br i1 %cond2, label %BB2, label %EXIT\n"
"BB2:\n"
- " %CxtI3 = add i32 0, 0\n"
+ " %CtxI3 = add i32 0, 0\n"
" ret void\n"
"EXIT:\n"
" ret void\n"
"}");
AssumptionCache AC(*F);
DominatorTree DT(*F);
- EXPECT_FALSE(isGuaranteedNotToBeUndefOrPoison(A, &AC, CxtI, &DT));
- EXPECT_FALSE(isGuaranteedNotToBeUndefOrPoison(A, &AC, CxtI2, &DT));
- EXPECT_TRUE(isGuaranteedNotToBeUndefOrPoison(A, &AC, CxtI3, &DT));
+ EXPECT_FALSE(isGuaranteedNotToBeUndefOrPoison(A, &AC, CtxI, &DT));
+ EXPECT_FALSE(isGuaranteedNotToBeUndefOrPoison(A, &AC, CtxI2, &DT));
+ EXPECT_TRUE(isGuaranteedNotToBeUndefOrPoison(A, &AC, CtxI3, &DT));
}
TEST_F(ValueTrackingTest, canCreatePoisonOrUndef) {
@@ -1413,15 +1413,15 @@ TEST_F(ValueTrackingTest, computePtrAlignment) {
"define void @test() {\n"
" %A = call ptr @f_i8p()\n"
" %cond = call i1 @f_i1()\n"
- " %CxtI = add i32 0, 0\n"
+ " %CtxI = add i32 0, 0\n"
" br i1 %cond, label %BB1, label %EXIT\n"
"BB1:\n"
- " %CxtI2 = add i32 0, 0\n"
+ " %CtxI2 = add i32 0, 0\n"
" %cond2 = call i1 @f_i1()\n"
" call void @llvm.assume(i1 true) [ \"align\"(ptr %A, i64 16) ]\n"
" br i1 %cond2, label %BB2, label %EXIT\n"
"BB2:\n"
- " %CxtI3 = add i32 0, 0\n"
+ " %CtxI3 = add i32 0, 0\n"
" ret void\n"
"EXIT:\n"
" ret void\n"
@@ -1429,9 +1429,9 @@ TEST_F(ValueTrackingTest, computePtrAlignment) {
AssumptionCache AC(*F);
DominatorTree DT(*F);
const DataLayout &DL = M->getDataLayout();
- EXPECT_EQ(getKnownAlignment(A, DL, CxtI, &AC, &DT), Align(1));
- EXPECT_EQ(getKnownAlignment(A, DL, CxtI2, &AC, &DT), Align(1));
- EXPECT_EQ(getKnownAlignment(A, DL, CxtI3, &AC, &DT), Align(16));
+ EXPECT_EQ(getKnownAlignment(A, DL, CtxI, &AC, &DT), Align(1));
+ EXPECT_EQ(getKnownAlignment(A, DL, CtxI2, &AC, &DT), Align(1));
+ EXPECT_EQ(getKnownAlignment(A, DL, CtxI3, &AC, &DT), Align(16));
}
TEST_F(ValueTrackingTest, MatchBinaryIntrinsicRecurrenceUMax) {
@@ -2544,13 +2544,13 @@ TEST_F(ValueTrackingTest, isNonZeroRecurrence) {
br i1 %cmp1, label %exit, label %loop
exit:
%A = or i8 %p, %r
- %CxtI = icmp eq i8 %A, 0
- ret i1 %CxtI
+ %CtxI = icmp eq i8 %A, 0
+ ret i1 %CtxI
}
)");
const DataLayout &DL = M->getDataLayout();
AssumptionCache AC(*F);
- EXPECT_TRUE(isKnownNonZero(A, SimplifyQuery(DL, /*DT=*/nullptr, &AC, CxtI)));
+ EXPECT_TRUE(isKnownNonZero(A, SimplifyQuery(DL, /*DT=*/nullptr, &AC, CtxI)));
}
TEST_F(ValueTrackingTest, KnownNonZeroFromDomCond) {
@@ -2563,10 +2563,10 @@ TEST_F(ValueTrackingTest, KnownNonZeroFromDomCond) {
%cond = and i1 %c1, %c
br i1 %cond, label %T, label %Q
T:
- %CxtI = add i32 0, 0
+ %CtxI = add i32 0, 0
ret void
Q:
- %CxtI2 = add i32 0, 0
+ %CtxI2 = add i32 0, 0
ret void
}
)");
@@ -2574,8 +2574,8 @@ TEST_F(ValueTrackingTest, KnownNonZeroFromDomCond) {
DominatorTree DT(*F);
const DataLayout &DL = M->getDataLayout();
const SimplifyQuery SQ(DL, &DT, &AC);
- EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CxtI)), true);
- EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CxtI2)), false);
+ EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CtxI)), true);
+ EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CtxI2)), false);
}
TEST_F(ValueTrackingTest, KnownNonZeroFromDomCond2) {
@@ -2588,10 +2588,10 @@ TEST_F(ValueTrackingTest, KnownNonZeroFromDomCond2) {
%cond = select i1 %c, i1 %c1, i1 false
br i1 %cond, label %T, label %Q
T:
- %CxtI = add i32 0, 0
+ %CtxI = add i32 0, 0
ret void
Q:
- %CxtI2 = add i32 0, 0
+ %CtxI2 = add i32 0, 0
ret void
}
)");
@@ -2599,8 +2599,8 @@ TEST_F(ValueTrackingTest, KnownNonZeroFromDomCond2) {
DominatorTree DT(*F);
const DataLayout &DL = M->getDataLayout();
const SimplifyQuery SQ(DL, &DT, &AC);
- EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CxtI)), true);
- EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CxtI2)), false);
+ EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CtxI)), true);
+ EXPECT_EQ(isKnownNonZero(A, SQ.getWithInstruction(CtxI2)), false);
}
TEST_F(ValueTrackingTest, IsImpliedConditionAnd) {
@@ -3714,7 +3714,7 @@ TEST_F(ValueTrackingTest, ComputeConstantRange) {
Value *Stride = &*F->arg_begin();
Instruction *I = &findInstructionByName(F, "stride.plus.one");
- SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CxtI=*/I);
+ SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CtxI=*/I);
ConstantRange CR2 = computeConstantRange(Stride, false, SQ);
EXPECT_EQ(5, CR2.getLower());
EXPECT_EQ(0, CR2.getUpper());
@@ -3740,7 +3740,7 @@ TEST_F(ValueTrackingTest, ComputeConstantRange) {
Value *Stride = &*F->arg_begin();
Instruction *I = &findInstructionByName(F, "stride.plus.one");
- SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CxtI=*/I);
+ SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CtxI=*/I);
ConstantRange CR2 = computeConstantRange(Stride, false, SQ);
EXPECT_EQ(6, CR2.getLower());
EXPECT_EQ(0, CR2.getUpper());
@@ -3766,7 +3766,7 @@ TEST_F(ValueTrackingTest, ComputeConstantRange) {
Value *Stride = &*F->arg_begin();
Instruction *I = &findInstructionByName(F, "stride.plus.one");
- SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CxtI=*/I);
+ SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CtxI=*/I);
ConstantRange CR2 = computeConstantRange(Stride, false, SQ);
EXPECT_EQ(5, CR2.getLower());
EXPECT_EQ(APInt::getSignedMinValue(32), CR2.getUpper());
@@ -3792,7 +3792,7 @@ TEST_F(ValueTrackingTest, ComputeConstantRange) {
Value *Stride = &*F->arg_begin();
Instruction *I = &findInstructionByName(F, "stride.plus.one");
- SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CxtI=*/I);
+ SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CtxI=*/I);
ConstantRange CR2 = computeConstantRange(Stride, false, SQ);
EXPECT_EQ(6, CR2.getLower());
EXPECT_EQ(APInt::getSignedMinValue(32), CR2.getUpper());
@@ -3823,7 +3823,7 @@ TEST_F(ValueTrackingTest, ComputeConstantRange) {
AssumptionCache AC(*F);
Value *Stride = &*F->arg_begin();
Instruction *I = &findInstructionByName(F, "stride.plus.one");
- SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CxtI=*/I);
+ SimplifyQuery SQ(M->getDataLayout(), /*DT=*/nullptr, &AC, /*CtxI=*/I);
ConstantRange CR = computeConstantRange(Stride, /*ForSigned=*/false, SQ);
EXPECT_EQ(99, *CR.getSingleElement());
}
diff --git a/llvm/unittests/FileCheck/FileCheckTest.cpp b/llvm/unittests/FileCheck/FileCheckTest.cpp
index a76edfb4264338..a6267fc6b6941d 100644
--- a/llvm/unittests/FileCheck/FileCheckTest.cpp
+++ b/llvm/unittests/FileCheck/FileCheckTest.cpp
@@ -1485,69 +1485,69 @@ TEST_F(FileCheckTest, Substitution) {
}
TEST_F(FileCheckTest, FileCheckContext) {
- FileCheckPatternContext Cxt;
+ FileCheckPatternContext Ctx;
SourceMgr SM;
// No definition.
- EXPECT_THAT_ERROR(Cxt.defineCmdlineVariables({}, SM), Succeeded());
+ EXPECT_THAT_ERROR(Ctx.defineCmdlineVariables({}, SM), Succeeded());
// Missing equal sign.
expectDiagnosticError("missing equal sign in global definition",
- Cxt.defineCmdlineVariables({"LocalVar"}, SM));
+ Ctx.defineCmdlineVariables({"LocalVar"}, SM));
expectDiagnosticError("missing equal sign in global definition",
- Cxt.defineCmdlineVariables({"#LocalNumVar"}, SM));
+ Ctx.defineCmdlineVariables({"#LocalNumVar"}, SM));
// Empty variable name.
expectDiagnosticError("empty variable name",
- Cxt.defineCmdlineVariables({"=18"}, SM));
+ Ctx.defineCmdlineVariables({"=18"}, SM));
expectDiagnosticError("empty variable name",
- Cxt.defineCmdlineVariables({"#=18"}, SM));
+ Ctx.defineCmdlineVariables({"#=18"}, SM));
// Invalid variable name.
expectDiagnosticError("invalid variable name",
- Cxt.defineCmdlineVariables({"18LocalVar=18"}, SM));
+ Ctx.defineCmdlineVariables({"18LocalVar=18"}, SM));
expectDiagnosticError("invalid variable name",
- Cxt.defineCmdlineVariables({"#18LocalNumVar=18"}, SM));
+ Ctx.defineCmdlineVariables({"#18LocalNumVar=18"}, SM));
// Name conflict between pattern and numeric variable.
expectDiagnosticError(
"string variable with name 'LocalVar' already exists",
- Cxt.defineCmdlineVariables({"LocalVar=18", "#LocalVar=36"}, SM));
- Cxt = FileCheckPatternContext();
+ Ctx.defineCmdlineVariables({"LocalVar=18", "#LocalVar=36"}, SM));
+ Ctx = FileCheckPatternContext();
expectDiagnosticError(
"numeric variable with name 'LocalNumVar' already exists",
- Cxt.defineCmdlineVariables({"#LocalNumVar=18", "LocalNumVar=36"}, SM));
- Cxt = FileCheckPatternContext();
+ Ctx.defineCmdlineVariables({"#LocalNumVar=18", "LocalNumVar=36"}, SM));
+ Ctx = FileCheckPatternContext();
// Invalid numeric value for numeric variable.
- expectUndefErrors({"x"}, Cxt.defineCmdlineVariables({"#LocalNumVar=x"}, SM));
+ expectUndefErrors({"x"}, Ctx.defineCmdlineVariables({"#LocalNumVar=x"}, SM));
// Define local variables from command-line.
std::vector<StringRef> GlobalDefines;
// Clear local variables to remove dummy numeric variable x that
// parseNumericSubstitutionBlock would have created and stored in
// GlobalNumericVariableTable.
- Cxt.clearLocalVars();
+ Ctx.clearLocalVars();
GlobalDefines.emplace_back("LocalVar=FOO");
GlobalDefines.emplace_back("EmptyVar=");
GlobalDefines.emplace_back("#LocalNumVar1=18");
GlobalDefines.emplace_back("#%x,LocalNumVar2=LocalNumVar1+2");
GlobalDefines.emplace_back("#LocalNumVar3=0xc");
- ASSERT_THAT_ERROR(Cxt.defineCmdlineVariables(GlobalDefines, SM), Succeeded());
+ ASSERT_THAT_ERROR(Ctx.defineCmdlineVariables(GlobalDefines, SM), Succeeded());
// Create @LINE pseudo numeric variable and check it is present by matching
// it.
size_t LineNumber = 1;
- Pattern P(Check::CheckPlain, &Cxt, LineNumber);
+ Pattern P(Check::CheckPlain, &Ctx, LineNumber);
FileCheckRequest Req;
- Cxt.createLineVariable();
+ Ctx.createLineVariable();
ASSERT_FALSE(P.parsePattern("[[@LINE]]", "CHECK", SM, Req));
Pattern::MatchResult Res = P.match("1", SM);
ASSERT_THAT_ERROR(std::move(Res.TheError), Succeeded());
#ifndef NDEBUG
// Recreating @LINE pseudo numeric variable fails.
- EXPECT_DEATH(Cxt.createLineVariable(),
+ EXPECT_DEATH(Ctx.createLineVariable(),
"@LINE pseudo numeric variable already created");
#endif
@@ -1558,31 +1558,31 @@ TEST_F(FileCheckTest, FileCheckContext) {
StringRef LocalNumVar3Ref = bufferize(SM, "LocalNumVar3");
StringRef EmptyVarStr = "EmptyVar";
StringRef UnknownVarStr = "UnknownVar";
- Expected<StringRef> LocalVar = Cxt.getPatternVarValue(LocalVarStr);
- P = Pattern(Check::CheckPlain, &Cxt, ++LineNumber);
+ Expected<StringRef> LocalVar = Ctx.getPatternVarValue(LocalVarStr);
+ P = Pattern(Check::CheckPlain, &Ctx, ++LineNumber);
std::optional<NumericVariable *> DefinedNumericVariable;
Expected<std::unique_ptr<Expression>> ExpressionPointer =
P.parseNumericSubstitutionBlock(LocalNumVar1Ref, DefinedNumericVariable,
/*IsLegacyLineExpr=*/false, LineNumber,
- &Cxt, SM);
+ &Ctx, SM);
ASSERT_THAT_EXPECTED(LocalVar, Succeeded());
EXPECT_EQ(*LocalVar, "FOO");
- Expected<StringRef> EmptyVar = Cxt.getPatternVarValue(EmptyVarStr);
- Expected<StringRef> UnknownVar = Cxt.getPatternVarValue(UnknownVarStr);
+ Expected<StringRef> EmptyVar = Ctx.getPatternVarValue(EmptyVarStr);
+ Expected<StringRef> UnknownVar = Ctx.getPatternVarValue(UnknownVarStr);
ASSERT_THAT_EXPECTED(ExpressionPointer, Succeeded());
Expected<APInt> ExpressionVal = (*ExpressionPointer)->getAST()->eval();
ASSERT_THAT_EXPECTED(ExpressionVal, Succeeded());
EXPECT_EQ(ExpressionVal->getSExtValue(), 18);
ExpressionPointer = P.parseNumericSubstitutionBlock(
LocalNumVar2Ref, DefinedNumericVariable,
- /*IsLegacyLineExpr=*/false, LineNumber, &Cxt, SM);
+ /*IsLegacyLineExpr=*/false, LineNumber, &Ctx, SM);
ASSERT_THAT_EXPECTED(ExpressionPointer, Succeeded());
ExpressionVal = (*ExpressionPointer)->getAST()->eval();
ASSERT_THAT_EXPECTED(ExpressionVal, Succeeded());
EXPECT_EQ(ExpressionVal->getSExtValue(), 20);
ExpressionPointer = P.parseNumericSubstitutionBlock(
LocalNumVar3Ref, DefinedNumericVariable,
- /*IsLegacyLineExpr=*/false, LineNumber, &Cxt, SM);
+ /*IsLegacyLineExpr=*/false, LineNumber, &Ctx, SM);
ASSERT_THAT_EXPECTED(ExpressionPointer, Succeeded());
ExpressionVal = (*ExpressionPointer)->getAST()->eval();
ASSERT_THAT_EXPECTED(ExpressionVal, Succeeded());
@@ -1592,8 +1592,8 @@ TEST_F(FileCheckTest, FileCheckContext) {
expectUndefErrors({std::string(UnknownVarStr)}, UnknownVar.takeError());
// Clear local variables and check they become absent.
- Cxt.clearLocalVars();
- LocalVar = Cxt.getPatternVarValue(LocalVarStr);
+ Ctx.clearLocalVars();
+ LocalVar = Ctx.getPatternVarValue(LocalVarStr);
expectUndefErrors({std::string(LocalVarStr)}, LocalVar.takeError());
// Check a numeric expression's evaluation fails if called after clearing of
// local variables, if it was created before. This is important because local
@@ -1601,50 +1601,50 @@ TEST_F(FileCheckTest, FileCheckContext) {
// expressions are linked to the numeric variables they use.
expectUndefErrors({"LocalNumVar3"},
(*ExpressionPointer)->getAST()->eval().takeError());
- P = Pattern(Check::CheckPlain, &Cxt, ++LineNumber);
+ P = Pattern(Check::CheckPlain, &Ctx, ++LineNumber);
ExpressionPointer = P.parseNumericSubstitutionBlock(
LocalNumVar1Ref, DefinedNumericVariable, /*IsLegacyLineExpr=*/false,
- LineNumber, &Cxt, SM);
+ LineNumber, &Ctx, SM);
ASSERT_THAT_EXPECTED(ExpressionPointer, Succeeded());
ExpressionVal = (*ExpressionPointer)->getAST()->eval();
expectUndefErrors({"LocalNumVar1"}, ExpressionVal.takeError());
ExpressionPointer = P.parseNumericSubstitutionBlock(
LocalNumVar2Ref, DefinedNumericVariable, /*IsLegacyLineExpr=*/false,
- LineNumber, &Cxt, SM);
+ LineNumber, &Ctx, SM);
ASSERT_THAT_EXPECTED(ExpressionPointer, Succeeded());
ExpressionVal = (*ExpressionPointer)->getAST()->eval();
expectUndefErrors({"LocalNumVar2"}, ExpressionVal.takeError());
- EmptyVar = Cxt.getPatternVarValue(EmptyVarStr);
+ EmptyVar = Ctx.getPatternVarValue(EmptyVarStr);
expectUndefErrors({"EmptyVar"}, EmptyVar.takeError());
// Clear again because parseNumericSubstitutionBlock would have created a
// dummy variable and stored it in GlobalNumericVariableTable.
- Cxt.clearLocalVars();
+ Ctx.clearLocalVars();
// Redefine global variables and check variables are defined again.
GlobalDefines.emplace_back("$GlobalVar=BAR");
GlobalDefines.emplace_back("#$GlobalNumVar=36");
- ASSERT_THAT_ERROR(Cxt.defineCmdlineVariables(GlobalDefines, SM), Succeeded());
+ ASSERT_THAT_ERROR(Ctx.defineCmdlineVariables(GlobalDefines, SM), Succeeded());
StringRef GlobalVarStr = "$GlobalVar";
StringRef GlobalNumVarRef = bufferize(SM, "$GlobalNumVar");
- Expected<StringRef> GlobalVar = Cxt.getPatternVarValue(GlobalVarStr);
+ Expected<StringRef> GlobalVar = Ctx.getPatternVarValue(GlobalVarStr);
ASSERT_THAT_EXPECTED(GlobalVar, Succeeded());
EXPECT_EQ(*GlobalVar, "BAR");
- P = Pattern(Check::CheckPlain, &Cxt, ++LineNumber);
+ P = Pattern(Check::CheckPlain, &Ctx, ++LineNumber);
ExpressionPointer = P.parseNumericSubstitutionBlock(
GlobalNumVarRef, DefinedNumericVariable, /*IsLegacyLineExpr=*/false,
- LineNumber, &Cxt, SM);
+ LineNumber, &Ctx, SM);
ASSERT_THAT_EXPECTED(ExpressionPointer, Succeeded());
ExpressionVal = (*ExpressionPointer)->getAST()->eval();
ASSERT_THAT_EXPECTED(ExpressionVal, Succeeded());
EXPECT_EQ(ExpressionVal->getSExtValue(), 36);
// Clear local variables and check global variables remain defined.
- Cxt.clearLocalVars();
- EXPECT_THAT_EXPECTED(Cxt.getPatternVarValue(GlobalVarStr), Succeeded());
- P = Pattern(Check::CheckPlain, &Cxt, ++LineNumber);
+ Ctx.clearLocalVars();
+ EXPECT_THAT_EXPECTED(Ctx.getPatternVarValue(GlobalVarStr), Succeeded());
+ P = Pattern(Check::CheckPlain, &Ctx, ++LineNumber);
ExpressionPointer = P.parseNumericSubstitutionBlock(
GlobalNumVarRef, DefinedNumericVariable, /*IsLegacyLineExpr=*/false,
- LineNumber, &Cxt, SM);
+ LineNumber, &Ctx, SM);
ASSERT_THAT_EXPECTED(ExpressionPointer, Succeeded());
ExpressionVal = (*ExpressionPointer)->getAST()->eval();
ASSERT_THAT_EXPECTED(ExpressionVal, Succeeded());
>From ebdd8b80d1292140c9e7e600ae771a9172853011 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 24 Sep 2026 13:19:22 +0100
Subject: [PATCH 2/2] CXTI -> CtxI
---
llvm/include/llvm/Analysis/SimplifyQuery.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/llvm/include/llvm/Analysis/SimplifyQuery.h b/llvm/include/llvm/Analysis/SimplifyQuery.h
index 41bc13123343a1..6786c9c7606f71 100644
--- a/llvm/include/llvm/Analysis/SimplifyQuery.h
+++ b/llvm/include/llvm/Analysis/SimplifyQuery.h
@@ -92,22 +92,22 @@ struct SimplifyQuery {
bool CanUseUndef = true;
bool AllowEphemerals = false;
- SimplifyQuery(const DataLayout &DL, const Instruction *CXTI = nullptr)
- : DL(DL), CtxI(CXTI) {}
+ SimplifyQuery(const DataLayout &DL, const Instruction *CtxI = nullptr)
+ : DL(DL), CtxI(CtxI) {}
SimplifyQuery(const DataLayout &DL, const TargetLibraryInfo *TLI,
const DominatorTree *DT = nullptr,
AssumptionCache *AC = nullptr,
- const Instruction *CXTI = nullptr, bool UseInstrInfo = true,
+ const Instruction *CtxI = nullptr, bool UseInstrInfo = true,
bool CanUseUndef = true, const DomConditionCache *DC = nullptr)
- : DL(DL), TLI(TLI), DT(DT), AC(AC), CtxI(CXTI), DC(DC), IIQ(UseInstrInfo),
+ : DL(DL), TLI(TLI), DT(DT), AC(AC), CtxI(CtxI), DC(DC), IIQ(UseInstrInfo),
CanUseUndef(CanUseUndef) {}
SimplifyQuery(const DataLayout &DL, const DominatorTree *DT,
AssumptionCache *AC = nullptr,
- const Instruction *CXTI = nullptr, bool UseInstrInfo = true,
+ const Instruction *CtxI = nullptr, bool UseInstrInfo = true,
bool CanUseUndef = true)
- : DL(DL), DT(DT), AC(AC), CtxI(CXTI), IIQ(UseInstrInfo),
+ : DL(DL), DT(DT), AC(AC), CtxI(CtxI), IIQ(UseInstrInfo),
CanUseUndef(CanUseUndef) {}
SimplifyQuery getWithInstruction(const Instruction *I) const {
More information about the llvm-commits
mailing list