This is an archive of the discontinued LLVM Phabricator instance.

[ConstraintElimination] Add function arguments to constraint system before solving
ClosedPublic

Authored by zjaffal on Feb 27 2023, 8:04 AM.

Details

Summary

If there is an optimisation opportunity and the function argument hasn’t been added to constraint
system through previous facts we fail to optimise it.

It might be a good idea to start the constraint system with all the function arguments added to the system

Diff Detail

Event Timeline

zjaffal created this revision.Feb 27 2023, 8:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2023, 8:04 AM
zjaffal requested review of this revision.Feb 27 2023, 8:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2023, 8:04 AM
zjaffal updated this revision to Diff 509363.Mar 29 2023, 7:30 AM

Seperate the patch from depending on other ConstraintElimination patches

fhahn added inline comments.Mar 29 2023, 9:52 AM
llvm/include/llvm/Analysis/ConstraintSystem.h
16

Not needed?

21–22

Is Argument used?Maybe FunctionArgs should use Argument * instead of Value *

22

keep newline here.

70

This passes the full vector by value. Use ArrayRef<Value *> instead.

78

Initialise this like Value2Index, as in : Value2Index(Value2Index), NumVariables(Value2Index.size())`.

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
143

Initialise UnsignedCS and SignedCS like DL, as in : UnsignedCS(FunctionArgs), SignedCS(FunctionArgs), DL(DL)

zjaffal updated this revision to Diff 509604.Mar 30 2023, 3:58 AM
  1. Pass FunctionArgs as ArrayRef<Value *> to ConstraintInfo and ConstraintSystem
  2. Remove unecessary import
  3. Change variable initialization for ConstraintInfo and ConstraintSystem
fhahn accepted this revision.Apr 3 2023, 6:07 AM

LGTM, thanks!

llvm/include/llvm/Analysis/ConstraintSystem.h
22

unrelated change, can you undo this before committing?

This revision is now accepted and ready to land.Apr 3 2023, 6:07 AM
This revision was landed with ongoing or failed builds.Apr 3 2023, 6:17 AM
This revision was automatically updated to reflect the committed changes.