Speaking as someone who typically did 26-35 hour stints 1-3 times a week without sleep for a few months at a time for three years (engineering school is a bitch), you can get away with it for a short period of time but I wouldn't recommend it for a long time. During the tail end of those stints I'd typically have somewhat reduced cognitive abilities, increased reaction time, dulled perception and dulled/somewhat inappropriate emotional responses. You might also find yourself craving a ton of carbohydrates and junk food, which will give you a temporary energy boost but leave you even more tired later, and I wouldn't recommend giving in to those impulses. Pulling occasional (or even semi-regular) all-nighters as a temporary strategy (for a few months to a few years, with periodic rest breaks where you sleep for a few days at a time) to wring the maximum possible amount of productivity out of yourself is not ideal, but not super risky, even with the addition of caffeine or low doses of amphetamine.
That said, regular stimulant-fueled all-nighters are not a good open-ended strategy, especially if things escalate to the point where you're pulling them more than once a week. Over time there's a decent chance that you're going to start developing a tolerance to whatever stim you're using. My freshman year of college, I was all-nightering about once or twice a week; I started September with basically no caffeine tolerance (80-150mg got me moderately wired for 4-6 hours), and by April and May I was consuming something like 7-12 mg/kg in an evening (700mg-1.2g in a 200lb male) to get a half-decent stimulant effect. Assuming amphetamine tolerance follows a similar trajectory to caffeine tolerance, and assuming you do roughly what I did, you'd be getting into cardiotoxic and neurotoxic doses within the first few months of use.
I'm not saying don't do it, but if you do decide to do it use stimulants as sparingly as you can, consider using wakefulness promoting agents like modafinil in conjunction with or in lieu of strong stimulants, and rotate your stims so that you don't develop too severe a tolerance too quickly.