This is an archive of the discontinued LLVM Phabricator instance.

Allow case-insensitive values for -mcpu for ARM in line with GCC.
ClosedPublic

Authored by enefaim on Jun 1 2015, 9:44 AM.

Details

Summary

GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.

This is a new version of r236859, which has been reverted due to test failures
in the AArch64 code path when running on 32 ARM buildbot.
I separated the ARM code path into this patch, while debugging the AArch64 failures.

Diff Detail

Repository
rL LLVM

Event Timeline

enefaim updated this revision to Diff 26905.Jun 1 2015, 9:44 AM
enefaim retitled this revision from to Allow case-insensitive values for -mcpu for ARM in line with GCC..
enefaim updated this object.
enefaim edited the test plan for this revision. (Show Details)
enefaim set the repository for this revision to rL LLVM.
enefaim added a subscriber: Unknown Object (MLST).

My only observation is that you have changed the Krait codepath, but have not added a test for that.

Otherwise LGTM.

+ StringRef MCPU = StringRef(A->getValue()).lower();

lower returns an std::string which will be immediately deleted leaving the
MCPU StringRef pointing at stale memory. MCPU should be a std::string.

rengolin edited edge metadata.Jun 1 2015, 11:59 AM

I agree a test for krait is needed.

cheers,
--renato

lib/Driver/Tools.cpp
5755

Voicing Craig Topper's comment on the list:

"lower returns an std::string which will be immediately deleted leaving the MCPU StringRef pointing at stale memory. MCPU should be a std::string"

enefaim updated this revision to Diff 26972.Jun 2 2015, 8:12 AM
enefaim edited edge metadata.

Changes in this version:

  • Added test cases for krait
  • Switched getARMTargetCPU to use std::string instead of StringRef
rengolin added inline comments.Jun 2 2015, 8:44 AM
lib/Driver/Tools.cpp
5750

Don't you need to change the type in the callers, too? Otherwise, the StringRef will refer to a temp variable that may disappear until it's used.

test/Driver/krait-cpu.c
11

You don't need a new CHECK line type, you could have re-used CHECK-CPUV7A

enefaim updated this revision to Diff 27035.Jun 3 2015, 6:23 AM

Changes in this version:

  • Change StringRef to std::string in getARMTargetCPU callers to avoid possible memory corruptions.
  • Remove unnecessary CHECK line from test/Driver/krait-cpu.c.
rengolin accepted this revision.Jun 3 2015, 6:30 AM
rengolin edited edge metadata.

LGTM, Thanks!

This revision is now accepted and ready to land.Jun 3 2015, 6:30 AM
rengolin closed this revision.Jun 5 2015, 1:28 AM

r239059