Skip to content

Commit ce88ca9

Browse files
authored
[TableGen] Sign extend constants based on size for EmitIntegerMatcher. (#104550)
I'm planning to add a getSignedConstant to SelectionDAG and use it for EmitInteger in SelectionDAGISel which already uses int64_t. getSignedConstant will assert that the constant has the correct number of significant bits for the VT. This patch ensures that tablegen emits constants in this form.
1 parent 82fe793 commit ce88ca9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/utils/TableGen/Common/DAGISelMatcher.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,8 @@ class EmitIntegerMatcher : public Matcher {
836836

837837
public:
838838
EmitIntegerMatcher(int64_t val, MVT::SimpleValueType vt)
839-
: Matcher(EmitInteger), Val(val), VT(vt) {}
839+
: Matcher(EmitInteger), Val(SignExtend64(val, MVT(vt).getSizeInBits())),
840+
VT(vt) {}
840841

841842
int64_t getValue() const { return Val; }
842843
MVT::SimpleValueType getVT() const { return VT; }

0 commit comments

Comments
 (0)