llvm-project/llvm/lib/Transforms/Utils
Hubert Tong 32c9991dab [InstCombine] Fix errno bug in pow expansion to sqrt
A conversion from `pow` to `sqrt` shall not call an `errno`-setting
`sqrt` with -//infinity//: the `sqrt` will set `EDOM` where the `pow`
call need not.

This patch avoids the erroneous (pun not intended) transformation by
applying the restrictions discussed in the thread for
https://lists.llvm.org/pipermail/llvm-dev/2020-September/145051.html.

The existing tests are updated (depending on emphasis in the checks for
library calls, avoidance of overlap, and overall coverage):
  - to add `ninf`, retaining the intended library call,
  - to use the intrinsic, retaining the use of `select`, or
  - to expect the replacement to not occur.

The following is tested:
  - The pow intrinsic folds to a `select` instruction to
    handle -//infinity//.
  - The pow library call folds, with `ninf`, to `sqrt` without the
    `select` instruction associated with handling -//infinity//.
  - The pow library call does not fold to `sqrt` without `ninf`.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D87877
2020-09-22 18:58:05 -04:00
..
AMDGPUEmitPrintf.cpp
ASanStackFrameLayout.cpp
AddDiscriminators.cpp
AssumeBundleBuilder.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
BasicBlockUtils.cpp [Loop Simplify] Resolve an issue where metadata is not applied to a loop latch. 2020-07-17 14:02:14 +00:00
BreakCriticalEdges.cpp BreakCriticalEdges for callbr indirect dests 2020-06-17 11:45:06 -07:00
BuildLibCalls.cpp [BuildLibCalls] Add more noundef to library functions 2020-09-09 20:33:35 +09:00
BypassSlowDivision.cpp BypassSlowDivision: Fix dropping debug info 2020-06-18 17:27:19 -04:00
CMakeLists.txt [Loop Peeling] Separate the Loop Peeling Utilities from the Loop Unrolling Utilities 2020-07-31 18:31:58 +00:00
CallGraphUpdater.cpp [CallGraph] Add support for callback call sites 2020-07-01 13:44:11 -07:00
CallPromotionUtils.cpp [Utils] isLegalToPromote - Fix missing null check before writing to FailureReason. 2020-09-15 14:49:04 +01:00
CanonicalizeAliases.cpp
CanonicalizeFreezeInLoops.cpp LoopAnalysisManager.h - reduce includes to forward declarations. NFC. 2020-06-06 14:06:46 +01:00
CloneFunction.cpp [Cloning] Fix to cloning DISubprograms. 2020-08-21 11:54:56 -07:00
CloneModule.cpp
CodeExtractor.cpp Fix some clang-tidy bugprone-argument-comment issues 2020-09-19 20:41:25 -07:00
CodeMoverUtils.cpp [CodeMoverUtils] Move OrderedInstructions to CodeMoverUtils 2020-07-10 11:22:43 +05:30
CtorUtils.cpp
Debugify.cpp Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI." 2020-07-24 13:02:33 +01:00
DemoteRegToStack.cpp Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI." 2020-07-24 13:02:33 +01:00
EntryExitInstrumenter.cpp GlobalsModRef.h - reduce CallGraph.h include to forward declarations. NFC. 2020-06-25 16:00:43 +01:00
EscapeEnumerator.cpp [TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN) 2020-09-15 15:20:05 -07:00
Evaluator.cpp [IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand(). 2020-04-27 22:17:03 -07:00
FixIrreducible.cpp [LowerSwitch][NewPM] Port lowerswitch to NPM 2020-09-15 18:18:31 -07:00
FlattenCFG.cpp Fix Wdocumentation warnings by only tagging a param id once per doxygen comment block. NFC. 2020-07-01 12:01:19 +01:00
FunctionComparator.cpp [SVE] Make ElementCount members private 2020-08-28 14:43:53 +01:00
FunctionImportUtils.cpp [ThinLTO] Drop dso_local if a GlobalVariable satisfies isDeclarationForLinker() 2020-04-07 15:46:01 -07:00
GlobalStatus.cpp [CallSite removal][Transform] Replace CallSite with CallBase in Utils. NFC 2020-04-23 20:49:33 -07:00
GuardUtils.cpp
ImportedFunctionsInliningStatistics.cpp
InjectTLIMappings.cpp [InjectTLIMappings] Use StringRef instead of std::string for FN name. 2020-07-16 11:53:04 -07:00
InlineFunction.cpp [SVE][CodeGen] Fix InlineFunction for scalable vectors 2020-09-11 08:34:51 +01:00
InstructionNamer.cpp [InstNamer] use 'i' for Instructions, not 'tmp' 2020-06-01 11:11:14 -04:00
IntegerDivision.cpp
LCSSA.cpp [LCSSA] Provide option for caller to clean up unused PHIs. 2020-08-01 20:43:19 +01:00
LLVMBuild.txt
LibCallsShrinkWrap.cpp
Local.cpp [Local] Clean up enforceKnownAlignment() (NFC) 2020-09-19 22:29:40 +02:00
LoopPeel.cpp [LoopInfo] empty() -> isInnermost(), add isOutermost() 2020-09-22 23:28:51 +03:00
LoopRotationUtils.cpp [NFC][LoopRotate] Add a statistic for how many times rotation failed due to the header size 2020-07-16 00:21:55 +03:00
LoopSimplify.cpp [LoopSimplify] Use SmallPtrSet and range for loops more. NFCI. 2020-07-20 15:00:59 +02:00
LoopUnroll.cpp [Loop Peeling] Separate the Loop Peeling Utilities from the Loop Unrolling Utilities 2020-07-31 18:31:58 +00:00
LoopUnrollAndJam.cpp [NFC][LoopUnrollAndJam] Use BasicBlock::replacePhiUsesWith instead of 2020-08-11 15:35:14 +00:00
LoopUnrollRuntime.cpp [LoopUnroll] Update branch weight for remainder loop 2020-07-15 12:33:29 -07:00
LoopUtils.cpp [NFC] GetUnderlyingObject -> getUnderlyingObject 2020-07-30 21:08:24 -07:00
LoopVersioning.cpp [LoopInfo] empty() -> isInnermost(), add isOutermost() 2020-09-22 23:28:51 +03:00
LowerInvoke.cpp [IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand(). 2020-04-27 22:17:03 -07:00
LowerMemIntrinsics.cpp Utils: Mostly convert memcpy expansion to use Align 2020-03-22 11:21:44 -04:00
LowerSwitch.cpp [LowerSwitch][NewPM] Port lowerswitch to NPM 2020-09-15 18:18:31 -07:00
MatrixUtils.cpp [Matrix] Add TileInfo abstraction for tiled matrix code-gen. 2020-07-20 18:49:08 +01:00
Mem2Reg.cpp
MetaRenamer.cpp
MisExpect.cpp
ModuleUtils.cpp [KernelAddressSanitizer] Make globals constructors compatible with kernel [v2] 2020-06-10 15:08:42 +02:00
NameAnonGlobals.cpp
PredicateInfo.cpp [PredicateInfo][SCCP] Remove assertion (PR46814) 2020-07-23 19:36:51 +02:00
PromoteMemoryToRegister.cpp [SROA][Mem2Reg] Use efficient droppable use API (after D83976) 2020-07-28 17:41:01 -05:00
SSAUpdater.cpp
SSAUpdaterBulk.cpp
SanitizerStats.cpp
ScalarEvolutionExpander.cpp [SCEVExpander] Support expanding nonintegral pointers with constant base. 2020-09-19 17:19:53 +01:00
SimplifyCFG.cpp [SimplifyCFG] Consider cost of combining predicates. 2020-09-07 10:04:50 +01:00
SimplifyIndVar.cpp [IndVarSimplify] Don't replace IV user with unsafe loop-invariant (PR45360) 2020-06-23 13:53:15 +03:00
SimplifyLibCalls.cpp [InstCombine] Fix errno bug in pow expansion to sqrt 2020-09-22 18:58:05 -04:00
SizeOpts.cpp Reland D84057 [PGO][PGSO] Remove a temporary flag used for gradual rollout. 2020-07-22 20:57:25 -07:00
SplitModule.cpp
StripGCRelocates.cpp [Statepoint] Replace uses of isX functions with idiomatic isa<X> 2020-05-27 18:32:28 -07:00
StripNonLineTableDebugInfo.cpp
SymbolRewriter.cpp
UnifyFunctionExitNodes.cpp [UnifyFunctionExitNodes] Fix Modified status for unreachable blocks 2020-09-09 13:36:03 +02:00
UnifyLoopExits.cpp [LowerSwitch][NewPM] Port lowerswitch to NPM 2020-09-15 18:18:31 -07:00
UniqueInternalLinkageNames.cpp New pass to make internal linkage symbol names unique. 2020-04-20 15:05:22 -07:00
Utils.cpp [LowerSwitch][NewPM] Port lowerswitch to NPM 2020-09-15 18:18:31 -07:00
VNCoercion.cpp [NFC] Remove unused GetUnderlyingObject paramenter 2020-07-31 02:10:03 -07:00
ValueMapper.cpp ValueMapper does not preserve inline assembly dialect when remapping the type 2020-05-17 14:57:50 -07:00