[llvm] r304582 - [CFI] Remove LinkerSubsectionsViaSymbols.

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 17:47:19 PDT 2017


Reverted in r304626.

On Fri, Jun 2, 2017 at 5:33 PM, Evgenii Stepanov
<eugeni.stepanov at gmail.com> wrote:
> Let me look at it for a minute. I'll revert if I can't figure out a quick fix.
>
> On Fri, Jun 2, 2017 at 5:10 PM, Vedant Kumar <vsk at apple.com> wrote:
>> Hi Evgeniy,
>>
>> This commit is causing a test failure on Darwin:
>> cfi-devirt :: anon-namespace.cpp
>>
>> Assertion failed: ((SymbolContents == SymContentsUnset || SymbolContents ==
>> SymContentsOffset) && "Cannot get offset for a common/variable symbol"),
>> function getOffset, file
>> /Users/buildslave/jenkins/sharedspace/phase1 at 2/llvm/include/llvm/MC/MCSymbol.h,
>> line 323.
>>
>> Do you have time to look at this today? If not, would you mind reverting to
>> unblock our bots for the weekend?
>>
>> Bot:
>> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/32075
>>
>> thanks,
>> vedant
>>
>> On Jun 2, 2017, at 11:45 AM, Evgeniy Stepanov via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: eugenis
>> Date: Fri Jun  2 13:45:14 2017
>> New Revision: 304582
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=304582&view=rev
>> Log:
>> [CFI] Remove LinkerSubsectionsViaSymbols.
>>
>> Since D17854 LinkerSubsectionsViaSymbols is unnecessary.
>>
>> It is interfering with ThinLTO implementation of CFI-ICall, where
>> the aliases used on the !LinkerSubsectionsViaSymbols branch are
>> needed to export jump tables to ThinLTO backends.
>>
>> Modified:
>>    llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
>>    llvm/trunk/test/Transforms/LowerTypeTests/simple.ll
>>
>> Modified: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=304582&r1=304581&r2=304582&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (original)
>> +++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp Fri Jun  2 13:45:14
>> 2017
>> @@ -235,7 +235,6 @@ class LowerTypeTestsModule {
>>   ModuleSummaryIndex *ExportSummary;
>>   const ModuleSummaryIndex *ImportSummary;
>>
>> -  bool LinkerSubsectionsViaSymbols;
>>   Triple::ArchType Arch;
>>   Triple::OSType OS;
>>   Triple::ObjectFormatType ObjectFormat;
>> @@ -475,13 +474,9 @@ void LowerTypeTestsModule::allocateByteA
>>     // Create an alias instead of RAUW'ing the gep directly. On x86 this
>> ensures
>>     // that the pc-relative displacement is folded into the lea instead of
>> the
>>     // test instruction getting another displacement.
>> -    if (LinkerSubsectionsViaSymbols) {
>> -      BAI->ByteArray->replaceAllUsesWith(GEP);
>> -    } else {
>> -      GlobalAlias *Alias = GlobalAlias::create(
>> -          Int8Ty, 0, GlobalValue::PrivateLinkage, "bits", GEP, &M);
>> -      BAI->ByteArray->replaceAllUsesWith(Alias);
>> -    }
>> +    GlobalAlias *Alias = GlobalAlias::create(
>> +        Int8Ty, 0, GlobalValue::PrivateLinkage, "bits", GEP, &M);
>> +    BAI->ByteArray->replaceAllUsesWith(Alias);
>>     BAI->ByteArray->eraseFromParent();
>>   }
>>
>> @@ -502,7 +497,7 @@ Value *LowerTypeTestsModule::createBitSe
>>     return createMaskedBitTest(B, TIL.InlineBits, BitOffset);
>>   } else {
>>     Constant *ByteArray = TIL.TheByteArray;
>> -    if (!LinkerSubsectionsViaSymbols && AvoidReuse && !ImportSummary) {
>> +    if (AvoidReuse && !ImportSummary) {
>>       // Each use of the byte array uses a different alias. This makes the
>>       // backend less likely to reuse previously computed byte array
>> addresses,
>>       // improving the security of the CFI mechanism based on this pass.
>> @@ -680,17 +675,13 @@ void LowerTypeTestsModule::buildBitSetsF
>>                                       ConstantInt::get(Int32Ty, I * 2)};
>>     Constant *CombinedGlobalElemPtr = ConstantExpr::getGetElementPtr(
>>         NewInit->getType(), CombinedGlobal, CombinedGlobalIdxs);
>> -    if (LinkerSubsectionsViaSymbols) {
>> -      GV->replaceAllUsesWith(CombinedGlobalElemPtr);
>> -    } else {
>> -      assert(GV->getType()->getAddressSpace() == 0);
>> -      GlobalAlias *GAlias = GlobalAlias::create(NewTy->getElementType(I *
>> 2), 0,
>> -                                                GV->getLinkage(), "",
>> -                                                CombinedGlobalElemPtr, &M);
>> -      GAlias->setVisibility(GV->getVisibility());
>> -      GAlias->takeName(GV);
>> -      GV->replaceAllUsesWith(GAlias);
>> -    }
>> +    assert(GV->getType()->getAddressSpace() == 0);
>> +    GlobalAlias *GAlias =
>> +        GlobalAlias::create(NewTy->getElementType(I * 2), 0,
>> GV->getLinkage(),
>> +                            "", CombinedGlobalElemPtr, &M);
>> +    GAlias->setVisibility(GV->getVisibility());
>> +    GAlias->takeName(GV);
>> +    GV->replaceAllUsesWith(GAlias);
>>     GV->eraseFromParent();
>>   }
>> }
>> @@ -1166,8 +1157,7 @@ void LowerTypeTestsModule::buildBitSetsF
>>             ArrayRef<Constant *>{ConstantInt::get(IntPtrTy, 0),
>>                                  ConstantInt::get(IntPtrTy, I)}),
>>         F->getType());
>> -    if (LinkerSubsectionsViaSymbols || F->isDeclarationForLinker()) {
>> -
>> +    if (F->isDeclarationForLinker()) {
>>       if (F->isWeakForLinker())
>>         replaceWeakDeclarationWithJumpTablePtr(F, CombinedGlobalElemPtr);
>>       else
>> @@ -1302,7 +1292,6 @@ LowerTypeTestsModule::LowerTypeTestsModu
>>     : M(M), ExportSummary(ExportSummary), ImportSummary(ImportSummary) {
>>   assert(!(ExportSummary && ImportSummary));
>>   Triple TargetTriple(M.getTargetTriple());
>> -  LinkerSubsectionsViaSymbols = TargetTriple.isMacOSX();
>>   Arch = TargetTriple.getArch();
>>   OS = TargetTriple.getOS();
>>   ObjectFormat = TargetTriple.getObjectFormat();
>>
>> Modified: llvm/trunk/test/Transforms/LowerTypeTests/simple.ll
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerTypeTests/simple.ll?rev=304582&r1=304581&r2=304582&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/Transforms/LowerTypeTests/simple.ll (original)
>> +++ llvm/trunk/test/Transforms/LowerTypeTests/simple.ll Fri Jun  2 13:45:14
>> 2017
>> @@ -1,5 +1,5 @@
>> ; RUN: opt -S -lowertypetests < %s | FileCheck %s
>> -; RUN: opt -S -lowertypetests -mtriple=x86_64-apple-macosx10.8.0 < %s |
>> FileCheck -check-prefix=CHECK-DARWIN %s
>> +; RUN: opt -S -lowertypetests -mtriple=x86_64-apple-macosx10.8.0 < %s |
>> FileCheck %s
>> ; RUN: opt -S -O3 < %s | FileCheck -check-prefix=CHECK-NODISCARD %s
>>
>> target datalayout = "e-p:32:32"
>> @@ -39,20 +39,6 @@ target datalayout = "e-p:32:32"
>> ; CHECK: @c = protected alias i32, getelementptr inbounds ({ i32, [0 x i8],
>> [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x
>> i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4)
>> ; CHECK: @d = alias [2 x i32], getelementptr inbounds ({ i32, [0 x i8], [63
>> x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32],
>> [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6)
>>
>> -; CHECK-DARWIN: @aptr = constant i32* getelementptr inbounds ({ i32, [0 x
>> i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63
>> x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G:@[^ ]*]], i32 0, i32 0)
>> - at aptr = constant i32* @a
>> -
>> -; CHECK-DARWIN: @bptr = constant [63 x i32]* getelementptr inbounds ({ i32,
>> [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8],
>> [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 2)
>> - at bptr = constant [63 x i32]* @b
>> -
>> -; CHECK-DARWIN: @cptr = constant i32* getelementptr inbounds ({ i32, [0 x
>> i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63
>> x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4)
>> - at cptr = constant i32* @c
>> -
>> -; CHECK-DARWIN: @dptr = constant [2 x i32]* getelementptr inbounds ({ i32,
>> [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8],
>> [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6)
>> - at dptr = constant [2 x i32]* @d
>> -
>> -; CHECK-DARWIN: [[G]] = private constant
>> -
>> ; CHECK: @bits{{[0-9]*}} = private alias i8, getelementptr inbounds ([68 x
>> i8], [68 x i8]* [[BA]], i32 0, i32 0)
>> ; CHECK: @bits.{{[0-9]*}} = private alias i8, getelementptr inbounds ([68 x
>> i8], [68 x i8]* [[BA]], i32 0, i32 0)
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>


More information about the llvm-commits mailing list