Page MenuHomePhabricator

[GVN] add early exit to ConstantFoldLoadThroughBitcast [NFC]
AbandonedPublic

Authored by vtjnash on Nov 6 2019, 9:33 AM.

Details

Reviewers
None
Summary

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.

Event Timeline

vtjnash created this revision.Nov 6 2019, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 6 2019, 9:33 AM
vtjnash abandoned this revision.Nov 6 2019, 9:37 AM