[PATCH] D147558: [IR] Add a ConstantInt::getAllOnes wrapper around ConstantInt::get/getSigned.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 12:27:44 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: nikic, efriedma, reames.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

Creating an all ones value for a type larger than i64 requires
using using ConstantInt::getSigned with -1, passing true to the
IsSigned operand of ConstantInt::get with -1, or using
Constant::getAllOnesValue.

Many places in tree used the ConstantInt::get -1 without IsSigned.
This likely works fine for the types they see in practice, but
it seemed better to have a more explicit way to do this.

This patch adds ConstantInt::getAllOnes and replaces other calls
to use it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147558

Files:
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/CodeGen/ExpandReductions.cpp
  llvm/lib/CodeGen/ExpandVectorPredication.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/VectorBuilder.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
  llvm/tools/llvm-stress/llvm-stress.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147558.510892.patch
Type: text/x-patch
Size: 20729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230404/03fd8a6b/attachment.bin>


More information about the llvm-commits mailing list