[PATCH] D74449: [llvm][MIR-Canon] Adding support for avoiding collisions across constant pool indices.

Puyan Lotfi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 00:09:49 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4b8af31f6346: [llvm][MIRVRegNamer] Avoid collisions across constant pool indices. (authored by plotfi).

Changed prior to commit:
  https://reviews.llvm.org/D74449?vs=244027&id=249281#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74449/new/

https://reviews.llvm.org/D74449

Files:
  llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
  llvm/test/CodeGen/MIR/AArch64/mir-canon-constant-pool-hash.mir


Index: llvm/test/CodeGen/MIR/AArch64/mir-canon-constant-pool-hash.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/MIR/AArch64/mir-canon-constant-pool-hash.mir
@@ -0,0 +1,20 @@
+# RUN: llc -o - -run-pass mir-canonicalizer -verify-machineinstrs %s | FileCheck %s
+--- |
+  target triple = "aarch64-unknown-unknown"
+  define void @f() { unreachable }
+...
+---
+name: f
+constants:
+  - id:              0
+    value:           '<1 x i8> <i8 0>'
+  - id:              1
+    value:           '<1 x i8> <i8 1>'
+body: |
+  bb.0:
+    ; Test that we no longer have hash collisions between two different consts:
+    ;CHECK: %bb{{[0-9]+}}_{{[0-9]+}}__1:gpr64common = ADR
+    ;CHECK: %bb{{[0-9]+}}_{{[0-9]+}}__1:gpr64common = ADR
+    %vreg0:gpr64common = ADRP target-flags(aarch64-page) %const.0
+    %vreg1:gpr64common = ADRP target-flags(aarch64-page) %const.1
+...
Index: llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
===================================================================
--- llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
+++ llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
@@ -69,6 +69,7 @@
     case MachineOperand::MO_TargetIndex:
       return MO.getOffset() | (MO.getTargetFlags() << 16);
     case MachineOperand::MO_FrameIndex:
+    case MachineOperand::MO_ConstantPoolIndex:
       return llvm::hash_value(MO);
 
     // We could explicitly handle all the types of the MachineOperand,
@@ -79,7 +80,6 @@
 
     // TODO: Handle the following Index/ID/Predicate cases. They can
     // be hashed on in a stable manner.
-    case MachineOperand::MO_ConstantPoolIndex:
     case MachineOperand::MO_JumpTableIndex:
     case MachineOperand::MO_CFIIndex:
     case MachineOperand::MO_IntrinsicID:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74449.249281.patch
Type: text/x-patch
Size: 1748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200310/b68addca/attachment.bin>


More information about the llvm-commits mailing list