[PATCH] D23282: [IR/GlobalISel] move compare predicates into lib/Support

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 14:29:55 PDT 2016


t.p.northover created this revision.
t.p.northover added a subscriber: llvm-commits.
t.p.northover set the repository for this revision to rL LLVM.
Herald added a reviewer: tstellarAMD.
Herald added subscribers: eraman, nemanjai, jfb, mzolotukhin, mcrosier, vkalintiris, mehdi_amini, dsanders, arsenm, sanjoy, jholewinski.

Hi,

I'd like to reuse the IR-level predicate scheme for GlobalISel. As far as I can tell there are 3 possible ways to do this:

  * Use the CmpInst enums directly. This feels close to a layering violation. ISel has to know *something* about IR, but you'd hope to minimize that after the first translation.
  * Copy/paste the definitions into include/CodeGen/GlobalISel somewhere. Long term this isn't viable, though it might be a reasonable short-term hack until we know GlobalISel works.
  * Refactor the predicates out of lib/IR into lib/Support (or elsewhere).

I decided to try and avoid hacks so took the 3rd option, giving us this large diff. I think it's actually a reasonable change on its own and the interfaces are slightly nicer afterwards, though I wouldn't have called it worth the time without GlobalISel's wider intent.

One thing worth thinking about is whether a single Predicate is the best choice. Passes had been (somewhat haphazardly, but not completely without reason) using either CmpInst, ICmpInst or FCmpInst to refer to the enum values.

There's not really any loss of expressiveness with a single Predicate, since the names are still ICMP_*/FCMP_*, but I could alternatively split it into `IPredicate` and `FPredicate` which would allow IPredicate::EQ, FPredicate::OEQ and so on.

Opinions?

Repository:
  rL LLVM

https://reviews.llvm.org/D23282

Files:
  include/llvm/Analysis/ConstantFolding.h
  include/llvm/Analysis/DependenceAnalysis.h
  include/llvm/Analysis/InstructionSimplify.h
  include/llvm/Analysis/LazyValueInfo.h
  include/llvm/Analysis/ScalarEvolution.h
  include/llvm/Analysis/TargetFolder.h
  include/llvm/CodeGen/Analysis.h
  include/llvm/CodeGen/FastISel.h
  include/llvm/IR/ConstantFolder.h
  include/llvm/IR/ConstantRange.h
  include/llvm/IR/Constants.h
  include/llvm/IR/IRBuilder.h
  include/llvm/IR/InstrTypes.h
  include/llvm/IR/Instructions.h
  include/llvm/IR/NoFolder.h
  include/llvm/IR/PatternMatch.h
  include/llvm/Support/Predicate.h
  include/llvm/Transforms/Scalar/GVN.h
  include/llvm/Transforms/Utils/CmpInstAnalysis.h
  lib/Analysis/BranchProbabilityInfo.cpp
  lib/Analysis/ConstantFolding.cpp
  lib/Analysis/DependenceAnalysis.cpp
  lib/Analysis/InlineCost.cpp
  lib/Analysis/InstructionSimplify.cpp
  lib/Analysis/LazyValueInfo.cpp
  lib/Analysis/ScalarEvolution.cpp
  lib/Analysis/ScalarEvolutionExpander.cpp
  lib/Analysis/ValueTracking.cpp
  lib/AsmParser/LLParser.cpp
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/CodeGen/Analysis.cpp
  lib/CodeGen/CodeGenPrepare.cpp
  lib/CodeGen/SelectionDAG/FastISel.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/ExecutionEngine/Interpreter/Execution.cpp
  lib/IR/AsmWriter.cpp
  lib/IR/AutoUpgrade.cpp
  lib/IR/ConstantFold.cpp
  lib/IR/ConstantFold.h
  lib/IR/ConstantRange.cpp
  lib/IR/Constants.cpp
  lib/IR/ConstantsContext.h
  lib/IR/Core.cpp
  lib/IR/Instructions.cpp
  lib/IR/Verifier.cpp
  lib/Support/CMakeLists.txt
  lib/Support/Predicate.cpp
  lib/Target/AArch64/AArch64FastISel.cpp
  lib/Target/AMDGPU/SIISelLowering.cpp
  lib/Target/ARM/ARMFastISel.cpp
  lib/Target/Mips/MipsFastISel.cpp
  lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
  lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
  lib/Target/PowerPC/PPCFastISel.cpp
  lib/Target/SystemZ/SystemZTDC.cpp
  lib/Target/X86/X86FastISel.cpp
  lib/Transforms/IPO/GlobalOpt.cpp
  lib/Transforms/IPO/MergeFunctions.cpp
  lib/Transforms/IPO/WholeProgramDevirt.cpp
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstCombineSelect.cpp
  lib/Transforms/InstCombine/InstructionCombining.cpp
  lib/Transforms/Instrumentation/MemorySanitizer.cpp
  lib/Transforms/Instrumentation/SanitizerCoverage.cpp
  lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
  lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  lib/Transforms/Scalar/EarlyCSE.cpp
  lib/Transforms/Scalar/Float2Int.cpp
  lib/Transforms/Scalar/GVN.cpp
  lib/Transforms/Scalar/GuardWidening.cpp
  lib/Transforms/Scalar/IndVarSimplify.cpp
  lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  lib/Transforms/Scalar/LoopRerollPass.cpp
  lib/Transforms/Scalar/LoopStrengthReduce.cpp
  lib/Transforms/Scalar/LoopUnswitch.cpp
  lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
  lib/Transforms/Utils/CmpInstAnalysis.cpp
  lib/Transforms/Utils/FlattenCFG.cpp
  lib/Transforms/Utils/LoopUtils.cpp
  lib/Transforms/Utils/LowerSwitch.cpp
  lib/Transforms/Utils/SimplifyCFG.cpp
  lib/Transforms/Utils/SimplifyIndVar.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  tools/bugpoint/Miscompilation.cpp
  tools/llvm-stress/llvm-stress.cpp
  unittests/IR/ConstantRangeTest.cpp
  unittests/IR/ConstantsTest.cpp
  unittests/IR/InstructionsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23282.67225.patch
Type: text/x-patch
Size: 566985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160808/6d3bc06b/attachment-0001.bin>


More information about the llvm-commits mailing list