This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Cleanup ARM CGP isSupportedValue
ClosedPublic

Authored by samparker on Sep 14 2018, 2:26 AM.

Details

Summary

isSupportedValue explicitly checked and accepted many types of value, primarily for debugging reasons. Remove most of these checks and do a bit of refactoring now that the pass is more stable. This also enables ZExts to be sources, but this has very little practical benefit at the moment extend instructions will still be introduced.

Diff Detail

Event Timeline

samparker created this revision.Sep 14 2018, 2:26 AM
SjoerdMeijer accepted this revision.Sep 17 2018, 6:09 AM

Looks like a straightforward addition/cleanup to me.

This revision is now accepted and ready to land.Sep 17 2018, 6:09 AM
This revision was automatically updated to reflect the committed changes.

Looks like this changed causes errors in backend in stage 2 on Apple platforms

Argument value type does not match pointer operand type!
  %0 = atomicrmw volatile xchg i8* %_Value1, i32 1 monotonic, !dbg !26
 i8in function atomic_flag_test_and_set
fatal error: error in backend: Broken function found, compilation aborted!

Will provide more details shortly.

I've reduced the input causing error to

typedef _Atomic(_Bool)              atomic_bool;

typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;

_Bool atomic_flag_test_and_set(volatile atomic_flag *object) {
  return __c11_atomic_exchange(&(object)->_Value, 1, __ATOMIC_SEQ_CST);
}

And clang encounters the fatal error when invoked as

"bin/clang-8" "-cc1" "-triple" "thumbv6m-apple-unknown-macho" "-emit-obj" "-disable-free" "-static-define" "-mrelocation-model" "static" "-mthread-model" "posix" "-masm-verbose" "-mconstructor-aliases" "-ffreestanding" "-target-cpu" "cortex-m0" "-target-feature" "+soft-float" "-target-feature" "+soft-float-abi" "-target-feature" "-fp-only-sp" "-target-feature" "-d16" "-target-feature" "-vfp2" "-target-feature" "-vfp3" "-target-feature" "-fp16" "-target-feature" "-vfp4" "-target-feature" "-fp-armv8" "-target-feature" "-neon" "-target-feature" "-crypto" "-target-feature" "+strict-align" "-target-abi" "aapcs" "-msoft-float" "-mfloat-abi" "soft" "-fallow-half-arguments-and-returns" "-sys-header-deps" "-D" "NDEBUG" "-Oz" "-Wall" "-ferror-limit" "19" "-fmessage-length" "150" "-fno-signed-char" "-fobjc-runtime=gnustep" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-slp" "-x" "c" repro.c

I will revert the commit.

Thanks for the reproducer and for the revert.