[PATCH] D69905: [GVN] add early exit to ConstantFoldLoadThroughBitcast [NFC]

Jameson Nash via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 09:40:54 PST 2019


vtjnash created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
vtjnash abandoned this revision.

And adds some additional test coverage to ensure later commits don't introduce regressions.

[VNCoercion] avoid creating bitcast for zero offsets [NFCI]

This could previously make it more complicated for ConstantFolding later, leading to a higher likelyhood it would have to reject the expression,
even though zero seems like probably the common case here.

[GVN] teach ConstantFolding correct handling of non-integral addrspace casts

Here we teach the ConstantFolding analysis pass that it is not legal to replace a load of a bitcast constant (having a non-integral addrspace) with a bitcast of the value of that constant (with a different non-integral addrspace).

But also teach it that certain bit patterns are always known and convertable (a fact it already uses elsewhere). This requires us to also fix a globalopt test, since, after this change, LLVM is able to realize that the test actually is a valid transform (NULL is always a known bit-pattern) and so it doesn't need to emit the failure remarks for it.

Also simplify some of the negative tests for transforms by avoiding a type change in their bitcast, and add positive versions of the same tests, to show that they otherwise should work.

[GVN] Try to be more principled about non-integral pointers [NFCI]

Very similar to the recent work, such as "Fix a crash bug w/non-integral pointers and memtransfers". But try to be more precise about what should and should not be permitted, and consolidate all users into calling canCoerceMustAliasedValueToLoad (since that is the predicate that VNCoercion will check).

[GVN] Remove duplicated canCoerce tests [NFCI]

Now that canCoerceMustAliasedValueToLoad should contain the superset of all requirements for coercion to be legal to consider,
we can now remove what should be duplicate tests scattered elsewhere.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69905

Files:
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Transforms/Utils/VNCoercion.cpp
  llvm/test/Transforms/GVN/non-integral-pointers.ll
  llvm/test/Transforms/GlobalOpt/evaluate-call-errors.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69905.228085.patch
Type: text/x-patch
Size: 19808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191106/3d4a1fb3/attachment.bin>


More information about the llvm-commits mailing list