[PATCH] D31676: [SelectionDAG] [ARM CodeGen] Fix chain information of LowerMUL

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 15:16:54 PDT 2017


huihuiz added a comment.

Hey James,

1. In SkipLoadExtensionForVMULL, the creation of zextload/sextload is skipped when the original Load is already 64 bit vector. In both test cases, the original Load is <4 x i16>, later on sext to <4 x i32>.

More clear in the debug output of "llc -mcpu=krait -debug-only=isel,dagcombine lowerMUL-newloal.ll", the original load "t11: v4i16,ch = load<LD8[%vector_ptr0]> t0, t8, undef:i32" and "t27: v4i32 = sign_extend t11" are combined to "t37: v4i32,ch = load<LD8[%vector_ptr0], sext from v4i16> t0, t8, undef:i32"

The Load returned by SkipLoadExtensionForVMULL has the original Load's MemoryVT "v4i16,ch = load<LD8[%vector_ptr0]> t0, t8, undef:i32", not the sext load needed. Because the original Load already has the right type 64bits.

2. For the new created Load, both the chain information and value need to be updated. Especially for cases when there are multiple uses of the original Load.

See test case func2. 
a[i] = b[i] + a[i] * c[i] + a[i];
There are two uses of a[i], one for "a[i]"*c[i], the other for b[i]+a[i]*c[i] + "a[i]", of the same load a[i]

When updating the chain information, in DAG.ReplaceAllUsesOfValueWith(SDValue(LD, 1), newLoad.getValue(1));
The chain of the first use of a[i] is preserved, the "TokenFactor oriLoad, .., .." is updated with TokenFactor newLoad, .., .."
However, the chain for the second use of a[i] is lost. Because after the update, the TokenFactor only record the chain of the new Load.
The chain for the second use of the original Load should also need to be preserved.

We preserve the chain information of multiple uses of the original Load, by updating both the chain and value information.

We need to update


Repository:
  rL LLVM

https://reviews.llvm.org/D31676





More information about the llvm-commits mailing list