Certainly you can translate assembly instructions to basic blocks of
tuples and do constant detection and folding with the same algorithms
a compiler would use. You'll only detect new constants if your
constant folding algorithm is better than the original compiler's.

I believe profiling is irrelevant for constant detection because
determining in all cases whether a quantity is constant at run time is
an undecidable problem. The best you can do is "estimate" what's
constant from static program structure.