[PATCH] D63174: [clang][NewPM] Add RUNS for tests that produce slightly different IR under new PM

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 19:02:58 PDT 2019


leonardchan added a comment.

OK so I instead wrote a script that generated the tests for me since changing each individual case by hand was painful. All the `-cc1` tests now match, although I don't know any ways of simplifying the IR further to help reduce test size. I would definitely love to know if there are any ways to simplify the instructions. Unfortunately for `convergent.cl`, the codegen still differs slightly around the end of the loop when using `-instcombine` in addition to `instnamer`:

  < for.body:                                         ; preds = %for.body, %entry
  <   %i.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
  ---
  > for.body:                                         ; preds = %for.body.for.body_crit_edge, %entry
  >   %inc.phi = phi i32 [ 1, %entry ], [ %inc.1, %for.body.for.body_crit_edge ]
  92,94c92,97
  <   %inc = add nuw nsw i32 %i.03, 1
  <   %cmp = icmp ult i32 %inc, 10
  <   br i1 %cmp, label %for.body, label %for.cond.cleanup
  ---
  >   %cmp = icmp ult i32 %inc.phi, 10
  >   br i1 %cmp, label %for.body.for.body_crit_edge, label %for.cond.cleanup
  > 
  > for.body.for.body_crit_edge:                      ; preds = %for.body
  >   %inc.1 = add nuw nsw i32 %inc.phi, 1
  >   br label %for.body

Also adding @craig.topper in case he as any insight on the updated tests.



================
Comment at: clang/test/CodeGenOpenCL/convergent.cl:2
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - -fno-experimental-new-pass-manager | opt -instnamer -S | FileCheck -enable-var-scope %s --check-prefixes=CHECK,CHECK-LEGACY
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - -fexperimental-new-pass-manager | opt -instnamer -S | FileCheck -enable-var-scope %s --check-prefixes=CHECK,CHECK-NEWPM
 
----------------
chandlerc wrote:
> Probably want to use `opt -passes=instnamer` or some such to use the new PM in the `opt` invocation as well...
Unfortunately there doesn't seem to be a new PM equivalent for `instnamer` (but one does exist for `instcombine`). For simplicity, should we stick with using the legacy driver for now?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63174





More information about the cfe-commits mailing list