[llvm] 264c07e - [llvm][MIRVRegNamer] Avoid collisions across jump table indices.
Puyan Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 22 11:59:40 PDT 2020
Author: Puyan Lotfi
Date: 2020-04-22T14:58:44-04:00
New Revision: 264c07ef77667d5c90a75e95cc71c370afb86083
URL: https://github.com/llvm/llvm-project/commit/264c07ef77667d5c90a75e95cc71c370afb86083
DIFF: https://github.com/llvm/llvm-project/commit/264c07ef77667d5c90a75e95cc71c370afb86083.diff
LOG: [llvm][MIRVRegNamer] Avoid collisions across jump table indices.
Hash Jump Table Indices uniquely within a basic block for MIR
Canonicalizer / MIR VReg Renamer passes.
Differential Revision: https://reviews.llvm.org/D77966
Added:
llvm/test/CodeGen/MIR/AArch64/mir-canon-jump-table.mir
Modified:
llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
index 9b45a0d5669f..54441301d65b 100644
--- a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
+++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
@@ -72,6 +72,7 @@ std::string VRegRenamer::getInstructionOpcodeHash(MachineInstr &MI) {
return MO.getOffset() | (MO.getTargetFlags() << 16);
case MachineOperand::MO_FrameIndex:
case MachineOperand::MO_ConstantPoolIndex:
+ case MachineOperand::MO_JumpTableIndex:
return llvm::hash_value(MO);
// We could explicitly handle all the types of the MachineOperand,
@@ -82,7 +83,6 @@ std::string VRegRenamer::getInstructionOpcodeHash(MachineInstr &MI) {
// TODO: Handle the following Index/ID/Predicate cases. They can
// be hashed on in a stable manner.
- case MachineOperand::MO_JumpTableIndex:
case MachineOperand::MO_CFIIndex:
case MachineOperand::MO_IntrinsicID:
case MachineOperand::MO_Predicate:
diff --git a/llvm/test/CodeGen/MIR/AArch64/mir-canon-jump-table.mir b/llvm/test/CodeGen/MIR/AArch64/mir-canon-jump-table.mir
new file mode 100644
index 000000000000..dbb6b62b68bb
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/AArch64/mir-canon-jump-table.mir
@@ -0,0 +1,33 @@
+# RUN: llc -run-pass mir-canonicalizer -verify-machineinstrs -mtriple aarch64-unknown-linux-gnu -o - %s | FileCheck %s
+...
+---
+name: foo
+alignment: 16
+jumpTable:
+ kind: block-address
+ entries:
+ - id: 0
+ blocks: [ '%bb.0', '%bb.1']
+ - id: 1
+ blocks: [ '%bb.2', '%bb.3' ]
+ - id: 2
+ blocks: [ '%bb.3', '%bb.7']
+ - id: 3
+ blocks: [ '%bb.2', '%bb.3' ]
+body: |
+ bb.0:
+ bb.1:
+ bb.2:
+ bb.3:
+ bb.7:
+ ;CHECK: %bb{{[0-9]+}}_{{[0-9]+}}__1:_(p0) = G_JUMP_TABLE %jump-table.0
+ ;CHECK: %bb{{[0-9]+}}_{{[0-9]+}}__1:_(p0) = G_JUMP_TABLE %jump-table.1
+ ;CHECK: %bb{{[0-9]+}}_{{[0-9]+}}__1:_(p0) = G_JUMP_TABLE %jump-table.2
+ ;CHECK: %bb{{[0-9]+}}_{{[0-9]+}}__1:_(p0) = G_JUMP_TABLE %jump-table.3
+ %a:_(p0) = G_JUMP_TABLE %jump-table.0
+ %b:_(p0) = G_JUMP_TABLE %jump-table.1
+ %c:_(p0) = G_JUMP_TABLE %jump-table.2
+ %d:_(p0) = G_JUMP_TABLE %jump-table.3
+
+...
+
More information about the llvm-commits
mailing list