llvm-project/llvm/test/Transforms
Craig Topper d3e5781e53 [InstCombine] Teach visitICmpInst to not break integer absolute value idioms
Summary:
This patch adds an early out to visitICmpInst if we are looking at a compare as part of an integer absolute value idiom. Similar is already done for min/max.

In the particular case I observed in a benchmark we had an absolute value of a load from an indexed global. We simplified the compare using foldCmpLoadFromIndexedGlobal into a magic bit vector, a shift, and an and. But the load result was still used for the select and the negate part of the absolute valute idiom. So we overcomplicated the code and lost the ability to recognize it as an absolute value.

I've chosen a simpler case for the test here.

Reviewers: spatel, davide, majnemer

Reviewed By: spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D39766

llvm-svn: 317994
2017-11-12 02:28:21 +00:00
..
ADCE [ADCE][Dominators] Reapply: Teach ADCE to preserve dominators 2017-08-22 16:30:21 +00:00
AddDiscriminators
AlignmentFromAssumptions
ArgumentPromotion [ArgPromotion] Preserve alignment of byval argument in new alloca 2017-08-04 17:09:11 +00:00
AtomicExpand
BDCE [BDCE] Don't check demanded bits on unsized types 2017-08-16 16:09:22 +00:00
BranchFolding
CallSiteSplitting Recommit r317351 : Add CallSiteSplitting pass 2017-11-03 20:41:16 +00:00
CalledValuePropagation Add CalledValuePropagation pass 2017-10-25 13:40:08 +00:00
CodeExtractor [PartialInliner] Skip call sites where inlining fails. 2017-11-03 11:29:00 +00:00
CodeGenPrepare [CGP] Disable Select instruction handling in optimizeMemoryInst. NFC 2017-11-07 09:43:08 +00:00
ConstProp [X86] Replace 'REQUIRES: x86' in tests with 'REQUIRES: x86-registered-target' which seems to be the correct way to make them run on an x86 build. 2017-06-04 08:21:58 +00:00
ConstantHoisting Fix out-of-order stepping behavior in programs with hoisted constants. 2017-11-09 20:01:31 +00:00
ConstantMerge Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
Coroutines [coroutines] Add support for symmetric control transfer (musttail on coro.resumes followed by a suspend) 2017-08-25 02:25:10 +00:00
CorrelatedValuePropagation [CVP] Remove some {s|u}add.with.overflow checks. 2017-11-10 19:13:35 +00:00
CountingFunctionInserter
CrossDSOCFI [cfi] Build __cfi_check as Thumb when applicable. 2017-08-29 22:29:15 +00:00
DCE Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
DeadArgElim Remove the obsolete offset parameter from @llvm.dbg.value 2017-07-28 20:21:02 +00:00
DeadStoreElimination Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
DivRemPairs [DivRemPairs] split tests per target to account for bots that don't build for all targets 2017-09-09 14:10:59 +00:00
EarlyCSE Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
EliminateAvailableExternally
ExpandMemCmp/X86 re-land [ExpandMemCmp] Split ExpandMemCmp from CodeGen into its own pass." 2017-11-03 12:12:27 +00:00
Float2Int
ForcedFunctionAttrs
FunctionAttrs Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
FunctionImport Fix bot failures by requiring x86 target 2017-08-19 19:15:04 +00:00
GCOVProfiling Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
GVN [GVN PRE] Patch the source for Phi node in PRE 2017-11-09 06:02:18 +00:00
GVNHoist Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
GVNSink Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
GlobalDCE [PM] Teach the PGO instrumentation pasess to run GlobalDCE before 2017-05-25 07:15:09 +00:00
GlobalMerge Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
GlobalOpt Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
GlobalSplit
GuardWidening
IPConstantProp
IRCE [NFC] Get rid of hard-coded value ID in test 2017-11-03 07:30:45 +00:00
IndVarSimplify IndVarSimplify: preserve debug information attached to widened PHI nodes. 2017-11-02 23:17:06 +00:00
InferAddressSpaces InferAddressSpaces: Fix bug about replacing addrspacecast 2017-10-30 21:19:41 +00:00
InferFunctionAttrs Add argmononly attribute to strlen and wcslen, i.e. they only read memory (string) passed to them. 2017-06-18 03:10:26 +00:00
Inline Move verbosity check for remarks to the diag handler 2017-10-04 04:26:23 +00:00
InstCombine [InstCombine] Teach visitICmpInst to not break integer absolute value idioms 2017-11-12 02:28:21 +00:00
InstMerge
InstNamer Add basic test case for -instnamer 2017-05-08 23:18:46 +00:00
InstSimplify [ValueTracking] return zero when there's conflict in known bits of a shift (PR34838) 2017-10-12 17:31:46 +00:00
InterleavedAccess [X86][LLVM]Expanding Supports lowerInterleaved{store|load}() in X86InterleavedAccess (VF64 stride 3-4) 2017-10-02 07:35:25 +00:00
Internalize
JumpThreading Disable jump threading into loop headers 2017-09-06 19:36:58 +00:00
LCSSA
LICM Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
LoadStoreVectorizer Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
LoopDataPrefetch
LoopDeletion [Dominators] Teach LoopDeletion to use the new incremental API 2017-08-02 18:17:52 +00:00
LoopDistribute
LoopIdiom Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
LoopInterchange [LoopInterchange] Fix phi node ordering miscompile. 2017-10-21 13:58:37 +00:00
LoopLoadElim
LoopPredication [LoopPredication] Enable predication when latchCheckIV is wider than rangeCheck 2017-11-02 21:21:02 +00:00
LoopReroll Remove the obsolete offset parameter from @llvm.dbg.value 2017-07-28 20:21:02 +00:00
LoopRotate loop-rotate: avoid duplicating dbg.value intrinsics in the entry block. 2017-11-01 20:53:22 +00:00
LoopSimplify [SCEV] Teach SCEV to find maxBECount when loop endbound is variant 2017-10-13 14:30:43 +00:00
LoopSimplifyCFG
LoopStrengthReduce Revert r314886 "[X86] Improvement in CodeGen instruction selection for LEAs (re-applying post required revision changes.)" 2017-10-04 17:54:06 +00:00
LoopUnroll loop-unroll: teach remapInstruction to update dbg.value intrinsics. 2017-11-01 23:12:35 +00:00
LoopUnswitch [LoopUnswitch] Fix a simple bug which disables loop unswitch for select statement 2017-08-29 21:45:11 +00:00
LoopVectorize Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
LoopVersioning
LoopVersioningLICM
LowerAtomic LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020) 2017-08-23 15:43:28 +00:00
LowerExpectIntrinsic Fix builin_expect lowering bug 2017-06-07 18:32:24 +00:00
LowerGuardIntrinsic
LowerInvoke
LowerSwitch
LowerTypeTests [IPO/LowerTypesTest] Skip blockaddress(es) when replacing uses. 2017-11-07 00:09:25 +00:00
Mem2Reg Re-land r313825: "[IR] Add llvm.dbg.addr, a control-dependent version of llvm.dbg.declare" 2017-09-21 19:52:03 +00:00
MemCpyOpt Add address space mangling to lifetime intrinsics 2017-04-10 20:18:21 +00:00
MergeFunc [MergeFunctions] Merge small functions if possible without a thunk. 2017-10-15 12:29:09 +00:00
MergeICmps Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion." 2017-10-10 08:00:45 +00:00
MetaRenamer [MetaRenamer] Leave `@main` alone. 2017-08-01 05:14:45 +00:00
NameAnonGlobals
NaryReassociate
NewGVN Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
ObjCARC ObjCARC: do not increment past the end of the BB 2017-10-24 00:09:10 +00:00
PGOProfile [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local. 2017-11-04 17:04:39 +00:00
PartiallyInlineLibCalls [PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly check the function signature, and check TLI::has 2017-10-28 00:36:58 +00:00
PhaseOrdering [PassManager, SimplifyCFG] Revert r316908 and r316869. 2017-11-06 00:32:01 +00:00
PlaceSafepoints All libcalls should be considered to be GC-leaf functions. 2017-07-27 16:49:39 +00:00
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassociate] regenerate test checks; NFC 2017-11-09 22:41:39 +00:00
Reg2Mem
RewriteStatepointsForGC Strip off invariant.start because memory locations arent invariant 2017-11-02 18:24:04 +00:00
SCCP Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP. 2017-10-30 10:07:42 +00:00
SLPVectorizer [SLP] Fix PR23510: Try to find best possible vectorizable stores. 2017-11-09 19:07:16 +00:00
SROA Re-land r313825: "[IR] Add llvm.dbg.addr, a control-dependent version of llvm.dbg.declare" 2017-09-21 19:52:03 +00:00
SafeStack Parse and print DIExpressions inline to ease IR and MIR testing 2017-08-23 20:31:27 +00:00
SampleProfile Include already promoted counts when computing SUM for VP. 2017-11-06 19:52:49 +00:00
Scalarizer Remove the obsolete offset parameter from @llvm.dbg.value 2017-07-28 20:21:02 +00:00
SeparateConstOffsetFromGEP
SimpleLoopUnswitch [PM/Unswitch] Fix a bug in the domtree update logic for the new unswitch 2017-05-25 06:33:36 +00:00
SimplifyCFG [SimplifyCFG] Fix a test case. 2017-11-09 23:17:52 +00:00
Sink Enhance synchscope representation 2017-07-11 22:23:00 +00:00
SpeculativeExecution Revert r301950: SpeculativeExecution: Stop using whitelist for costs 2017-05-10 12:30:07 +00:00
StraightLineStrengthReduce
StripDeadPrototypes
StripSymbols Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
StructurizeCFG [Dominators] Include infinite loops in PostDominatorTree 2017-08-15 18:14:57 +00:00
TailCallElim [TRE] Add another test for OptRemark. 2017-07-19 21:39:51 +00:00
ThinLTOBitcodeWriter ModuleUtils: Stop using comdat members to generate unique module ids. 2017-10-05 21:54:53 +00:00
Util [InstCombine] Add a flag to disable LowerDbgDeclare 2017-09-13 01:43:25 +00:00
WholeProgramDevirt [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local. 2017-11-04 17:04:39 +00:00