[PATCH] D14122: [SimplifyCFG] Trim duplicate basic blocks in switch cases

Dylan McKay via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 21:50:10 PDT 2015


dylanmckay added a comment.

The problem is that they are doing something akin to this:

  define void @foo() {
      switch i32 %val, label %join [
          ; CHECK_NEXT: match_1
          i32 1, label %match_1
          ; CHECK_NEXT: match_2
          i32 2, label %match_2
          ; CHECK_NEXT: match_3
          i32 3, label %match_3
      ]
      match_1: br label %join
      match_2: br label %join
      match_3: br label %join
  
      join:
          ret void
  }

They are hardcoding names of basic blocks, which this optimization mangles, so for example, all match arms would be optimized to `match_1`.

We could use LIT's regexps to fix this (that's my only idea) - there are only three tests which fail because of this:

LLVM :: Transforms/SimplifyCFG/CoveredLookupTable.ll
LLVM :: Transforms/SimplifyCFG/X86/switch-table-bug.ll
LLVM :: Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll


http://reviews.llvm.org/D14122





More information about the llvm-commits mailing list