[PATCH] D44410: [GlobalISel] Zero extend booleans during legalize

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 19:24:57 PDT 2018


mgrang added a comment.

Here's the test case which fails:

  cat a.mir
  --- |
    target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
    target triple = "aarch64--"
    define void @test_constant() {
    entry:
      ret void
    }
  ...
  ---
  name:            test_constant
  registers:
    - { id: 0, class: _ }
  body: |
    bb.0.entry:
      %0:_(s1) = G_CONSTANT i1 1
      %1:_(s32) = COPY %0(s1)



  llc -O0 -run-pass=legalizer a.mir -o -
  
  bb.0.entry:
      %2:_(s32) = G_CONSTANT i32 -1
      %0:_(s1) = G_TRUNC %2(s32)
      %1:_(s32) = COPY %0(s1)

MachineIRBuilder.cpp was the only place I could find to intercept the boolean val and zext it. Please let me know if this isn't the proper place to fix this.


Repository:
  rL LLVM

https://reviews.llvm.org/D44410





More information about the llvm-commits mailing list