llvm-project/llvm/lib/Target/AMDGPU
Tim Renouf ad8b7c1190 [AMDGPU] Fixed incorrect break from loop
Summary:
Lower control flow did not correctly handle the case that a loop break
in if/else was on a condition that was not guaranteed to be masked by
exec. The first test kernel shows an example of this going wrong; after
exiting the loop, exec is all ones, even if it was not before the loop.

The fix is for lowering of if-break and else-break to insert an
S_AND_B64 to mask the break condition with exec. This commit also
includes the optimization of not inserting that S_AND_B64 if it is
obviously not needed because the break condition is the result of a
V_CMP in the same basic block.

V2: Addressed some review comments.
V3: Test fixes.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits

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

Change-Id: I0fc56a01209a9e99d1d5c9b0ffd16f111caf200c
llvm-svn: 333258
2018-05-25 07:55:04 +00:00
..
AsmParser [AMDGPU] Added checks for dpp_ctrl value 2018-05-08 16:53:02 +00:00
Disassembler AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
InstPrinter [AMDGPU] Added checks for dpp_ctrl value 2018-05-08 16:53:02 +00:00
MCTargetDesc MC: Separate creating a generic object writer from creating a target object writer. NFCI. 2018-05-21 19:20:29 +00:00
TargetInfo Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
Utils AMDGPU : Recalculate SGPRs when trap handler is supported 2018-05-16 20:47:48 +00:00
AMDGPU.h AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPU.td AMDGPU: Make v2i16/v2f16 legal on VI 2018-05-22 06:32:10 +00:00
AMDGPUAliasAnalysis.cpp [AMDGPU] Change constant addr space to 4 2018-02-13 18:00:25 +00:00
AMDGPUAliasAnalysis.h
AMDGPUAlwaysInlinePass.cpp
AMDGPUAnnotateKernelFeatures.cpp
AMDGPUAnnotateUniformValues.cpp
AMDGPUArgumentUsageInfo.cpp
AMDGPUArgumentUsageInfo.h
AMDGPUAsmPrinter.cpp AMDGPU: Split R600 AsmPrinter code into its own class 2018-05-24 20:02:01 +00:00
AMDGPUAsmPrinter.h AMDGPU: Split R600 AsmPrinter code into its own class 2018-05-24 20:02:01 +00:00
AMDGPUCallLowering.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUCallLowering.h
AMDGPUCallingConv.td
AMDGPUCodeGenPrepare.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUFrameLowering.cpp
AMDGPUFrameLowering.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUGISel.td AMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI 2018-05-11 05:44:16 +00:00
AMDGPUGenRegisterBankInfo.def AMDGPU/GlobalISel: Use a more correct getValueMapping 2018-03-01 21:08:51 +00:00
AMDGPUISelDAGToDAG.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUISelLowering.cpp AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
AMDGPUISelLowering.h AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
AMDGPUInline.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
AMDGPUInstrInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUInstrInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUInstrInfo.td AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
AMDGPUInstructionSelector.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUInstructionSelector.h AMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI 2018-05-11 05:44:16 +00:00
AMDGPUInstructions.td [AMDGPU] Supported ds_write_b128 generation. 2018-03-16 18:12:00 +00:00
AMDGPUIntrinsicInfo.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUIntrinsicInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUIntrinsics.td AMDGPU: Remove deprecated llvm.AMDGPU.kilp intrinsic 2018-04-24 21:37:57 +00:00
AMDGPULegalizerInfo.cpp [IR][CodeGen] Remove dependency on EVT from IR/Function.cpp. Move EVT to CodeGen layer. 2018-03-29 17:21:10 +00:00
AMDGPULegalizerInfo.h AMDGPU/GlobalISel: Pass subtarget + TM to LegalizerInfo 2018-03-08 16:24:16 +00:00
AMDGPULibCalls.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
AMDGPULibFunc.cpp
AMDGPULibFunc.h
AMDGPULowerIntrinsics.cpp
AMDGPULowerKernelAttributes.cpp AMDGPU: Add pass to optimize reqd_work_group_size 2018-05-18 21:35:00 +00:00
AMDGPUMCInstLower.cpp AMDGPU: Remove AMDGPUMCInstLower.h 2018-05-25 04:57:02 +00:00
AMDGPUMachineCFGStructurizer.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
AMDGPUMachineFunction.cpp
AMDGPUMachineFunction.h [NFC] fix trivial typos in document and comments 2018-04-14 08:59:00 +00:00
AMDGPUMachineModuleInfo.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUMachineModuleInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUMacroFusion.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUMacroFusion.h
AMDGPUOpenCLEnqueuedBlockLowering.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
AMDGPUPTNote.h
AMDGPUPromoteAlloca.cpp AMDGPU/SI: Don't promote alloca to vector for atomic load/store 2018-05-17 21:49:44 +00:00
AMDGPURegAsmNames.inc.cpp
AMDGPURegisterBankInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPURegisterBankInfo.h AMDGPU/GlobalISel: Define instruction mapping for G_OR 2018-03-01 21:25:25 +00:00
AMDGPURegisterBanks.td AMDGPU/GlobalISel: Define InstrMappings for G_ICMP 2018-03-01 19:27:10 +00:00
AMDGPURegisterInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPURegisterInfo.h AMDGPU: Make getSubRegFromChannel a static member of AMDGPURegisterInfo 2018-05-03 22:38:06 +00:00
AMDGPURegisterInfo.td
AMDGPURewriteOutArguments.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
AMDGPUSearchableTables.td AMDGPU: Dimension-aware image intrinsics 2018-04-04 10:58:54 +00:00
AMDGPUSubtarget.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUSubtarget.h AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUTargetMachine.cpp AMDGPU: Add pass to optimize reqd_work_group_size 2018-05-18 21:35:00 +00:00
AMDGPUTargetMachine.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUTargetObjectFile.cpp
AMDGPUTargetObjectFile.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDGPUTargetTransformInfo.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
AMDGPUTargetTransformInfo.h AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDGPUUnifyDivergentExitNodes.cpp AMDGPU/SI: Handle infinite loop for the structurizer to work with CFG with infinite loops. 2018-05-17 16:45:01 +00:00
AMDGPUUnifyMetadata.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AMDILCFGStructurizer.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
AMDKernelCodeT.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
BUFInstructions.td AMDGPU: Make v2i16/v2f16 legal on VI 2018-05-22 06:32:10 +00:00
CMakeLists.txt AMDGPU: Split R600 AsmPrinter code into its own class 2018-05-24 20:02:01 +00:00
CaymanInstructions.td
DSInstructions.td AMDGPU: Add D16 instructions preserve unused bits feature 2018-05-04 20:06:57 +00:00
EvergreenInstructions.td AMDGPU: Select BFI patterns with 64-bit ints 2018-02-07 00:21:34 +00:00
FLATInstructions.td AMDGPU: Add D16 instructions preserve unused bits feature 2018-05-04 20:06:57 +00:00
GCNHazardRecognizer.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
GCNHazardRecognizer.h
GCNILPSched.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
GCNIterativeScheduler.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
GCNIterativeScheduler.h
GCNMinRegStrategy.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
GCNProcessors.td AMDGPU: Add Vega12 and Vega20 2018-04-30 19:08:16 +00:00
GCNRegPressure.cpp [DebugInfo] Examine all uses of isDebugValue() for debug instructions. 2018-05-09 02:42:00 +00:00
GCNRegPressure.h
GCNSchedStrategy.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
GCNSchedStrategy.h
LLVMBuild.txt
MIMGInstructions.td AMDGPU: Make v2i16/v2f16 legal on VI 2018-05-22 06:32:10 +00:00
R600AsmPrinter.cpp AMDGPU: Split R600 AsmPrinter code into its own class 2018-05-24 20:02:01 +00:00
R600AsmPrinter.h AMDGPU: Split R600 AsmPrinter code into its own class 2018-05-24 20:02:01 +00:00
R600ClauseMergePass.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600ControlFlowFinalizer.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600Defines.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
R600EmitClauseMarkers.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600ExpandSpecialInstrs.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600FrameLowering.cpp
R600FrameLowering.h
R600ISelLowering.cpp AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
R600ISelLowering.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
R600InstrFormats.td
R600InstrInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600InstrInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
R600Instructions.td AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
R600Intrinsics.td AMDGPU/R600: Move int_r600_store_stream_output to the public intrinsic file 2018-04-25 20:02:53 +00:00
R600MachineFunctionInfo.cpp
R600MachineFunctionInfo.h
R600MachineScheduler.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600MachineScheduler.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
R600OpenCLImageTypeLoweringPass.cpp AMDGPU: Rename OpenCL lowering pass to be R600 specific. 2018-05-13 10:04:48 +00:00
R600OptimizeVectorRegisters.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600Packetizer.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600Processors.td
R600RegisterInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
R600RegisterInfo.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
R600RegisterInfo.td
R600Schedule.td
R700Instructions.td
SIAnnotateControlFlow.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
SIDebuggerInsertNops.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIDefines.h [AMDGPU] Added checks for dpp_ctrl value 2018-05-08 16:53:02 +00:00
SIFixSGPRCopies.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIFixVGPRCopies.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIFixWWMLiveness.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIFoldOperands.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIFrameLowering.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIFrameLowering.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
SIISelLowering.cpp AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
SIISelLowering.h AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
SIInsertSkips.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIInsertWaitcnts.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
SIInstrFormats.td [MachineOperand][Target] MachineOperand::isRenamable semantics changes 2018-02-23 18:25:08 +00:00
SIInstrInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIInstrInfo.h AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIInstrInfo.td AMDGPU/R600: Remove code for handling AMDGPUISD::CLAMP 2018-05-24 05:28:34 +00:00
SIInstructions.td AMDGPU: Fix v2f16 fneg/fabs pattern 2018-05-22 20:13:34 +00:00
SIIntrinsics.td
SILoadStoreOptimizer.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SILowerControlFlow.cpp [AMDGPU] Fixed incorrect break from loop 2018-05-25 07:55:04 +00:00
SILowerI1Copies.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIMachineFunctionInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIMachineFunctionInfo.h AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIMachineScheduler.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIMachineScheduler.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
SIMemoryLegalizer.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIOptimizeExecMasking.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIOptimizeExecMaskingPreRA.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIPeepholeSDWA.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIRegisterInfo.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIRegisterInfo.h AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SIRegisterInfo.td
SISchedule.td [SchedModel] Complete models shouldn't match against itineraries when they don't use them (PR35639) 2018-04-05 13:11:36 +00:00
SIShrinkInstructions.cpp AMDGPU: Remove AMDGPUMCInstLower.h 2018-05-25 04:57:02 +00:00
SIWholeQuadMode.cpp AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers 2018-05-22 02:03:23 +00:00
SMInstructions.td [AMDGPU][MC][VI][GFX9] Added s_atc_probe* instructions 2018-04-06 15:48:39 +00:00
SOPInstructions.td [AMDGPU][MC][GFX9] Added instructions s_mul_hi_*32, s_lshl*_add_u32 2018-04-09 13:10:33 +00:00
VIInstrFormats.td
VIInstructions.td
VOP1Instructions.td [AMDGPU][MC][GFX9] Added v_screen_partition_4se_b32 2018-04-11 13:13:30 +00:00
VOP2Instructions.td AMDGPU: Add Vega12 and Vega20 2018-04-30 19:08:16 +00:00
VOP3Instructions.td AMDGPU: Fix v_dot{4, 8}* instruction encoding 2018-05-15 19:32:47 +00:00
VOP3PInstructions.td AMDGPU: Fix v_dot{4, 8}* instruction encoding 2018-05-15 19:32:47 +00:00
VOPCInstructions.td [AMDGPU][MC] Corrected default values for unused SDWA operands 2018-03-16 15:40:27 +00:00
VOPInstructions.td AMDGPU: Introduce common SOP_Pseudo and VOP_Pseudo TableGen base classes 2018-03-26 13:56:53 +00:00