aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2020-08-28 19:51:33 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2020-09-11 18:03:04 -0400
commite21bb31eb6c6fcff652ecfb338e8558362473150 (patch)
tree081362b670d684e686fa80e6934c8923e0d7b9e3
parentee13ae030e21d584c72d384ea463896400ccee1c (diff)
downloadllvm-e21bb31eb6c6fcff652ecfb338e8558362473150.zip
llvm-e21bb31eb6c6fcff652ecfb338e8558362473150.tar.gz
llvm-e21bb31eb6c6fcff652ecfb338e8558362473150.tar.bz2
CodeGen: Require SSA to run PeepholeOptimizer
-rw-r--r--llvm/lib/CodeGen/PeepholeOptimizer.cpp5
-rw-r--r--llvm/test/CodeGen/AMDGPU/fold_16bit_imm.mir180
2 files changed, 5 insertions, 180 deletions
diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
index 05c8430..ed2a50e 100644
--- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp
+++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
@@ -178,6 +178,11 @@ namespace {
}
}
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties()
+ .set(MachineFunctionProperties::Property::IsSSA);
+ }
+
/// Track Def -> Use info used for rewriting copies.
using RewriteMapTy = SmallDenseMap<RegSubRegPair, ValueTrackerResult>;
diff --git a/llvm/test/CodeGen/AMDGPU/fold_16bit_imm.mir b/llvm/test/CodeGen/AMDGPU/fold_16bit_imm.mir
index 458bdce..eae7e48 100644
--- a/llvm/test/CodeGen/AMDGPU/fold_16bit_imm.mir
+++ b/llvm/test/CodeGen/AMDGPU/fold_16bit_imm.mir
@@ -17,21 +17,6 @@ body: |
...
---
-name: fold_simm_16_sub_to_sub
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_simm_16_sub_to_sub
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: SI_RETURN_TO_EPILOG [[S_MOV_B32_1]]
- %0:sreg_32 = S_MOV_B32 2048
- %1.lo16:sreg_32 = COPY killed %0.lo16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
name: fold_simm_16_sub_to_phys
body: |
bb.0:
@@ -47,36 +32,6 @@ body: |
...
---
-name: fold_aimm_16_sub_to_sub_2048
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_aimm_16_sub_to_sub_2048
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: %1.lo16:agpr_32 = COPY killed [[S_MOV_B32_]].lo16
- ; GCN: SI_RETURN_TO_EPILOG %1
- %0:sreg_32 = S_MOV_B32 2048
- %1.lo16:agpr_32 = COPY killed %0.lo16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_aimm_16_sub_to_sub_0
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_aimm_16_sub_to_sub_0
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 0
- ; GCN: [[V_ACCVGPR_WRITE_B32_:%[0-9]+]]:agpr_32 = V_ACCVGPR_WRITE_B32 0, implicit $exec
- ; GCN: SI_RETURN_TO_EPILOG [[V_ACCVGPR_WRITE_B32_]]
- %0:sreg_32 = S_MOV_B32 0
- %1.lo16:agpr_32 = COPY killed %0.lo16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
name: fold_aimm_16_sub_to_phys
body: |
bb.0:
@@ -107,21 +62,6 @@ body: |
...
---
-name: fold_vimm_16_sub_to_sub
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_vimm_16_sub_to_sub
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: %1.lo16:vgpr_32 = COPY killed [[S_MOV_B32_]].lo16
- ; GCN: SI_RETURN_TO_EPILOG %1
- %0:sreg_32 = S_MOV_B32 2048
- %1.lo16:vgpr_32 = COPY killed %0.lo16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
name: fold_vimm_16_sub_to_phys
body: |
bb.0:
@@ -135,123 +75,3 @@ body: |
SI_RETURN_TO_EPILOG $vgpr0_lo16
...
-
----
-name: fold_vimm_16_lo_to_hi
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_vimm_16_lo_to_hi
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: %1.hi16:vgpr_32 = COPY killed [[S_MOV_B32_]].lo16
- ; GCN: SI_RETURN_TO_EPILOG %1
- %0:sreg_32 = S_MOV_B32 2048
- %1.hi16:vgpr_32 = COPY killed %0.lo16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_vimm_16_hi_to_lo
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_vimm_16_hi_to_lo
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: %1.lo16:vgpr_32 = COPY killed [[S_MOV_B32_]].hi16
- ; GCN: SI_RETURN_TO_EPILOG %1
- %0:sreg_32 = S_MOV_B32 2048
- %1.lo16:vgpr_32 = COPY killed %0.hi16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_simm_16_sub_to_sub_lo_to_hi
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_simm_16_sub_to_sub_lo_to_hi
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: %1.hi16:sreg_32 = COPY killed [[S_MOV_B32_]].lo16
- ; GCN: SI_RETURN_TO_EPILOG %1
- %0:sreg_32 = S_MOV_B32 2048
- %1.hi16:sreg_32 = COPY killed %0.lo16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_simm_16_sub_to_sub_hi_to_lo_2048
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_simm_16_sub_to_sub_hi_to_lo_2048
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 0
- ; GCN: SI_RETURN_TO_EPILOG [[S_MOV_B32_1]]
- %0:sreg_32 = S_MOV_B32 2048
- %1.lo16:sreg_32 = COPY killed %0.hi16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_simm_16_sub_to_sub_hi_to_lo_shifted_2048
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_simm_16_sub_to_sub_hi_to_lo_shifted_2048
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 134217728
- ; GCN: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: SI_RETURN_TO_EPILOG [[S_MOV_B32_1]]
- %0:sreg_32 = S_MOV_B32 134217728
- %1.lo16:sreg_32 = COPY killed %0.hi16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_aimm_16_sub_to_sub_hi_to_lo_2048
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_aimm_16_sub_to_sub_hi_to_lo_2048
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2048
- ; GCN: [[V_ACCVGPR_WRITE_B32_:%[0-9]+]]:agpr_32 = V_ACCVGPR_WRITE_B32 0, implicit $exec
- ; GCN: SI_RETURN_TO_EPILOG [[V_ACCVGPR_WRITE_B32_]]
- %0:sreg_32 = S_MOV_B32 2048
- %1.lo16:agpr_32 = COPY killed %0.hi16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_aimm_16_sub_to_sub_hi_to_lo_shifted_1
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_aimm_16_sub_to_sub_hi_to_lo_shifted_1
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 65536
- ; GCN: [[V_ACCVGPR_WRITE_B32_:%[0-9]+]]:agpr_32 = V_ACCVGPR_WRITE_B32 1, implicit $exec
- ; GCN: SI_RETURN_TO_EPILOG [[V_ACCVGPR_WRITE_B32_]]
- %0:sreg_32 = S_MOV_B32 65536
- %1.lo16:agpr_32 = COPY killed %0.hi16
- SI_RETURN_TO_EPILOG %1
-
-...
-
----
-name: fold_aimm_16_sub_to_sub_hi_to_lo_shifted_2048
-body: |
- bb.0:
-
- ; GCN-LABEL: name: fold_aimm_16_sub_to_sub_hi_to_lo_shifted_2048
- ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 134217728
- ; GCN: %1.lo16:agpr_32 = COPY killed [[S_MOV_B32_]].hi16
- ; GCN: SI_RETURN_TO_EPILOG %1
- %0:sreg_32 = S_MOV_B32 134217728
- %1.lo16:agpr_32 = COPY killed %0.hi16
- SI_RETURN_TO_EPILOG %1
-
-...