llvm-project/llvm/test/Transforms
Sanjay Patel 0ed9aeaa5f [CGP] widen switch condition and case constants to target's register width (2nd try)
This is a redo of r251849 except the tests have been split into arch-specific folders
to hopefully make the bots happy.

This is a follow-up from the discussion in D12965. The block-at-a-time limitation of
SelectionDAG also came up in D13297.

Without the InstCombine change from D12965, I don't expect this patch to make any
difference in the real world because InstCombine does not shrink cases like this in
visitSwitchInst(). But we need to have this CGP safety harness in place before
proceeding with any shrinkage in D12965, so we won't generate extra extends for compares.

I've opted for IR regression tests in the patch because that seems like a clearer way to
test the transform, but PowerPC CodeGen for an i16 widening test is shown below. x86
will need more work to solve: https://llvm.org/bugs/show_bug.cgi?id=22473

Before:
BB#0:
  mr 4, 3
  extsh. 3, 4
  ble 0, .LBB0_5
 BB#1:
  cmpwi  3, 99
  bgt    0, .LBB0_9
 BB#2:
  rlwinm 4, 4, 0, 16, 31      <--- 32-bit mask/extend
  li 3, 0
  cmplwi         4, 1
  beqlr 0
 BB#3:
  cmplwi         4, 10
  bne    0, .LBB0_12
 BB#4:
  li 3, 1
  blr
.LBB0_5:
  rlwinm 3, 4, 0, 16, 31      <--- 32-bit mask/extend
  cmplwi         3, 65436
  beq    0, .LBB0_13
 BB#6:
  cmplwi         3, 65526
  beq    0, .LBB0_15
 BB#7:
  cmplwi         3, 65535
  bne    0, .LBB0_12
 BB#8:
  li 3, 4
  blr
.LBB0_9:
  rlwinm 3, 4, 0, 16, 31      <--- 32-bit mask/extend
  cmplwi         3, 100
  beq    0, .LBB0_14
...

After:
BB#0:
  rlwinm 4, 3, 0, 16, 31      <--- mask/extend to 32-bit and then use that for comparisons
  cmpwi  4, 999
  ble 0, .LBB0_5
 BB#1:
  lis 3, 0
  ori 3, 3, 65525
  cmpw   4, 3
  bgt    0, .LBB0_9
 BB#2:
  cmplwi         4, 1000
  beq    0, .LBB0_14
 BB#3:
  cmplwi         4, 65436
  bne    0, .LBB0_13
 BB#4:
  li 3, 6
  blr
.LBB0_5:
  li 3, 0
  cmplwi         4, 1
  beqlr 0
 BB#6:
  cmplwi         4, 10
  beq    0, .LBB0_12
 BB#7:
  cmplwi         4, 100
  bne    0, .LBB0_13
 BB#8:
  li 3, 2
  blr
.LBB0_9:
  cmplwi         4, 65526
  beq    0, .LBB0_15
 BB#10:
  cmplwi         4, 65535
  bne    0, .LBB0_13
...


Differential Revision: http://reviews.llvm.org/D13532

llvm-svn: 251857
2015-11-02 23:22:49 +00:00
..
ADCE [PM] Port ADCE to the new pass manager 2015-10-30 23:13:18 +00:00
AddDiscriminators Recommit r251680 (also need to update clang test) 2015-10-30 05:07:15 +00:00
AlignmentFromAssumptions [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
ArgumentPromotion DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
AtomicExpand [ARM] Emit clrex in the expanded cmpxchg fail block. 2015-09-22 17:22:58 +00:00
BBVectorize [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
BDCE Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
BranchFolding Make the default triple optional by allowing an empty string 2015-09-16 05:34:32 +00:00
CodeExtractor Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
CodeGenPrepare [CGP] widen switch condition and case constants to target's register width (2nd try) 2015-11-02 23:22:49 +00:00
ConstProp [test] (NFC) Simplify Transforms/ConstProp/calls.ll 2015-08-28 18:04:20 +00:00
ConstantHoisting [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
ConstantMerge [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
CorrelatedValuePropagation [LVI/CVP] Teach LVI about range metadata 2015-10-29 03:57:17 +00:00
DeadArgElim [DeadArgElim] Split the invoke successor edge 2015-09-23 15:41:09 +00:00
DeadStoreElimination [DeadStoreElimination] Remove dead zero store to calloc initialized memory 2015-09-23 11:38:44 +00:00
EarlyCSE [EarlyCSE] Fix handling of target memory intrinsics for CSE'ing loads. 2015-10-07 07:41:29 +00:00
EliminateAvailableExternally Don't change the visibility when converting a definition to a declaration. 2015-07-13 14:18:22 +00:00
Float2Int Reapply r233175 and r233183: float2int. 2015-03-27 10:36:57 +00:00
FunctionAttrs [FunctionAttr] Infer nonnull attributes on returns 2015-08-31 19:44:38 +00:00
GCOVProfiling DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
GVN [GVN] Make a test case more robust 2015-10-28 03:20:05 +00:00
GlobalDCE [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
GlobalOpt GlobalOpt does not treat externally_initialized globals correctly 2015-10-12 13:20:52 +00:00
IPConstantProp Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
IRCE [IRCE] Fix a regression introduced in r232444. 2015-03-24 19:29:18 +00:00
IndVarSimplify [IndVarSimplify] Rewrite loop exit values with their initial values from loop preheader 2015-11-02 22:00:15 +00:00
Inline [InlineFunction] Correctly inline TerminatePadInst 2015-10-13 22:08:17 +00:00
InstCombine TvOS: add missing support for some libcalls. 2015-11-02 18:00:00 +00:00
InstMerge [opaque pointer type] Add textual IR support for explicit type parameter to gep operator 2015-03-13 18:20:45 +00:00
InstSimplify [InstSimplify] sgt on i1s also encodes implication 2015-10-29 03:19:10 +00:00
Internalize [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
JumpThreading [JumpThreading] Use dominating conditions to prove implications 2015-10-28 21:27:08 +00:00
LCSSA Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
LICM Revert "r251451 - [AliasSetTracker] Use mod/ref information for UnknownInstr" 2015-10-28 22:13:41 +00:00
LoadCombine [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
LoopDeletion [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
LoopDistribute [LAA] Hold bounds via ValueHandles during SCEV expansion 2015-08-21 23:19:57 +00:00
LoopIdiom Reapply: [LIR] Add support for creating memsets from loops with a negative stride. 2015-10-28 14:38:49 +00:00
LoopInterchange Add support to interchange loops with reductions. 2015-04-23 04:51:44 +00:00
LoopReroll [LoopReroll] Ignore debug intrinsics 2015-09-28 17:03:23 +00:00
LoopRotate DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
LoopSimplify DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
LoopStrengthReduce [ScalarEvolutionExpander] PHI on a catchpad can be used on both edges 2015-10-27 19:48:28 +00:00
LoopUnroll [IndVarSimplify] Rewrite loop exit values with their initial values from loop preheader 2015-11-02 22:00:15 +00:00
LoopUnswitch Teach LoopUnswitch not to perform non-trivial unswitching on loops containing convergent operations. 2015-10-09 18:40:20 +00:00
LoopVectorize Add a flag vectorizer-maximize-bandwidth in loop vectorizer to enable using larger vectorization factor. 2015-11-02 22:53:48 +00:00
LowerAtomic [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
LowerBitSets [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
LowerExpectIntrinsic [PM] Port StripDeadPrototypes to the new pass manager 2015-10-30 23:28:12 +00:00
LowerInvoke Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
LowerSwitch [LowerSwitch] Fix a bug when LowerSwitch deletes the default block 2015-08-11 18:12:26 +00:00
Mem2Reg DI: Update tests before adding !dbg subprogram attachments 2015-08-28 23:32:00 +00:00
MemCpyOpt [MemCpyOpt] Fix wrong merging adjacent nontemporal stores into memset calls. 2015-10-09 10:53:41 +00:00
MergeFunc MergeFunctions: Clear GlobalNumbers ValueMap 2015-10-05 17:26:36 +00:00
MetaRenamer [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
NaryReassociate [NaryReassociate] SeenExprs records WeakVH 2015-10-01 03:51:44 +00:00
ObjCARC [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
PartiallyInlineLibCalls
PhaseOrdering Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
PlaceSafepoints [PlaceSafepoints] Make the width of a counted loop settable. 2015-09-15 01:42:48 +00:00
PruneEH [PruneEH] A naked, noinline function can return via InlineAsm 2015-06-27 07:52:53 +00:00
Reassociate Fix a bunch of trivial cases of 'CHECK[^:]*$' in the tests. NFCI 2015-08-10 19:01:27 +00:00
Reg2Mem Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
RewriteStatepointsForGC [RS4GC] Strip noalias attribute after statepoint rewrite 2015-10-26 19:06:01 +00:00
SCCP [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
SLPVectorizer [SLP] Be more aggressive about reduction width selection. 2015-10-27 17:59:03 +00:00
SROA [PM] Port SROA to the new pass manager. 2015-09-12 09:09:14 +00:00
SafeStack [safestack] Fast access to the unsafe stack pointer on AArch64/Android. 2015-10-26 18:28:25 +00:00
SampleProfile SamplePGO - Count sample records in embedded profiles when computing coverage. 2015-10-31 21:53:58 +00:00
ScalarRepl DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
Scalarizer DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
SeparateConstOffsetFromGEP [SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow. 2015-08-14 02:02:05 +00:00
SimplifyCFG Preserve load alignment and dereferenceable metadata during some transformations 2015-11-02 17:53:51 +00:00
Sink Teach the IR Sink pass to (conservatively) respect convergent annotations. 2015-06-01 17:20:31 +00:00
SpeculativeExecution Add a speculative execution pass 2015-05-15 17:54:48 +00:00
StraightLineStrengthReduce [SeparateConstOffsetFromGEP] strengthen the inbounds attribute 2015-08-13 18:48:49 +00:00
StripDeadPrototypes [PM] Port StripDeadPrototypes to the new pass manager 2015-10-30 23:28:12 +00:00
StripSymbols DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
StructurizeCFG Fix CHECK directives that weren't checking. 2015-08-31 21:10:35 +00:00
TailCallElim Fix a bunch of trivial cases of 'CHECK[^:]*$' in the tests. NFCI 2015-08-10 19:01:27 +00:00
TailDup [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
Util Changed renaming of local symbols by inserting a dot vefore the numeric suffix. 2015-05-12 16:47:30 +00:00