Open Quuxplusone opened 5 years ago
Bugzilla Link | PR42491 |
Status | NEW |
Importance | P enhancement |
Reported by | Reid Kleckner (rnk@google.com) |
Reported on | 2019-07-02 15:09:12 -0700 |
Last modified on | 2019-07-09 12:58:47 -0700 |
Version | trunk |
Hardware | PC Windows NT |
CC | dmajor@bugmail.cc, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
> clang, which overrides the module triple
"overrides" as in normalizes the module triple, or "overrides" as in
completely ignores it?
If clang is imposing its own notion of the triple without considering
what's in the IR file, that's... really bad.
(In reply to Paul Robinson from comment #1)
> > clang, which overrides the module triple
>
> "overrides" as in normalizes the module triple, or "overrides" as in
> completely ignores it?
> If clang is imposing its own notion of the triple without considering
> what's in the IR file, that's... really bad.
It completely ignores it:
$ cat t.ll
target triple = "x86_64-pc-win32"
declare dllimport void @my_function(double, double)
define i32 @main() {
call void @my_function(double 2.000000e+00, double 2.000000e+00)
ret i32 0
}
$ clang -c t.ll
warning: overriding the module target triple with x86_64-pc-windows-
msvc19.21.27702 [-Woverride-module]
1 warning generated.
At least it warns, though. *shrug*
Hm. Even if the .ll file has a different architecture, it overrides.
It's hard to believe that's desirable, even if it warns.
Maybe with an explicit -triple option, but not by default.
A few uses remain after r365387:
$ git grep isKnownWindowsMSVCEnvironment ../llvm ../clang
../clang/lib/Basic/TargetInfo.cpp:
TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment()
../clang/lib/CodeGen/CGObjCGNU.cpp:
CGF.CGM.getTarget().getTriple().isKnownWindowsMSVCEnvironment())
../clang/lib/CodeGen/CodeGenModule.cpp: if
(Context.getTargetInfo().getTriple().isKnownWindowsMSVCEnvironment() &&
../clang/lib/Driver/ToolChains/CommonArgs.cpp: if
(TC.getTriple().isKnownWindowsMSVCEnvironment()) {
../llvm/include/llvm/ADT/Triple.h: bool isKnownWindowsMSVCEnvironment() const {
../llvm/include/llvm/ADT/Triple.h: return isKnownWindowsMSVCEnvironment() ||
../llvm/lib/Analysis/TargetLibraryInfo.cpp: if
(T.isKnownWindowsMSVCEnvironment()) {
clang: The uses in clang are not that interesting because clang normalizes most
of its sources for triples, and normalization turns unknown environments into
MSVC environments. I think perhaps instead of normalizing everywhere, we might
want to drop the "known" MSVC env portion of our checks.
Triple.h: Definition and declaration
TargetLibraryInfo.cpp: This guards extraction of the CRT library version, so I
didn't remove it. There's no version to extract from an unknown environment.