The diplodocus may be one of the largest vegetarians of all time. The sauropods may have had a taste for flesh.
Scientists are studying the teeth of some of the earliest dinosaurs to find out what they ate.
According to Dr Antonio Ballell Mayoral, who is the lead author of the research from the University of Bristol, the predecessors of omnivores did not share the same diet.
He said that the earliest members of the two main vegetarian dinosaurs were not exclusively herbivorous.
Ballell and colleagues analysed the teeth of 11 early dinosaurs, including an early bird-hipped dinosaur and a long-necked sauropod.
Ballell said teeth can give good clues about what an animal is eating.
The team made computer models of how stress would be distributed across the dinosaurs when they bite.
The team fed the results into machine-learning software that learns from the dental features and diet of 47 living lizards. The researchers were able to investigate the types of food that the early dinosaurs may have eaten.
The results show that Buriolestes schultzi and other early relatives of sauropods are likely to have been carnivores.
The taste of meat may have been familiar to the ancestors of the bird-hipped dinosaurs known as ornithischians. The authors suggest that the teeth of the Lesothosaurus diagnosticus could have been more resistant to mechanical damage than those of a typical animal.
Dinosaurs were able to adapt to changing climates and food resources thanks to their early diet.
Ballell said that recent discoveries challenged the idea that the earliest dinosaurs were killers. Carnivory is thought to be ancestral according to the Bristol research.
The research was innovative and inspiring according to Prof Steve Brusatte, a palaeontologist at the University of Edinburgh.
We have wondered how the earliest dinosaurs were able to survive. He said that the study used cutting-edge methods to study the diet of the oldest dinosaurs.
According to Brusatte, the first dinosaurs were probably meat-eaters, and that different groups of dinosaurs changed their diet over time, and this may have helped drive their diversity. Some of the oldest dinosaurs were experimenting with a wide variety of foods and feeding styles and this must have helped them fill many niches and become so successful.